ELI (programming language): Difference between revisions

Content deleted Content added
WP:REFerence: plain text + inline WP:EXTernal link > WP:CITation, parameters: adds, fills, updates, standardize, conform to master templates. Adds: WP:LINK, Template:Official website.
m File extensions: <syntaxhighlight lang="q">
 
(One intermediate revision by the same user not shown)
Line 54:
</syntaxhighlight>
The execution order of ELI is from right to left, and all primitive functions have equal precedence.
<syntaxhighlight lang="textq">
5 * 2 + 10 // from right to left, 5 * (2 + 10)
60
</syntaxhighlight>
In the next example a function <code>add</code> is declared in a short function form. The arguments of the function can be either a scalar or a vector.
<syntaxhighlight lang="textq">
{add: x+y} // short function form
add
Line 68:
</syntaxhighlight>
The <code>$</code> rotation operator returns the reverse order of a vector.
<syntaxhighlight lang="textq">
$!10 // reverse
10 9 8 7 6 5 4 3 2 1
</syntaxhighlight>
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>.
<syntaxhighlight lang="textq">
2 3#!6 // 2 dimension array (matrix)
1 2 3
Line 79:
</syntaxhighlight>
In first line below the <code>x</code> is assigned with a vector from 1 to 20. Then, <code>1 = 2|x</code> returns odd number <code>True</code> and even number <code>False</code>. The <code>/</code> is a primitive function for compression which '''picks up''' the value in <code>x</code> corresponding to the <code>True</code> values in its left argument.
<syntaxhighlight lang="textq">
x <- !20 // 1..20
x
Line 103:
An ELI file with extension <code>.eli</code> is an ELI workspace file which contains everything in a workspace. <code>save</code> and <code>load</code> are commands for workspace files.
 
<syntaxhighlight lang="textq">
)save MyWorkspace
)load MyWorkspace