(import java.lang.System) ## (require "./another" as another) (definterface Function (: apply (-> [java.lang.Object] java.lang.Object))) (defclass Tuple0 []) (defclass Tuple1 [[java.lang.Object _0]]) (defclass Tuple2 [[java.lang.Object _0] [java.lang.Object _1]]) (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 (let variant (#Pair "Pattern" "Matching") (case variant (#Pair first second) (do (:: (:: System out) (println first)) (:: (:: System out) (println second))))) (:: (:: System out) (println "FALSE")))) #( (def (template elems) (case elems #Nil elems (#Cons head tail) (case head (#Cons (#Symbol "~") (#Cons unquoted #Nil)) (#Cons unquoted (template tail)) (#Cons (#Symbol "~@") (#Cons spliced #Nil)) (#Cons (#Symbol "++") (#Cons spliced (template tail))) _ (#Cons head (template tail))) )) (defmacro (' form) (case form (#Cons form* #Nil) (case form* (#Form elems) (#Quote (#Form (template elems))) _ (#Quote form*)) )) (defmacro (::+ pieces) (case pieces (#Cons init #Nil) init (#Cons init (#Cons access others)) (' (::+ (:: (~ init) (~ access)) (~@ others))) )) (def (main args) (if true (let f (lambda [x] (lambda [y] (x y))) (let g (lambda [x] const) (::+ System out (println (f g "WE'VE GOT CLOSURES!"))) ## (:: (:: System out) (println (f g "WE'VE GOT CLOSURES!"))))) (:: (:: System out) (println "FALSE")))) )#