Loop function can be simpler

This commit is contained in:
Nathan Braswell
2020-04-10 23:05:05 -04:00
parent 7bc58e904e
commit 721dc203be

6
bf.kp
View File

@@ -10,11 +10,11 @@
(add_grammer_rule :bfs_list [] (fn* [xs] xs))
(add_grammer_rule :bfs_list [:non_empty_bfs_list] (fn* [xs] (nth xs 0)))
(add_grammer_rule :bfs_atom ["\\[" :bfs_list "]"] (fn* [xs]
`(let* (f (fn* [f]
`(let* (f (fn* []
(if (= 0 (nth (deref arr) (deref ptr)))
nil
(do ,(nth xs 1) (f f)))))
(f f))))
(do ,(nth xs 1) (f)))))
(f))))
(add_grammer_rule :bfs [:bfs_list] (fn* [xs] (nth xs 0)))
(def! with_update (fn* [arr idx val]
(if