cells
A cell is a line that begins with a backtick
(,+ 1 2)the line keeps the text you typed; the editor shows the answer after it
everything else you write is data — the backtick is the one form that keeps recomputing
Names wear a comma
a bare word is that word; a word with a comma in front of it is a lookup
(,define (double x) (,* x 2))a definition binds into the set around it, so its siblings and everything below can use it
definitions made this way last for the session; reload and they are gone
Reading your own sets
(,subsets wine)hands you the children of the set wine as a list, each one a whole path rather than just the part it adds
you recover the part it adds by subtracting the parent, which is why most lisct programs open with a set difference
(wine ,defineas wines)binds the name and leaves a real set behind, so the name is still there after a reload
What the language gives you
special forms ,quote ,eval ,apply ,define ,lambda ,if ,cond ,let ,special?
arithmetic ,+ ,- ,* ,/ ,mod
comparison ,= ,< ,> ,<= ,>= two arguments each
lists ,cons ,car ,cdr ,map ,filter
tests ,isLit? ,cons? ,null?
values ,t ,f ,null ,else
your own sets ,subsetsA worked fragment
(,define (sum f items)
(,if (,null? items)
0
(,+ (f (,car items)) (,sum f (,cdr items)))))with that in scope, a cell can total a column of your own data
(,sum ,stock ,wines)Things that trip people up
there is no reduce — write the recursion
the comparisons take exactly two arguments; extra ones are ignored
lambda, and each cond clause, take exactly one body expression — nest a let if you need more
a key whose name matches the function reading it has to be quoted, as 'price, or it reads as the function itself
a published page shows a cell's source rather than its result: the doc view has no scope to run it in