2020-11-20 17:12:49 +03:00
|
|
|
; 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))
|
2017-12-05 19:08:10 +03:00
|
|
|
|
2020-11-20 17:12:49 +03:00
|
|
|
(defn-do g [i]
|
|
|
|
(println* "I'm g")
|
|
|
|
(f (inc i)))
|
2017-12-05 19:08:10 +03:00
|
|
|
|
2020-11-20 17:12:49 +03:00
|
|
|
(defn-do f [i]
|
|
|
|
(println* "I'm f")
|
|
|
|
(if (> i 10)
|
|
|
|
i
|
|
|
|
(g (inc i))))
|
2017-12-05 19:08:10 +03:00
|
|
|
|
|
|
|
(defn main []
|
2020-11-20 17:12:49 +03:00
|
|
|
(println* (fmt "Final result: %i" (g 0))))
|
|
|
|
|