aboutsummaryrefslogtreecommitdiff
path: root/test2.lang
diff options
context:
space:
mode:
authorEduardo Julian2014-12-26 14:20:19 -0400
committerEduardo Julian2014-12-26 14:20:19 -0400
commitdb3fecf46f602320b48e7ce82ee770a46bba7ba6 (patch)
tree8b98d608ef6d467028d0b59542ea9886584bae34 /test2.lang
parent0a0300b129df4499782cbe47aeaee581f57cc3db (diff)
Pattern-matching has been enriched with sub-structural matching.
Diffstat (limited to 'test2.lang')
-rw-r--r--test2.lang16
1 files changed, 12 insertions, 4 deletions
diff --git a/test2.lang b/test2.lang
index cbce36ce8..55d7a14af 100644
--- a/test2.lang
+++ b/test2.lang
@@ -1,5 +1,5 @@
(import java.lang.System)
-## (require "./another" as another)
+(require "./another" as another)
(definterface Function
(: apply (-> [java.lang.Object] java.lang.Object)))
@@ -18,11 +18,19 @@
(#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 (main args)
(if true
- (let variant (#Pair "Pattern" "Matching")
- (case variant
- (#Pair first second)
+ (let xs+ys (#Cons "Pattern" (#Cons "Matching" #Nil))
+ (case xs+ys
+ (#Cons first (#Cons second #Nil))
(do (:: (:: System out) (println first))
(:: (:: System out) (println second)))))
(:: (:: System out) (println "FALSE"))))