ELI (programming language)
This article needs additional citations for verification. |
Paradigm | array |
---|---|
Designed by | Wai-Mee Ching |
Developer | Rapidsoft[2] (Hanfeng Chen[3]) |
First appeared | 2011 |
Stable release | 0.2
/ November 30, 2013 |
Typing discipline | dynamic |
Website | fastarray |
Major implementations | |
C++ | |
Influenced by | |
APL, Q |
ELI is an interactive array programming language system based on APL. It has the most of functionalities of ISO APL standard. In addition to classical APL, ELI features list for non-homogeneous or non-rectangular data, complex numbers, symbols, temporal data, and control structures. A scripting file facility helps a user to easily organize programs in a fashion similar to using #include in C, which also provides convenient data input/output. Moreover, ELI has dictionaries, tables and a basic set of SQL-like statements. For performance, ELI offers a compiler restricted to flat array programs.
By replacing each APL character with one or two ASCII characters, ELI retains APL’s succinct and expressive way of doing array programming, i.e. compared with MATLAB or Python, ELI encourages a dataflow style of programming where the output of one operation feeds the input of another that results in greater productivity and clarity of code.
ELI is free and available on Windows, Linux and Mac OS.
Sample
The following is a sample to illustrate the flavor of the language which incidentally shows that ELI is easy to learn and free of unnecessary syntactic clutters.[citation needed]
A line of ELI executes from right to left as a chain of operations; anything to the right of ‘//’ is a comment.
!10 //get the vector 1..10 1 2 3 4 5 6 7 8 9 10 100*!10 //multiply that vector by 100 100 200 300 400 500 600 700 800 900 1000 3 4#!10 //reshape the vector 1..10 into a 3x4 matrix 1 2 3 4 5 6 7 8 9 10 1 2 &.3 4#!10 //flip the above matrix 1 5 9 2 6 10 3 7 1 4 8 2 +/3 4#!10 //sum each row of the 3x4 matrix 10 26 22 2*0,!10 //append 0 in front of 1..10, and double it 0 2 4 6 8 10 12 14 16 18 20 2*.0,!10 //2 to the power of 0..10 1 2 4 8 16 32 64 128 256 512 1024 %1 2 3 5 10 //1 divided by 1 2 3 5 10 1 0.5 0.3333333333 0.2 0.1 1024*.%1 2 3 5 10 //1024 takes 1 root, square root, cube root, … 1024 32 10.0793684 4 2 1-2 //1 minus 2 _1 _1*.0.5 //square root of minus 1 0j1 @1 3.141592654 //pi *.0j1*@1 //eiΠ = -1 _1 2012.12.25+!7 //7 days following Christmas of 2012 2012.12.26 2012.12.27 2012.12.28 2012.12.29 2012.12.30 2012.12.31 2013.01.01 w<-10?.100 //get 10 random numbers from 1..100 w 14 76 46 54 22 5 68 94 39 52 w<50 //compare w with 50 1 0 1 0 1 1 0 0 1 0 (w<50)/w //select elements in w which are less than 50 14 46 22 5 39 +\(w<50)/w //partial sums of the vector above 14 60 82 87 126 $_3+!12 //reverse of _3 adds to 1..12 9 8 7 6 5 4 3 2 1 0 _1 _2 32+1.8*c<-$_2+!12 //Fahrenheit correspond to Celsius above 48.2 46.4 44.6 42.8 41 39.2 37.4 35.6 33.8 32 30.2 28.4 c,[1.5]32+1.8*c<-$_3+!12 //a table of temperature conversion 9 48.2 8 46.4 7 44.6 6 42.8 5 41 4 39.2 3 37.4 2 35.6 1 33.8 0 32 _1 30.2 _2 28.4 (2 3#!6;`ny `ma `md;'ABCDE') //a list of numbers, symbols, chars <1 2 3 4 5 6 <`ny `ma `md <ABCDE #"(2 3#!6;`ny `ma `md;'ABCDE') //shape of each element in the list <2 3 <3 <5