mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 13:37:57 +03:00
Tried out writing a conditional compilation function.
This commit is contained in:
parent
1cbf55beb5
commit
699e64d9ed
@ -71,3 +71,8 @@
|
||||
|
||||
(defmacro swap! [x y]
|
||||
(list 'let (array 'tmp y) (list 'do (list 'set! &y x) (list 'set! &x 'tmp))))
|
||||
|
||||
(defdynamic mac-only [:rest forms]
|
||||
(if (= "darwin" (os))
|
||||
forms
|
||||
()))
|
||||
|
@ -1,6 +1,9 @@
|
||||
(project-set! printAST "true")
|
||||
(macro-log "hej")
|
||||
|
||||
(mac-only
|
||||
(macro-log "You're using macOS!"))
|
||||
|
||||
;; (use System)
|
||||
;; (use String)
|
||||
;; (use Char)
|
||||
|
@ -55,6 +55,8 @@ eval env xobj =
|
||||
(XObj (Num IntTy aNum) _ _, XObj (Num IntTy bNum) _ _) ->
|
||||
if (round aNum :: Int) == (round bNum :: Int)
|
||||
then Right trueXObj else Right falseXObj
|
||||
(XObj (Str a) _ _, XObj (Str b) _ _) ->
|
||||
if a == b then Right trueXObj else Right falseXObj
|
||||
_ ->
|
||||
Left (EvalError ("Can't compare " ++ pretty okA ++ " with " ++ pretty okB))
|
||||
[XObj (Sym (SymPath [] "count")) _ _, target] ->
|
||||
|
Loading…
Reference in New Issue
Block a user