2016-01-25 18:55:56 +03:00
|
|
|
(reset! echo-signature-after-bake true)
|
|
|
|
|
|
|
|
(when (not carp-dev)
|
2016-01-29 19:40:46 +03:00
|
|
|
(do
|
|
|
|
;;(load-lisp (str carp-dir "lisp/string_array.carp"))
|
|
|
|
;;(load-lisp (str carp-dir "lisp/glfw_test.carp"))
|
2016-02-11 12:56:26 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/examples.carp"))
|
2016-01-29 19:40:46 +03:00
|
|
|
nil
|
|
|
|
))
|
2016-01-22 17:25:37 +03:00
|
|
|
|
2016-02-10 14:00:01 +03:00
|
|
|
(def x '(1 2 3))
|
2016-02-10 13:50:28 +03:00
|
|
|
|
2016-02-19 13:37:01 +03:00
|
|
|
(defn id [x] x)
|
|
|
|
|
2016-02-19 18:35:44 +03:00
|
|
|
(defn id-test []
|
|
|
|
(id 123))
|
|
|
|
|
2016-02-23 23:19:25 +03:00
|
|
|
(def iast (lambda-to-ast (code id-test)))
|
|
|
|
|
|
|
|
;; (def icon (gencon iast)) <-- KRASCH!
|
|
|
|
;; (def iasta (annotate-ast iast))
|
|
|
|
|
2016-02-10 13:50:28 +03:00
|
|
|
;;(meta-set! x :dangerous 10)
|
|
|
|
|
2016-02-23 23:24:00 +03:00
|
|
|
(defn whatever [a b]
|
|
|
|
100)
|
|
|
|
|
2016-02-23 23:30:47 +03:00
|
|
|
(defn test-whatever-1 []
|
|
|
|
(whatever 1 2))
|
|
|
|
|
|
|
|
(defn test-whatever-2 []
|
|
|
|
(whatever "hej" "svejs"))
|
|
|
|
|
|
|
|
;; (bake test-whatever-1)
|
|
|
|
|
2016-02-24 18:59:59 +03:00
|
|
|
|
|
|
|
(defstruct Vec2 [x :float y :float])
|
|
|
|
|
2016-02-24 20:16:27 +03:00
|
|
|
(def v (Vec2 3.0 4.0))
|
|
|
|
|
|
|
|
(def x (#x v))
|
|
|
|
(def y (#y v))
|
|
|
|
|
2016-02-24 20:52:47 +03:00
|
|
|
;; pretend that the FauxVec2 type in shared.h is the same as Vec2 (they have the same memory layout):
|
|
|
|
(register-builtin "position" '() :Vec2)
|
|
|
|
|
|
|
|
(defn print-vec2 [m]
|
|
|
|
(println (str (#x m) ", " (#y m))))
|
|
|
|
|
2016-02-24 20:44:24 +03:00
|
|
|
(defstruct Mix [a :int b :float c :int])
|
|
|
|
|
|
|
|
(def m (Mix 10 3.2 20))
|
|
|
|
|
|
|
|
(defn print-mix [m]
|
|
|
|
(println (str "Mix: " (#a m) ", " (#b m) ", " (#c m))))
|
|
|
|
|
|
|
|
(defstruct Mix2 [mix-a :Mix mix-b :Mix])
|
|
|
|
(def m2 (Mix2 (Mix 1 2.0 3) (Mix 4 5.0 6)))
|
|
|
|
|
|
|
|
(defn test-mix2 []
|
|
|
|
(do
|
|
|
|
(print-mix (#mix-a m2))
|
|
|
|
(print-mix (#mix-b m2))))
|
|
|
|
|