grino/examples/fun.gri

10 lines
210 B
Plaintext

;; 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 ))