valeri/test/function.vli

19 lines
269 B
Text
Raw Normal View History

;; -*- mode: lisp; -*-
(fn fact (n)
(if (<= n 0)
1
(* n (fact (- n 1)))))
(assert (= (fact 12) 479001600))
(let ((square (fn (x) (* x x))))
(assert (= (square 4) 16))
)
(let ((x 42))
(assert (= ((fn (y) (+ x y) 1)
43)))
)