setlX is an interpreter for the very high level programming-language SetlX (set language extended).
randoom.org/Software/SetlXPosted Apr 26, 2013, 12:43 PM UTC
Posted Apr 26, 2013, 12:43 PM UTC
I was wondering what made it "X" anyway, in the tutorial pdf found on Prof. Dr. Karl Stroetmann's page, it says:
...
At the Baden-Wuerttemberg Corporate State University, the first author [i.e Prof. Dr. Stroetmann] has used Setl2 [Sny90] for several years in a number of introductory computer science courses. He has noticed that the adoption of Setl has made the abstract concepts of set theory tangible to the students. Nevertheless, as the original version of Setl is more than forty years old, it has a number of shortcomings. One minor issue is the fact, that the syntax is quite dated and has proven difficult to master for students that are mainly acquainted with C and Java. Furthermore, Setl lacks any immediate support for first order terms. Therefore, Setl has been extended into the new language SetlX. The main features that have been changed or added are as follows:
- SetlX supports terms in a way similar to the language Prolog. In particular, SetlX supports matching. This makes SetlX well suited for symbolic computations.
- SetlX supports several ideas from functional programming. In particular, functions can be used as a primitive data type. Furthermore, SetlX supports closures and the memoization of functions.
- SetlX has support for regular expressions.
- SetlX provides backtracking.
- SetlX supports object oriented programming concepts.
- SetlX provides a small set of graphical primitives that support the animation of algorithms.
- Lastly, while Setl has a syntax that is reminiscent of Algol, SetlX has a syntax that is more akin to languages like C or Java.
...
It's based on SETL. I'd be interested to know what people think about this language.. it's rarely discussed here.
What makes it "very high-level"? Rather looks like a pretty limited language compared to modern high-level languages.
Of course, SETL was developed in the late 1960s. But it has a powerful set notation and list comprehension (which later made its way to Python), so that we can do things like:
If we want to know whether the formula
∃x ∈ {1, · · · , 10} : 2^x < x^2
is true, we have to write:
exists (x in {1..10} | 2 ** x < x ** 2);
Also
[ p : p in [2..100] | { x : x in {1..p} | p % x == 0 } == {1, p} ].
Here, the idea is that a number p is prime if the set of its divisors, which is the set of all numbers x such that p % x = 0, only contains the number 1 and the number p
flip any [1..10] (\x -> 2^x < x^2)
Nitpick: any takes its arguments in the other order, which is good, because it reads better that way. Anyway, clearly the best way to write it is:
or $ do
x <- [1..10]
return (2^x < x^2)
or maybe (warning: not tested)
+./ (2^x) < (x .= 1 + i. 10)^2
So would you say this is more of a domain specific language for sets, rather than a programming language (which would imply the existence of certain functionality)?
Looking at the examples here, I don't think it's a DSL
Shouldn't that be SetLX then?
Can it handle infinite sets? How about sets of functions? Sets of sets of continuous functions?
Seems like the same functionality can be made by a student as a small library in haskell or other modern language. And it's still too far from what you can achieve in dependently-typed languages like Coq, Agda and Idris.
I have fond memories of Set, so I just installed the android SetlX app. I was a little disappointed:
{x*x : x in {1..10} | x%2==0};
returns {4,16,36,64,100}, but
{x**2 : x in {1..10} | x%2==0};
produces a stack overflow.
EDIT:
{(x**2) : x in {1..10} | x%2==0};
works just fine. The tutorial says they thought Setl syntax was outdated so they X-ed it... The nice modern parenthesis fix things up.
Ever since reading a book on the set-heavy specification language Z back in the 90's, I've been intrigued on and off about the expressive power of reasoning with sets, integration of sets into programming languages in a reasonably programmer friendly manner and, now that I think about it again, ultimately maybe, just maybe another tiny baby step in the direction of "executable declarative specifications."
A step in the direction of executable specifications via the expressive power of set notation and reasoning with sets depends upon, well (sorry for the near tautology), a reasonably expressive notation for specifying and manipulating sets - not just a library.
Of course, as several languages (Haskell, Scala, Lisp and Scheme dialects, Caml P4/5, et. al.) incorporate features for expressive syntax extension, this need not imply the need for a brand new programming language. OTOH, I have never read or thought through the compile time or runtime system optimizations that might be available only via "native" set representations and associated operators. Food for thought.
[deleted]
Germans are apparently really particular about their honorific prefixes. My girlfriend told me that she once knew a guy who called himself "Prof. Dr. Dr." because he had two PhDs and was a professor..
"I didn't spend 16 years in medical school to be called Dr."
[deleted]
JVM
Such a language is a good idea when it can be compiled to something efficient (C++ hand-optimized efficiency). Unfortunately, this efficiency is not demonstrated which makes it worthless.
Anyone can create an interpreter for a language like this with no efficiency.
The reason it has been ignored is because it has not brought any benefit.
CPU efficiency is not the sole factor in driving language popularity, usefulness, or influence. I'm not saying this language will take off, but we should remember what it is: an experiment.
From the tutorial:
[...]
:)
Nice! I'd say they stated the benefits pretty clearly.