aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux.lux36
-rw-r--r--stdlib/source/lux/data/coll/dictionary/unordered.lux10
-rw-r--r--stdlib/source/lux/lang/init.lux47
-rw-r--r--stdlib/source/lux/lang/target.lux18
4 files changed, 57 insertions, 54 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index d6a399463..b84b0d096 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -700,8 +700,8 @@
## #expected (Maybe Type)
## #seed Nat
## #scope-type-vars (List Nat)
-## #extensions Nothing
-## #host Nothing})
+## #extensions Any
+## #host Any})
("lux def" Lux
(#Named ["lux" "Lux"]
(#Product ## "lux.info"
@@ -725,9 +725,9 @@
(#Product ## scope-type-vars
(#Apply Nat List)
(#Product ## extensions
- Nothing
+ Any
## "lux.host"
- Nothing))))))))))))
+ Any))))))))))))
(record$ (#Cons [(tag$ ["lux" "tags"])
(tuple$ (#Cons (text$ "info")
(#Cons (text$ "source")
@@ -5723,33 +5723,15 @@
(:: Monad<Meta> return token)
))
-(macro: #export (^~ tokens)
- {#.doc (doc "Use global definitions with simple values, such as text, int, frac and bool in place of literals in patterns."
- "The definitions must be properly-qualified (though you may use one of the short-cuts Lux provides)."
- (def: (empty?' node)
- (All [K V] (-> (Node K V) Bool))
- (case node
- (^~ (#Base ..clean-bitmap _))
- true
-
- _
- false)))}
+(macro: #export (static tokens)
(case tokens
- (^ (list& [_ (#Form (list pattern))] body branches))
+ (^ (list pattern))
(do Monad<Meta>
- [module-name current-module-name
- pattern+ (macro-expand-all pattern)]
- (case pattern+
- (^ (list pattern'))
- (do Monad<Meta>
- [pattern'' (anti-quote pattern')]
- (wrap (list& pattern'' body branches)))
-
- _
- (fail "^~ can only expand to 1 pattern.")))
+ [pattern' (anti-quote pattern)]
+ (wrap (list pattern')))
_
- (fail "Wrong syntax for ^~")))
+ (fail "Wrong syntax for \"static\".")))
(type: Multi-Level-Case
[Code (List [Code Code])])
diff --git a/stdlib/source/lux/data/coll/dictionary/unordered.lux b/stdlib/source/lux/data/coll/dictionary/unordered.lux
index 053d53d48..12c58a2fd 100644
--- a/stdlib/source/lux/data/coll/dictionary/unordered.lux
+++ b/stdlib/source/lux/data/coll/dictionary/unordered.lux
@@ -270,12 +270,12 @@
## So, this test is introduced to detect them.
(def: (empty?' node)
(All [k v] (-> (Node k v) Bool))
- (case node
- (^~ (#Base ..clean-bitmap _))
- true
+ (`` (case node
+ (#Base (~~ (static ..clean-bitmap)) _)
+ true
- _
- false))
+ _
+ false)))
(def: (put' level hash key val Hash<k> node)
(All [k v] (-> Level Hash-Code k v (Hash k) (Node k v) (Node k v)))
diff --git a/stdlib/source/lux/lang/init.lux b/stdlib/source/lux/lang/init.lux
index 8d4fdf981..9c909942e 100644
--- a/stdlib/source/lux/lang/init.lux
+++ b/stdlib/source/lux/lang/init.lux
@@ -1,6 +1,7 @@
(.module:
lux
- (// [".L" extension]
+ (// ["//." target]
+ [".L" extension]
(extension [".E" analysis]
## [".E" synthesis]
## [".E" translation]
@@ -25,20 +26,23 @@
#.var-counter +0
#.var-bindings (list)})
-(def: #export version Text "0.6.0")
-
-(def: #export info
- Info
- {#.target (for {"JVM" "JVM"
- "JS" "JS"
- "Lua" "Lua"
- "Python" "Python"
- "Ruby" "Ruby"
- "PHP" "PHP"
- "Scheme" "Scheme"
- "Common Lisp" "Common Lisp"})
- #.version ..version
- #.mode #.Build})
+(type: #export Version Text)
+
+(def: #export version Version "0.6.0")
+
+(`` (def: #export info
+ Info
+ {#.target (for {(~~ (static //target.common-lisp)) //target.common-lisp
+ (~~ (static //target.js)) //target.js
+ (~~ (static //target.jvm)) //target.jvm
+ (~~ (static //target.lua)) //target.lua
+ (~~ (static //target.php)) //target.php
+ (~~ (static //target.python)) //target.python
+ (~~ (static //target.r)) //target.r
+ (~~ (static //target.ruby)) //target.ruby
+ (~~ (static //target.scheme)) //target.scheme})
+ #.version ..version
+ #.mode #.Build}))
(def: #export (compiler host)
(-> Any Lux)
@@ -52,10 +56,9 @@
#.expected #.None
#.seed +0
#.scope-type-vars (list)
- #.extensions (:! Nothing
- {#extensionL.analysis analysisE.defaults
- #extensionL.synthesis (:!! []) ## synthesisE.defaults
- #extensionL.translation (:!! []) ## translationE.defaults
- #extensionL.statement (:!! []) ## statementE.defaults
- })
- #.host (:! Nothing host)})
+ #.extensions {#extensionL.analysis analysisE.defaults
+ #extensionL.synthesis (:!! []) ## synthesisE.defaults
+ #extensionL.translation (:!! []) ## translationE.defaults
+ #extensionL.statement (:!! []) ## statementE.defaults
+ }
+ #.host host})
diff --git a/stdlib/source/lux/lang/target.lux b/stdlib/source/lux/lang/target.lux
new file mode 100644
index 000000000..ee0eee74d
--- /dev/null
+++ b/stdlib/source/lux/lang/target.lux
@@ -0,0 +1,18 @@
+(.module:
+ lux)
+
+(type: #export Target Text)
+
+(do-template [<name> <value>]
+ [(def: #export <name> Target <value>)]
+
+ [common-lisp "Common Lisp"]
+ [js "JavaScript"]
+ [jvm "JVM"]
+ [lua "Lua"]
+ [php "PHP"]
+ [python "Python"]
+ [r "R"]
+ [ruby "Ruby"]
+ [scheme "Scheme"]
+ )