mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
20 lines
452 B
Plaintext
20 lines
452 B
Plaintext
; This is dangerous because you've now told the Carp compiler that `f`
|
|
; _will_ exist. So you won't get a compile error from Carp if you don't
|
|
; implement it or change the signature. You should get a error in the C
|
|
; compiler though.
|
|
(register f (Fn [Int] Int))
|
|
|
|
(defn-do g [i]
|
|
(println* "I'm g")
|
|
(f (inc i)))
|
|
|
|
(defn-do f [i]
|
|
(println* "I'm f")
|
|
(if (> i 10)
|
|
i
|
|
(g (inc i))))
|
|
|
|
(defn main []
|
|
(println* (fmt "Final result: %i" (g 0))))
|
|
|