_
is the variable. For example, [+ 1 _]
is equivalent to (fn (_) (+ 1 _))
:
arc> (map [+ 1 _] '(10 20 30)) (11 21 31)
:
, ~
, .
, and !
. The ~
character provides Boolean complement of a procedure; ~a
is equivalent to (complement a)
arc> (~odd 3) nil arc> (~even 3) tThe
:
character implements function composition; a:b
is equivalent to (compose a b)
and applies a
to the result of applying b
:
arc> (odd:sqrt 4) nil arc> (odd:sqrt 9) tThe syntax
a.b
is equivalent to (a b)
. It is intended for structure access:
arc> (= x '(a b c d)) (a b c d) arc> x.2 cThe syntax
a!b
is equivalent to (a 'b)
. It is intended for structure access where quoting is needed:
arc> (= tb (obj a 10 b 20 c 30)) #hash((c . 30) (a . 10) (b . 20)) arc> tb!a 10
Copyright 2008 Ken Shirriff.