mirror of
https://github.com/teo3300/rust-mal.git
synced 2026-01-12 01:05:32 +01:00
Adding helper functions
- improved 'help' - added 'find' - using clojure syntax for function arguments Signed-off-by: teo3300 <matteo.rogora@live.it>
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
(def! n-fib (fn* (n)
|
||||
(def! n-fib (fn* [n]
|
||||
(if (< n 2) n ; base
|
||||
(+ (n-fib (- n 1)) (n-fib (- n 2)))))) ; recursive
|
||||
|
||||
(def! assert-fib (fn* (n expected) ; check fibonacci result
|
||||
(def! assert-fib (fn* [n expected] ; check fibonacci result
|
||||
(if (not (= (n-fib n) expected))
|
||||
(do (prn (list
|
||||
"Expected"
|
||||
|
||||
Reference in New Issue
Block a user