What Can SKILL Do?
From: redacted
I’m trying to study SKILL, but don’t know much about the language. I’ve only been writing small scripts so far—less that 2,000 lines.
Can you show me some larger examples of SKILL/SKILL++ code, and give me some goals to attempt?
Thanks, redacted
From: Damien Diederen <dd@crosstwine.com>
Date: Tue, 15 Jan 2013 11:59:12 +0100
Hello redacted,
SKILL++ is easy to get started with: just rename your script from
<something>.il
to
<something>.ils
!
If your code is simple enough, it is likely that it will still work and produce the same results as before. A big difference is that functions and variables are now in the same namespace, that is:
procedure(Foo(list)
list(list)
)
println(Foo(42))
works in SKILL (.il
file extension), but fails in
SKILL++ (.ils
), because of the confusion between
list
and… list
.
In this case, Foo
is better written as:
procedure(Foo(x)
list(x)
)
which works in both dialects.
Try putting some of your code in .ils
files (start
small!), and tell me if something breaks that you cannot understand.
Note that even if these baby steps are not impressive, using
.ils
/SKILL++ is actually a huge improvement: it provides
you access to modern language features. A very important one is lexical
scoping; you can now use local helper functions!
let( ()
procedure(Square(x)
x*x
) ; procedure
println(Square(2))
println(Square(4))
) ; let
Note how the code above, while not terribly interesting, does what
one would expect, and that the Square
procedure is only
visible within the let()
block.
As to what is possible with SKILL++, the sky’s the limit! It’s a full-featured programming language; the only thing that is lacking is general-purpose libraries. I’ve started working on that; you can have a look at the source code of a lightweight CSV parser of mine:
http://crosstwine.com/veda/0.2.0/pkg/csv/csv.ils.html
Note that I’m using traditional Lisp syntax, but that’s not the point. One can perfectly write SKILL++ in infix notation.
Feel free to download my (growing) collection of SKILL/SKILL++ tools and libraries, and to use it for evaluation/learning purposes:
Note the version number, though: 0.2.0. It’s still very young; gotchas are to be expected. I’d be happy to have your feedback!
Cheers, -D