mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 20:49:05 +03:00
fixed the tests, added str-ref macro
This commit is contained in:
parent
a6e052d98c
commit
673da910bb
@ -10,15 +10,18 @@
|
||||
;; (println (str (B true)))
|
||||
|
||||
|
||||
(defn f [s]
|
||||
(println s))
|
||||
;; (defn f [i]
|
||||
;; (println (ref (itos (copy i)))))
|
||||
|
||||
^ann '(:fn ((:ref :int)) :void)
|
||||
(defn f [x]
|
||||
(println (str-ref (copy x))))
|
||||
|
||||
;;^ann '(:fn ((:ref (:Array :string))) :void)
|
||||
(defn draws [state]
|
||||
(domap f state))
|
||||
|
||||
(defn run-app [draw-fn]
|
||||
(let [state [(copy "hej") (copy "på") (copy "dig!")]]
|
||||
(let [state [10 20 30]]
|
||||
(draw-fn &state)))
|
||||
|
||||
(defn app []
|
||||
|
@ -262,6 +262,9 @@
|
||||
(for (i 0 (count xs))
|
||||
(f (nth xs i))))
|
||||
|
||||
(defmacro str-ref (x)
|
||||
(list 'ref (list 'str x)))
|
||||
|
||||
(defn second [xs]
|
||||
(nth xs 1))
|
||||
|
||||
|
@ -235,6 +235,9 @@
|
||||
|
||||
(:fn ((:ref (:Array t))) :string) (instantiate-str-for-array c-func-name t)
|
||||
|
||||
(:fn ((:ref :int)) :string) (let [proto (str "API string " c-func-name "(int x)")
|
||||
c (str proto " { return itos(x); }")]
|
||||
{:proto proto :c c :deps ()})
|
||||
(:fn (:int) :string) (let [proto (str "API string " c-func-name "(int x)")
|
||||
c (str proto " { return itos(x); }")]
|
||||
{:proto proto :c c :deps ()})
|
||||
|
Loading…
Reference in New Issue
Block a user