Content deleted Content added
m →Example Code: lang="text" <- "q" |
|||
Line 27:
A line of ELI executes from right to left as a chain of operations; anything to the right of ‘//’ is a comment.
<source lang="text">
!10
1 2 3 4 5 6 7 8 9 10
</
Exclamation point (!) is an '''interval''' function. It can generate a vector of n integer from 1 to n.
<source lang="
5 * 2 + 10 // from right to left, 5 * (2 + 10)
60
</source>
The execution order of ELI is from right to left and all primitive functions have '''equal precedence'''.
<source lang="
{add: x+y} // short function form
add
Line 46:
</source>
First, a function <code>add</code> is declared in a short function form. Then, the arguments of the function can take either a scalar or a vector.
<source lang="
$!10 // rotation
10 9 8 7 6 5 4 3 2 1
</source>
The rotation operator returns the reverse order of a vector.
<source lang="
2 3#!6 // 2 dimension array (matrix)
1 2 3
Line 57:
</source>
A 2-by-3 matrix (or higher dimension array, e.g. <code>2 3 4#!24</code>) can be generated by <code>#</code> with left argument <code>2 3</code>.
<source lang="
x <- !20 // 1..20
x
|