Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c4b3c34e6c
Fetching contributors…

Cannot retrieve contributors at this time

80 lines (65 sloc) 1.584 kb
= mac! (fn '(name params . body)
(mac-eval `(= ,name (fn ',params
; remember to update isMacro if you change this
(mac-eval ((fn() ,@body))
mac! def!(name params . body)
`(= ,name (fn ,params ,@body))
mac! do body
`((fn() ,@body))
def! prn args
(if args
(pr car.args)
(prn @cdr.args)
(pr "
mac! def(name params . body)
if bound?.name
(prn "redef: " name)
`(def! ,name ,params ,@body)
mac! mac(name params . body)
if bound?.name
(prn "redef: " name)
`(mac! ,name ,params ,@body)
mac alias(new old) ; include later refinements
`(mac ,new $args
`(,,old ,@$args))
def compose(f g)
fn 'args
mac-eval `(,f (,g ,@args)) caller-scope
def complement(f)
(compose not f)
def list args
if args
(cons car.args
(list @cdr.args))
def map(f seq)
if seq
(cons (f car.seq)
(map f cdr.seq))
alias cadr car:cdr
alias cddr cdr:cdr
def id(_)
alias present? id
= quote (car ''1)
def quote?(_) (iso _ quote)
alias quoted? quote?:car
= backquote (car '`(1))
def backquote?(_) (iso _ backquote)
alias backquoted? backquote?:car
= unquote (car:cadr '`(,1))
def unquote?(_) (iso _ unquote)
alias unquoted? unquote?:car
= unquote-splice (car:cadr '`(,@1))
def unquote-splice?(_) (iso _ unquote-splice)
alias unquote-spliced? unquote-splice?:car
= splice (car '@1)
def splice?(_) (iso _ splice)
alias spliced? splice?:car
def die args
prn @args
Jump to Line
Something went wrong with that request. Please try again.