;; declare lambda ($ a (-> (x) (* x 2))) (assert-eq? 14 (a 7)) ;; high order function ($ b (-> (x y) (x (x y)))) (assert-eq? 12 (b a 3)) ;; calling function literal (assert-eq? 7 ( (-> (x y) (+ x y 1)) 2 4 )) ;; syntaxic sugar for function declaration ($ (c n) (* 2 n)) (assert-eq? 18 (c 9)) ;; inner variable ($ (d x) ($ y 3) (+ x y)) (assert-eq? 7 (d 4)) ;; recursivity ($ (e n) (if (eq? 0 n) 1 (* n (e (- n 1))))) (assert-eq? 120 (e 5)) ;; self keyword (assert-eq? 720 ((-> (x) (if (eq? x 0) 1 (* x (self (- x 1))))) 6))