Previous section To contents

5.9 Operator functions

As mentioned earlier a + b can just as well be written as `+(a, b). Together with the function map which calls a function for every index in an array and the splice operator this can be used to create some very very fast and compact code. Let's look at some examples:
map(arr, `-)
This will return an array with each element negated.
map(text/"\n",`/," ")
This will divide a text into lines, each line will then be mapped through `/ and divided into an array of words.
`+(0, @arr)
This will add all the integers in the array arr together.
int abs(int a) { return ( a>0 ? `+ : `-)(a); }
This is a rather absurd but working function which will return the absolute value of a.

Previous section To contents