Carp/out/project.carp

103 lines
2.1 KiB
Plaintext
Raw Normal View History

(reset! echo-signature-after-bake true)
2016-03-02 13:14:49 +03:00
(reset! log-unloading-of-dylibs true)
(when (not carp-dev)
(do
;;(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"))
nil
))
2016-01-22 17:25:37 +03:00
2016-03-02 13:14:49 +03:00
(defn generic-call-2 [x]
(+ (id 10) (id x)))
2016-02-10 13:50:28 +03:00
2016-03-02 13:14:49 +03:00
(defn generic-call-2b [x]
(+ (id 10) (id x)))
2016-02-19 13:37:01 +03:00
2016-03-02 13:14:49 +03:00
(defn test-generic-call-2 []
(do (bake generic-call-2)
(assert-eq (signature generic-call-2) (list :fn '(:int) :int))))
2016-03-02 13:14:49 +03:00
;;(test-generic-call-2)
2016-03-02 13:14:49 +03:00
;; (defstruct Vec2
;; [x :float
;; y :float])
2016-03-02 13:14:49 +03:00
;; (def pos (Vec2 3.4 5.5))
2016-02-28 13:19:21 +03:00
2016-03-02 13:14:49 +03:00
;; (defstruct Person
;; [name :string
;; age :int])
2016-02-29 01:18:12 +03:00
2016-03-02 13:14:49 +03:00
;; (defn me [] (Person "erik" 29))
;; ;;(bake me)
;; (def me-ast (lambda-to-ast (code me)))
;; (def me-deps (find-func-deps me-ast false))
;; (def me-con (gencon me-deps))
;; (def me-typed (infer-types me-deps nil))
;; ;;(def me-con (gencon me-ast))
;; (bake me)
;; (defn peeps []
;; [(me) (Person "Klabbe" 53)])
;; ;;(bake peeps)
;; ;; (println (str (map #name (peeps))))
;; ;; (println (str (map #age (peeps))))
2016-02-29 01:18:12 +03:00
;; (defn fa [] 100)
;; (bake fa)
;; (assert-eq 100 (fa))
;; (defn fb [] (fa))
;; (bake fb)
;; (assert-eq 100 (fb))
;; (defn fc [] (fa))
;; (bake fc)
;; (assert-eq 100 (fc))
;; (defn fd [] (fc))
;; (bake fd)
;; (assert-eq 100 (fd))
;;(defn fa [] 200)
;;(bake fa)
(defn problematic [prob-f prob-a prob-b]
;;(println (ref (str )))
(prob-f (ref prob-a) (str prob-b))
)
;; (defn problematic [x y z]
;; (x z))
(def prob-ast (lambda-to-ast (code problematic)))
;; (def prob-asta (annotate-ast prob-ast))
;; (println (str (let [ast-func-deps (find-func-deps prob-ast '())
;; ast-typed (infer-types ast-func-deps '())
;; ast-named (generate-names (copy {}) ast-typed)
;; ast-lifetimes (calculate-lifetimes ast-named)
;; _ (println (str ast-lifetimes))
;; ;;ast-generics (visit-generic-funcs ast-lifetimes)
;; ]
;; ;;ast-lifetimes
;; ;;ast-generics
;; nil
;; )))