aboutsummaryrefslogtreecommitdiff
path: root/test2.lang
diff options
context:
space:
mode:
authorEduardo Julian2014-12-19 23:40:31 -0400
committerEduardo Julian2014-12-19 23:40:31 -0400
commit067a1900e73c40c502f57b6d54a49549c968db83 (patch)
tree06c17dde99b227f2dbedcad75876b68081ac2d37 /test2.lang
parente4bcdcda60fec97622217840d54ae9ee2c121f72 (diff)
Now the language has full closures.
Diffstat (limited to 'test2.lang')
-rw-r--r--test2.lang17
1 files changed, 11 insertions, 6 deletions
diff --git a/test2.lang b/test2.lang
index e300ce256..8f9b7c817 100644
--- a/test2.lang
+++ b/test2.lang
@@ -27,19 +27,24 @@
(def (constant x y)
x)
+(def (constant2 x)
+ (lambda [y] x))
+
(def (main args)
(if true
- (let output "IT WORKS!"
- (_. (_.. System out) (println ((lambda [x y] output) "TRUE" "YOLO"))))
+ (let f (lambda [x] (lambda [y] (x y)))
+ (let g (lambda [x] x)
+ (_. (_.. System out) (println (f g "WE'VE GOT CLOSURES!")))))
(_. (_.. System out) (println "FALSE"))))
-## Doesn't work yet...
-#( (let output "IT WORKS!"
- (_. (_.. System out) (println (((lambda [x] (lambda [y] output)) "TRUE") "YOLO")))) )#
-
## All of these work :D
#( (let output "IT WORKS!"
(_. (_.. System out) (println ((lambda [x y] output) "TRUE" "YOLO")))) )#
+#( (let output "IT WORKS!"
+ (let f (lambda [x] (lambda [y] output))
+ (_. (_.. System out) (println (f "TRUE" "YOLO"))))) )#
+#( (let output "IT WORKS!"
+ (_. (_.. System out) (println ((lambda [x] (lambda [y] output)) "TRUE" "YOLO")))) )#
#( (let output ((lambda [x y] x) "TRUE" "YOLO")
(_. (_.. System out) (println output))) )#
#( (let f (lambda [x y] x)