'sk' is intended to allow experimentation with combinatory logic.
download
s et k combinators are builtin.
(((s f) g) x) -> ((f x) (g x))
((k c) x) -> c
'sk' supports two mixable syntaxes :
- Fully parentezised bin tree.
((s k) k)
- à la unlambda,
``skk
http://www.eleves.ens.fr:8080/home/madore/programs/unlambda/
The back quote stands for the two parenthesis around two parameters.
Definitions are possible with ':' :
- Uppercase letters glue to a word symbol. Two such consecutive words
must be separated by a white space.
``: FOO BAR returns BAR and defines FOO to BAR as a side effect.
- A single lowercase letter is a symbol.
``:z``sii
``:i``skk
`zx ->
`xx
The order of definitions doesn't matter for evaluation.
Is only relevant for definition expansion in a dump.
BUILDING :
Compiles with OCaml 3.10. Probably with other versions too.
Please check / adapt 'ocamlmakefile' path in Makefile
(current : debian path).
When OK :
make
should produces the 'sk' executable.
USE :
./sk [some_preedited_file]
Much more comfortable with 'rlwrap' or 'ledit'.
For example :
rlwrap ./sk someDefs.sk
Some definitions of someDefs.sk are borrowed from Rafael R. Sevilla
Combinator Engine 'lazy-l'.
http://combengine.sourceforge.net/
Church numerals arithmetic, for example.
(Often useful to add parameters to compare results. )
> ````+ 2 4 tu
((((+ 2) 4) t) u) or
````+ 2 4tu ->
(t (t (t (t (t (t u)))))) or
`t`t`t`t`t`tu
> ``6tu
((6 t) u) or
``6tu ->
(t (t (t (t (t (t u)))))) or
`t`t`t`t`t`tu
b,c,w belongs to Haskell Curry system of operators.
CONTROLS :
? dumps the coloured definitions on the console.
q quits, dumping the definitions to file 'definitions.sk'
COLOURS :
The symbols we can bring with ':' :
- defined name : dark blue
- undefined name : light blue
s combinator : green
k combinator : red
back_quote : yellow
The colour of the 'frame' : purple
To customize the colours, please edit 'sk_config.ml' and recompile, sorry !
CAVEAT :
The order of definitions are sloppily dumpped. So if you feed back a later
'sk' session with a previously output file, the definitions will be more or
less expanded.
If there is no side effect "operator" ( like ':' ) that shouldn't change
evaluations, however the clarity of initial definitions may be lost.
Maybe TODO :
Add some special operators like Unlambda's print operator '.'.
Define 'i' operator as builtin ?
Allow to predefine any operator.
Add a -o option to 'sk' for overriding default outfile name.
LINKS :
In addition to several links Rafael R. Sevilla gives in the README of his
'lazy-l' :
- http://combengine.sourceforge.net/README
- Jt Gleason blog about Qi language, were lay several articles about SK
combinators
http://programmingkungfuqi.blogspot.com/2007/06/simple-sk-combinator-calculus-tutorial.
- Wikipedia pages :
http://en.wikipedia.org/wiki/SKI_combinator_calculus
http://en.wikipedia.org/wiki/B%2CC%2CK%2CW_system