Home

Software

Old Software

Downloads

about the author
contact

colophon

Software /
setlX

setlX

Computers make very fast, very accurate mistakes.

In General

Overview

most recent version:

2.6.0 (change log)

release date:

2017-01-08

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 language extended).

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.)

  1. Make sure that a Java runtime, which is compatible to Java version 1.7 (aka version 7) or higher, is installed and working.
    You can verify this by executing:

       java -version

    inside a terminal (-emulator).
  2. Download the setlX zip file.
  3. Unzip the downloaded file into a directory of your choosing.
  4. 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/’).
  5. Copy the contents of the default ‘setlXlibrary’ into some folder for each user (e.g. ‘/home/<user>/setlXlibrary/’).
  6. Open the ‘setlX’-script in your favorite editor (either ‘vi’ or ‘emacs’ of course).
  7. Change the contents of the ‘setlXJarDirectory’-variable to the path where you copied the jar-files, e.g.

       setlXJarDirectory="/usr/local/setlX/"

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

       setlXlibraryPath="$HOME/setlXlibrary/"

  9. Save and close the file.
  10. 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’).
  11. Make the script executable, e.g.

       chmod +x /usr/local/bin/setlX

  12. (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)

Get it on Google Play

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

A deprecated version (v1.4.5) for Android 2.3.4 up until 3.2 is also available.

Installing setlX on Microsoft Windows

  1. Make sure that a Java runtime, which is compatible to Java version 1.6 (aka version 6) or higher, is installed and working.
    You can verify this by executing:

       java -version

    inside a ‘Command Prompt’.
  2. Download the setlX zip file.
  3. Unzip the downloaded file into a directory of your choosing.
  4. 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\’).
  5. Copy the contents of the default ‘setlXlibrary’ into some folder for each user (e.g. ‘C:\Program Files\setlX\library’).
  6. Open the copied ‘setlX.cmd’-script in your favorite editor.
  7. Change the contents of the ‘setlXJarDirectory’-variable to the path where you copied the jar-files, e.g.

       set setlXJarDirectory=C:\Program Files\setlX\

  8. '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

  9. Save and close the file.
  10. Add the folder where you placed the files into to the search-path (requires Administrator privileges):
    1. Press [Win]+[Pause] key combination to open system preferences.
    2. 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.
    3. Click on ‘Environment Variables’ on the bottom, which opens another window.
    4. Select the ‘Path’ variable in the ‘System variables’ section and click on ‘Edit...’, which opens jet another window.
    5. 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

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

Getting started with setlX

  1. Now you can start the interpreter by executing:

       setlX

    inside a terminal (-emulator).
  2. 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));}

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

       exit;

    into the interpreters prompt.
  4. 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

screenshot of version 0.7.7

(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.
  • 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.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

---v2.5.3--- 2016-11-26

 # fix modulo and integer division when negative numbers are involved

---v2.5.2--- 2016-11-01

 # fix bug that terms are not viral in Boolean operations
 + added varName to termUtilities library

---v2.5.1--- 2016-10-15

 # fix bug that doubles and rationals are regarded equal in too many cases
 * Note: now set of equal doubles and rationals will contain both values,
   instead of just one ({1.0, 1, 1} -> {1.0, 1} instead of just {1} or {1.0})
 + added procedure writeLibrary() that will (re)write the default library
   matching the running setlX version into the library path
 + added procedure writeExamples(directoryPath) that will (re)write the
   examples of the running setlX version into the supplied path

---v2.5.0--- 2016-10-01

 * Note: the setlX start scripts changed - please update yours!
 * Note: setlX now requires Java7 or higher to run
 + Changed confusing matching of variables and functions
   * removed quote expression ('@')
   + terms must start with an at symbol ('@') instead of an upper case letter
   + variables can start with upper case letters
   + added isVariable(term) function, that tests if given term represents a variable
   * 'internal' terms start with three at symbols ('@@@') instead of one
   * please (re)read related sections in tutorial for more details and clarifications
 + forall and exists will set their iteration variables to om, when forall == true and exists == false
 + added standard library files that are distributed with the interpreter
 + accessing the members of a matrix will return a vector instead of a list
 # fixed minor bug in plotting functions

The full change log can be viewed here.

Download