Fennel lang memory aid
(, en)
I don’t use Fennel a lot, so when I want to use it, I usually need a quick refresher. Here I’m collecting stuff I always forget.
`fooexpands to(quote foo),fooexpands to(unquote foo)-
#fooexpands to(hashfn foo). These are all the same:#(+ $1 $2) (fn [a b] (+ a b)) (hashfn (+ $1 $2)) ; implementation detail; don't use directly
#$3 ; same as (fn [x y z] z)
#[$1 $2 $3] ; same as (fn [a b c] [a b c])
#{:a $1 :b $2} ; same as (fn [a b] {:a a :b b})
#$ ; same as (fn [x] x) (aka the identity function)
#val ; same as (fn [] val)
#[:one :two $...] ; same as (fn [...] ["one" "two" ...])
(. mytbl myfield) ; table lookup
(?. mytbl myfield) ; Nil-safe table lookup
