Skip to content

Commit

Permalink
Add map and fib functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdearman committed Feb 20, 2024
1 parent 29bec37 commit e4c91a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/mvp.scm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
([])
((x :: xs) (pair (f x) (map f xs)))))

(def map f [] [])
(def map f (Pair x xs) (Pair (f x) (map f xs)))

(def fib 0 0)
(def fib 1 1)
(def fib n (+ (fib (- n 1)) (fib (- n 2))))

(defn fact (n)
(if (= n 0)
1
Expand Down

0 comments on commit e4c91a7

Please sign in to comment.