slimp/example.slimp

28 lines
698 B
Text
Raw Normal View History

2023-06-12 11:40:38 -04:00
(forall (n) (range-to n) (reverse (range-to n nil)))
(forall (xs) (range-to 0 xs) xs)
(forall (n xs) (range-to (s n) xs) (cons (s n) (range-to n xs)))
(forall (a as bs) (++ (cons a as) bs) (cons a (++ as bs)))
(forall (bs) (++ nil bs) bs)
(forall (a) (singleton a) (cons a nil))
(def (reverse nil) nil)
(forall (a as) (reverse (cons a as)) (++ (reverse as) (singleton a)))
(forall (n) (+ n 0) n)
(forall (a b) (+ a (s b)) (s (+ a b)))
(forall (n) (* n 0) 0)
(forall (a b) (* a (s b)) (+ a (* a b)))
(def 1 (s 0))
(def 2 (s 1))
(def 3 (s 2))
(def 4 (s 3))
(def 5 (s 4))
(def 6 (s 5))
(def 7 (s 6))
(def 8 (s 7))
(def 9 (s 8))
(def 10 (s 9))
(def 20 (+ 10 10))
; i need to do comments
(range-to 5)