Tried out writing a conditional compilation function.

This commit is contained in:
Erik Svedäng 2017-11-30 13:43:58 +01:00
parent 1cbf55beb5
commit 699e64d9ed
3 changed files with 10 additions and 0 deletions

View File

@ -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
()))

View File

@ -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)

View File

@ -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] ->