setlX

Computers make very fast, very accurate mistakes.

In General

Overview most recent version: 2.7.2 (changes) release date: 2019-06-03 dependent on: Java JRE 7 (1.7) or higher license: BSD development state: active

setlX is an interpreter for the high level programming language SetlX ( set l anguage e x tended).

The most distinguishing feature of this language is the support it offers for sets and lists. As set theory is the language of mathematics, many mathematical algorithms that are formulated in terms of set theory have very straightforward implementations in SetlX.

Designed mostly by Karl Stroetmann, the SetlX language is an evolution of Setl by Jack Schwartz. It was specifically conceived to make the unique features of Setl more accessible to today's computer science students.

This interpreter is currently the SetlX reference implementation. The complete code repository can be checked out at github. You may send bug reports and/or questions about setlX via e-mail to setlx@randoom.org, or via github.

Installing setlX on a Unix-like OS (Linux, MacOS X, etc.)

Make sure that a Java runtime, which is compatible, is installed and working.

You can verify this by executing:



java -version



inside a terminal (-emulator). Download the setlX zip file. Unzip the downloaded file into a directory of your choosing. Copy all ‘setlX*.jar’ -files into some folder, which is accessible by all users, who should be able to execute setlX (e.g. ‘/usr/local/setlX/’ ).

You may also copy them into the home directory of some user, when she is the only setlX-user on the system (e.g. ‘/home/<user>/programs/setlX/’ ). Copy the contents of the default ‘setlXlibrary’ into some folder for each user (e.g. ‘/home/<user>/setlXlibrary/’ ). Open the ‘setlX’ -script in your favorite editor (either ‘vi’ or ‘emacs’ of course). Change the contents of the ‘setlXJarDirectory’ -variable to the path where you copied the jar-files, e.g.



setlXJarDirectory="/usr/local/setlX/"



Change the ‘setlXlibraryPath’ -variable to the path where setlX should look for library files, e.g.



setlXlibraryPath="$HOME/setlXlibrary/"



Save and close the file. Copy the modified ‘setlX’ -script into some folder, which is in the search path of all users which should be able to execute setlX (e.g. ‘/usr/local/bin’ ).

When only used by one user, you may copy it into the ‘bin’ directory in her home instead (e.g. ‘/home/<user>/bin’ ). Make the script executable, e.g.



chmod +x /usr/local/bin/setlX



(Optional) You should also install the ‘rlwrap’ utility (see Limitations section). If present, it will be used automatically.

Installing setlX on MacOS X with homebrew

setlX may be installed easily if you use homebrew. Just follow the very short instructions by Niklas Korz at github.com/niklaskorz/homebrew-setlx.

Installing setlX on Android (4.0.4 or higher)

If you can not use the Android Market, or do not want to, you can download the apk directly.

A deprecated version for Android 2.3.4 up until 3.2 is also available.

Installing setlX on Microsoft Windows

Make sure that a Java runtime, which is compatible, is installed and working.

You can verify this by executing:



java -version



inside a ‘Command Prompt’. Download the setlX zip file. Unzip the downloaded file into a directory of your choosing. Copy all ‘setlX*.jar’ -files and the ‘setlX.cmd’ -file into some folder, which is accessible by all users, who should be able to execute setlX (e.g. ‘C:\Program Files\setlX\’ ). Copy the contents of the default ‘setlXlibrary’ into some folder for each user (e.g. ‘C:\Program Files\setlX\library’ ). Open the copied ‘setlX.cmd’ -script in your favorite editor. Change the contents of the ‘setlXJarDirectory’ -variable to the path where you copied the jar-files, e.g.



set setlXJarDirectory=C:\Program Files\setlX\



'Change the ‘SETLX_LIBRARY_PATH’ -variable and set it to the path where setlX should look for library files, e.g.



set SETLX_LIBRARY_PATH=C:\Program Files\setlX\library



Save and close the file. Add the folder where you placed the files into to the search-path (requires Administrator privileges): Press [Win]+[Pause] key combination to open system preferences. On Windows Vista or newer:

Click on ‘Advanced system settings’ on the left pane, which opens a new window.



On Windows XP or older:

Click the ‘Advanced’ tab in the current window. Click on ‘Environment Variables’ on the bottom, which opens another window. Select the ‘Path’ variable in the ‘System variables’ section and click on ‘Edit...’ , which opens jet another window. Add a semicolon ( ‘;’ ) followed by the full path to the folder where you installed setlX to the very end of the string in the ‘Variable value’ field. The new value should look like:



<previous value>;C:\Program Files\setlX



Accept all changes by clicking ‘OK’ in all windows you opened before. End you current session and login into Windows again.

Getting started with setlX

Now you can start the interpreter by executing:



setlX



inside a terminal (-emulator). The interpreter will launch and present you with a prompt, where you may start typing SetlX code.

One example code-fragment would be:



for (l in [83,101,116,108,88]) {print(char(l));}



After you are done, you can leave the interpreter by typing:



exit;



into the interpreters prompt. You may continue by reading the in depth tutorial explaining all major features of SetlX.

Executing Files

To execute a file, start the interpreter with the path to the SetlX source file as an argument:

setlX <path>/<name>.stlx

Various SetlX code files are available, which demonstrate some features of the language.

Screenshot

(click the image to show a higher quality version)

Interesting SetlX related projects

Once you are converted to be a true believer in the language, there are some related projects to look at:

Limitations

Due to its implementation and execution by the Java Virtual Machine (JVM), an "out of memory error" might be encountered when executing SetlX programs using deep recursion, very large or very many sets and/or lists.

The JVM is only able to dynamically increase its memory allocation in very limited bounds, no matter how much free memory is available. To work around these problems, edit the used launching script ( ‘setlX’ or ‘setlX.cmd’ ) with a text editor and follow the directions given at the top of the script.

The JVM is only able to dynamically increase its memory allocation in very limited bounds, no matter how much free memory is available. To work around these problems, edit the used launching script ( or ) with a text editor and follow the directions given at the top of the script. On UNIX (-like) systems, the prompt in interactive mode does not handle control sequences correctly. This is a Java limitation and no good platform independent solutions are available. You may install the ‘rlwrap’ program to work around this issue. If present, it will be used automatically.

Disclaimer

You may distribute setlX under the terms of the BSD license. This program uses the ANTLR parser generator, which is also licensed under the BSD license. The functions for plotting require jfreechart, which is licensed under the LGPL license.

Change Log

---v2.7.2--- 2019-06-03 # Raising 0 to the power of some negative number will result in some more useful exception ---v2.7.1--- 2018-10-15 # Fix issue with parameter of setPenColor() # Unix launch script: prevent usage of rlwrap inside emacs ---v2.7.0--- 2017-10-03 + add statistics library by Leon Mutschke and Jonas Siefker ---v2.6.1--- 2017-04-08 + add la_hadamard(matrixA, matrixB) procedure # fix sorting with different number types: sort([1, 3, 2.0, 4.0]) ---v2.6.0--- 2017-01-08 + multiplication of matrix and vector will result in a vector instead of a matrix + the <==> operator is now a viral operation when terms are involved

The full change log can be viewed here.

Downloads