Files
kraken/bf.kp

119 lines
4.4 KiB
Plaintext
Raw Normal View History

;(def! main (fn* (argv) 2))
;(def! main (fn* () (let* (a 13 b 12 c 11) b)))
;(def! main (fn* () (do 13 12 11)))
;(def! main (fn* () (if false 1 2)))
;(def! main (fn* () (+ 13 1)))
;(def! main (fn* () (- 13 -1)))
;(def! main (fn* () (- 13 -1)))
;(def! main (fn* () (+ 13 -)))
;(def! main (fn* () (+ 13 1 2)))
;(def! main (fn* () (cond false 1 false 2 true 3 true 4 false 5)))
;(def! main (fn* () ((fn* () (+ (+ 1 2) 3)) 13 1 2)))
;(def! main (fn* () (((fn* () (fn* () 1))))))
;(def! main (fn* () ((fn* (a b c) (- (+ a b) c)) 13 1 4)))
;(def! main (fn* () (fn* () 1)))
;(def! other (fn* (a b c) (- (+ a b) c)))
;(def! main (fn* () (other 13 1 4)))
;(def! other 12)
;(def! main (fn* () (+ other 4)))
;(def! fact (fn* (n) (if (<= n 1) 1 (* (fact (- n 1)) n))))
;(def! main (fn* () (let* (to_ret (fact 5)) (do (println to_ret) to_ret))))
2020-04-19 21:52:21 -04:00
;(def! ret_with_call (fn* (n) (fn* (x) (+ n x))))
;(def! main (fn* () ((ret_with_call 3) 5)))
(def! test (fn* () (let* (
;(l (list 3 4 5))
a 5
2020-04-20 01:22:45 -04:00
;l '(a 4 5)
;l (vector 3 4 5)
;l [a 4 5]
2020-04-20 01:22:45 -04:00
l '[3 4 5]
;l '[a 4 5]
)
(nth l 0))))
;(def! main (fn* () (let* (it (test)) (do (println it) it))))
;(def! main (fn* () (let* (it "asdf") (do (println it) 0))))
;(def! main (fn* () (let* (it 'sym_baby) (do (println it) 0))))
;(def! main (fn* () (let* (it [1 2 3]) (do (println it) 0))))
;(def! main (fn* () (let* (it '(1 2 3)) (do (println it) 0))))
;(def! my_str "asdf")
;(def! main (fn* () (do (println my_str) 0)))
;(def! main (fn* () (let* (it (atom 7)) (do
; (println it)
; (println (deref it))
; (reset! it 8)
; (println (deref it))
; (deref it)
; ))))
2020-04-23 13:04:27 -04:00
;(def! my_atom (atom 5))
;(def! main (fn* () (do
2020-04-23 13:04:27 -04:00
; (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*
2020-04-23 13:04:27 -04:00
; (inner 7)
; (catch* exp (+ exp 10))))
; 7)))
;(def! main (fn* () (do (println (try*
2020-04-25 13:05:56 -04:00
; (inner 7)))
; 7)))
(def! to_be_saved (with-meta [1] [2]))
(def! to_be_saved_s "asdfasdf")
2020-04-25 13:05:56 -04:00
2020-05-10 19:29:28 -04:00
(let* ( a [0]
b (with-meta a (fn* () (set-nth! b 0 (+ 1 (nth b 0))))))
(do
(println "testing meta stuff!")
(println b)
((meta b))
(println b)
((meta b))
(println b)))
(def! our_obj (with-meta [0] (fn* () (set-nth! our_obj 0 (+ 1 (nth our_obj 0))))))
(def! main (fn* () (let* ( a 7
b [1]
c (with-meta b "yolo") )
2020-04-25 13:05:56 -04:00
(do
(try*
2020-05-10 00:17:30 -04:00
((fn* () (do
(println b)
(set-nth! b 0 2)
(println b)
(println c)
(println (meta c))
(println "world")
(println to_be_saved)
(println (meta to_be_saved))
(println to_be_saved_s)
2020-05-10 19:29:28 -04:00
(println "Here in main testing our_obj")
(println our_obj)
((meta our_obj))
(println our_obj)
((meta our_obj))
(println our_obj)
2020-05-10 00:17:30 -04:00
a)))
2020-04-25 13:05:56 -04:00
)))))
2020-05-10 00:17:30 -04:00
(do
(println "interp-main")
(main)
(println "done interp-main")
nil)
2020-04-25 13:05:56 -04:00