From 4965597043aca57a05760113f1851e96dad1eaf8 Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Mon, 14 Mar 2022 06:14:57 -0400
Subject: Leaner syntax for the "for" macro.
---
stdlib/source/test/lux.lux | 76 +++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 38 deletions(-)
(limited to 'stdlib/source/test/lux.lux')
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index 743c108f7..bd30cf30e 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -62,12 +62,12 @@
["[1][0]" ffi]
["[1][0]" extension]
["[1][0]" target "_"
- (~~ (.for ["{old}" (~~ (.as_is ["[1]/[0]" jvm]))
- "JVM" (~~ (.as_is ["[1]/[0]" jvm]))
- "JavaScript" (~~ (.as_is ["[1]/[0]" js]))
- "Lua" (~~ (.as_is ["[1]/[0]" lua]))
- "Python" (~~ (.as_is ["[1]/[0]" python]))
- "Ruby" (~~ (.as_is ["[1]/[0]" ruby]))]
+ (~~ (.for "{old}" (~~ (.as_is ["[1]/[0]" jvm]))
+ "JVM" (~~ (.as_is ["[1]/[0]" jvm]))
+ "JavaScript" (~~ (.as_is ["[1]/[0]" js]))
+ "Lua" (~~ (.as_is ["[1]/[0]" lua]))
+ "Python" (~~ (.as_is ["[1]/[0]" python]))
+ "Ruby" (~~ (.as_is ["[1]/[0]" ruby]))
(~~ (.as_is))))]])))
(def: for_bit
@@ -421,7 +421,7 @@
(same? (: Any macro))))
(_.cover [/.macro:]
(same? expected (..identity_macro expected)))
- (~~ (for [@.old (~~ (as_is))]
+ (~~ (for @.old (~~ (as_is))
(_.cover [/.Source]
(..found_crosshair?))))
(_.cover [/.macro]
@@ -454,14 +454,14 @@
(let [scenario (: (-> Any Bit)
(function (_ _)
... TODO: Remove this hack once Jython is no longer being used as the Python interpreter.
- (`` (for [@.python (case (' ['])
- (^code [
- ("lux def" (~ [_ {.#Symbol ["" _]}]) [] #0)
- (~~ (template.spliced ))])
- true
-
- _
- false)]
+ (`` (for @.python (case (' ['])
+ (^code [
+ ("lux def" (~ [_ {.#Symbol ["" _]}]) [] #0)
+ (~~ (template.spliced ))])
+ true
+
+ _
+ false)
(case (' ['])
(^code [ (~~ (template.spliced ))])
true
@@ -880,16 +880,16 @@
(~~ (/.comment dummy))))))
(_.cover [/.for]
(and (n.= expected
- (/.for ["fake host" dummy]
+ (/.for "fake host" dummy
expected))
(n.= expected
- (/.for [@.old expected
- @.jvm expected
- @.js expected
- @.python expected
- @.lua expected
- @.ruby expected
- @.php expected]
+ (/.for @.old expected
+ @.jvm expected
+ @.js expected
+ @.python expected
+ @.lua expected
+ @.ruby expected
+ @.php expected
dummy))))
)))
@@ -1178,7 +1178,7 @@
(bit#= /.private /.local)))
))
-(for [@.old (as_is)]
+(for @.old (as_is)
(as_is (syntax: (for_bindings|test [fn/0 .local_symbol
var/0 .local_symbol
let/0 .local_symbol
@@ -1283,7 +1283,7 @@
..for_def:
..for_meta
..for_export
- (~~ (for [@.old (~~ (as_is))]
+ (~~ (for @.old (~~ (as_is))
(~~ (as_is ..for_bindings))))
))))
@@ -1316,23 +1316,23 @@
/world.test
/ffi.test
- (~~ (for [@.old (~~ (as_is))]
+ (~~ (for @.old (~~ (as_is))
(~~ (as_is /extension.test))))
- (~~ (for [@.jvm (~~ (as_is /target/jvm.test))
- @.old (~~ (as_is /target/jvm.test))
- @.js (~~ (as_is /target/js.test))
- @.lua (~~ (as_is /target/lua.test))
- @.python (~~ (as_is /target/python.test))
- @.ruby (~~ (as_is /target/ruby.test))]))
+ (~~ (for @.jvm (~~ (as_is /target/jvm.test))
+ @.old (~~ (as_is /target/jvm.test))
+ @.js (~~ (as_is /target/js.test))
+ @.lua (~~ (as_is /target/lua.test))
+ @.python (~~ (as_is /target/python.test))
+ @.ruby (~~ (as_is /target/ruby.test))))
))))))
(program: args
- (let [times (for [@.old 100
- @.jvm 100
- @.js 10
- @.python 1
- @.lua 1
- @.ruby 1]
+ (let [times (for @.old 100
+ @.jvm 100
+ @.js 10
+ @.python 1
+ @.lua 1
+ @.ruby 1
100)]
(<| io.io
_.run!
--
cgit v1.2.3