throw and catch implemented

This commit is contained in:
Nathan Braswell
2020-04-23 13:04:27 -04:00
parent ae150b17fa
commit e74c883132
2 changed files with 58 additions and 25 deletions

26
bf.kp
View File

@@ -100,13 +100,25 @@
; (println (deref it))
; (deref it)
; ))))
(def! my_atom (atom 5))
(def! main (fn* [] (do
(println my_atom)
(println (deref my_atom))
(reset! my_atom 1337)
(println my_atom)
(println (deref my_atom))
;(def! my_atom (atom 5))
;(def! main (fn* [] (do
; (println my_atom)
; (println (deref my_atom))
; (reset! my_atom 1337)
; (println my_atom)
; (println (deref my_atom))
; 7)))
;(def! inner (fn* [x] (do (throw (+ x 1)) (+ x 2))))
(def! inner (fn* [x] (do (println 7) (+ x 2))))
;(def! main (fn* [] (do (println (try*
; (inner 7)
; (catch* exp (+ exp 10))))
; 7)))
(def! main (fn* [] (do (println (try*
(inner 7)))
7)))