Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: a56cf4989a
Fetching contributors…

Cannot retrieve contributors at this time

58 lines (43 sloc) 1.06 kB
* cons
- marked with semi-colon
- ~H:T~
+ creates cons and dotted pairs, depending on types
* lambda
- like a Ruby block
- closure
- ~{|a b & more| ...}~
* lists
- square brackets
- ~[1 2 3]~
* examples
(def best {|f xs|
(foldl {|x y| (if (f x y) x y)} xs)})
(def best (fun (f xs)
(foldl {|x y| (if (f x y) x y)} xs)))
(def flatten {|x|
(if (list? x)
(apply concat (map flatten x))
(def remove-if {|f lst|
(if (list? lst)
(if (f (head lst))
(recur f (tail lst))
(first lst):(remove-if f (tail lst)))
(def remove-if {|f lst|
(if (list? lst)
(if (f (head lst))
(recur f (tail lst))
<(first lst) (remove-if f (tail lst))>)
(def delayed { (remove-if even? (range 1000000)) })
(def force {|d| (d)})
(force delayed)
;; this is not a true delay of course
let f = eval env hd in
(match f with
Lambda _ ->
apply f ( (eval env) tl)
Macro _ ->
let newExpr = apply f tl in
eval env newExpr)
Jump to Line
Something went wrong with that request. Please try again.