diff options
Diffstat (limited to 'test2.lang')
-rw-r--r-- | test2.lang | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/test2.lang b/test2.lang index 73c6d206e..c697ae3c8 100644 --- a/test2.lang +++ b/test2.lang @@ -10,35 +10,13 @@ (defclass Variant [[java.lang.String tag] [java.lang.Object value]]) -#( (def (++ xs ys) - (case xs - #Nil - ys - - (#Cons x xs*) - (#Cons x (++ xs* ys)))) )# - -#( (def (main args) - (if true - (case (#Pair "Pattern" "Matching") - (#Pair first second) - (do (:: (:: System out) (println first)) - (:: (:: System out) (println second)))) - (:: (:: System out) (println "FALSE")))) )# +(def (++ xs ys) + (case xs + #Nil + ys -(def (main args) - (if true - (let xs+ys (#Cons "Pattern" (#Cons "Matching" #Nil)) - (case xs+ys - (#Cons "Pattern" (#Cons second #Nil)) - (do (:: (:: System out) (println "Branch #1")) - (:: (:: System out) (println second))) - - (#Cons first (#Cons second #Nil)) - (do (:: (:: System out) (println "Branch #2")) - (:: (:: System out) (println first)) - (:: (:: System out) (println second))))) - (:: (:: System out) (println "FALSE")))) + (#Cons x xs*) + (#Cons x (++ xs* ys)))) #( (def (template elems) (case elems @@ -55,9 +33,24 @@ _ (#Cons head (template tail))) - )) + )) )# + +#( )# + +(def (main args) + (if true + (case (++ (#Cons "Pattern" #Nil) (#Cons "Matching" #Nil)) + (#Cons "Pattern" (#Cons second #Nil)) + (do (:: (:: System out) (println "Branch #1")) + (:: (:: System out) (println second))) + + (#Cons first (#Cons second #Nil)) + (do (:: (:: System out) (println "Branch #2")) + (:: (:: System out) (println first)) + (:: (:: System out) (println second)))) + (:: (:: System out) (println "FALSE")))) - (defmacro (' form) +#( (defmacro (' form) (case form (#Cons form* #Nil) (case form* |