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.3.2 (change log)

release date:

2014-10-26

dependent on:

Java JRE 6 (1.6) 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. You may send bug reports and/or questions about setlX via e-mail to setlx@randoom.org. The complete code repository can also be checked out at gitorious.

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.6 (aka version 6) 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. Open the ‘setlX’-script in your favorite editor (either ‘vi’ or ‘emacs’ of course).
  6. Change the contents of the ‘setlXJarDirectory’-variable to the path where you copied the jar-files, e.g.

       setlXJarDirectory="/usr/local/setlX/"

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

       setlXlibraryPath="$HOME/setlXlibrary/"

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

       chmod +x /usr/local/bin/setlX

Installing setlX on Android (4.0.0 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. Open the copied ‘setlX.cmd’-script in your favorite editor.
  6. Change the contents of the ‘setlXJarDirectory’-variable to the path where you copied the jar-files, e.g.

       set setlXJarDirectory=C:\Program Files\setlX\

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

  8. Save and close the file.
  9. 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)

Bugs / 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. You may install the ‘rlwrap’ program to work around this issue.

Disclaimer

You may distribute setlX under the terms of the BSD license.

This program uses the ANTLR parser generator in version 4.0, which is also licensed under the BSD license.

[ The " BSD license "] Copyright ( c ) 2011 -2013 , Tom Herrmann All rights reserved .

Redistribution and use in source and binary forms , with or without modification , are permitted provided that the following conditions are met :

1. Redistributions of source code must retain the above copyright notice , this list of conditions and the following disclaimer . 2. Redistributions in binary form must reproduce the above copyright notice , this list of conditions and the following disclaimer in the documentation and / or other materials provided with the distribution . 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission .

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ‘‘ AS IS ’ ’ AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .

Change Log

---v2.3.2--- 2014-10-26

 + implemented lambda closures (e.g. x |=> y )
 # reworked stack handling

---v2.3.1--- 2014-10-13

 # minor performance fixes
 + updated tutorial

---v2.3.0--- 2014-10-09

 + implemented matrix functionality
 + separated closures and procedures; normal procedures do not have closure functionality
 + allow to access relations with multiple parameters without explicitly wrapping those
   parameters into a list, e.g.
   r[ [a,b] ] := 1; print(r[ [a,b] ]);
   may now be written as
   r[a,b] := 1; print(r[a,b]);
 + added specification of optional and unlimited parameters for procedures, closures and classes
 + added ability to expand lists as arguments for function calls

The full change log can be viewed here.

Download