aboutsummaryrefslogtreecommitdiff
path: root/lux-bootstrapper
diff options
context:
space:
mode:
authorEduardo Julian2021-08-19 04:59:06 -0400
committerEduardo Julian2021-08-19 04:59:06 -0400
commitd772fe99d5d4990c6774481fb64d12280cdb6aae (patch)
tree209a2ce3b8e896be15db40bc58db830a5304b4f9 /lux-bootstrapper
parente00ba096c8837abe85d366e0c1293c09dbe84d81 (diff)
Enabled compile-time code evaluation (i.e. "eval" function).
Diffstat (limited to 'lux-bootstrapper')
-rw-r--r--lux-bootstrapper/src/lux.clj7
-rw-r--r--lux-bootstrapper/src/lux/analyser.clj62
-rw-r--r--lux-bootstrapper/src/lux/analyser/base.clj2
-rw-r--r--lux-bootstrapper/src/lux/analyser/case.clj50
-rw-r--r--lux-bootstrapper/src/lux/analyser/env.clj12
-rw-r--r--lux-bootstrapper/src/lux/analyser/lux.clj50
-rw-r--r--lux-bootstrapper/src/lux/analyser/module.clj16
-rw-r--r--lux-bootstrapper/src/lux/analyser/parser.clj22
-rw-r--r--lux-bootstrapper/src/lux/analyser/proc/common.clj36
-rw-r--r--lux-bootstrapper/src/lux/analyser/proc/jvm.clj150
-rw-r--r--lux-bootstrapper/src/lux/analyser/record.clj9
-rw-r--r--lux-bootstrapper/src/lux/base.clj277
-rw-r--r--lux-bootstrapper/src/lux/compiler/cache.clj6
-rw-r--r--lux-bootstrapper/src/lux/compiler/cache/ann.clj4
-rw-r--r--lux-bootstrapper/src/lux/compiler/cache/type.clj4
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm.clj3
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/lux.clj8
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj42
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj134
-rw-r--r--lux-bootstrapper/src/lux/host.clj40
-rw-r--r--lux-bootstrapper/src/lux/host/generics.clj2
-rw-r--r--lux-bootstrapper/src/lux/optimizer.clj66
-rw-r--r--lux-bootstrapper/src/lux/parser.clj12
-rw-r--r--lux-bootstrapper/src/lux/reader.clj16
-rw-r--r--lux-bootstrapper/src/lux/type.clj70
-rw-r--r--lux-bootstrapper/src/lux/type/host.clj20
26 files changed, 563 insertions, 557 deletions
diff --git a/lux-bootstrapper/src/lux.clj b/lux-bootstrapper/src/lux.clj
index dc6066669..783a25a64 100644
--- a/lux-bootstrapper/src/lux.clj
+++ b/lux-bootstrapper/src/lux.clj
@@ -7,7 +7,8 @@
:reload-all)
(:import (java.io File)))
-(def unit-separator (str (char 31)))
+(def unit-separator
+ (str (char 31)))
(defn- separate-paths
"(-> Text (List Text))"
@@ -20,13 +21,13 @@
(defn -main [& args]
(|case (&/->list args)
- (&/$Cons "release" (&/$Cons program-module (&/$Cons dependencies (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil))))))
+ (&/$Item "release" (&/$Item program-module (&/$Item dependencies (&/$Item source-dirs (&/$Item target-dir (&/$End))))))
(&compiler/compile-program &/$Build program-module
(separate-paths dependencies)
(separate-paths source-dirs)
target-dir)
- (&/$Cons "repl" (&/$Cons dependencies (&/$Cons source-dirs (&/$Cons target-dir (&/$Nil)))))
+ (&/$Item "repl" (&/$Item dependencies (&/$Item source-dirs (&/$Item target-dir (&/$End)))))
(&repl/repl (separate-paths dependencies)
(separate-paths source-dirs)
target-dir)
diff --git a/lux-bootstrapper/src/lux/analyser.clj b/lux-bootstrapper/src/lux/analyser.clj
index 4368e1305..ae16eb42c 100644
--- a/lux-bootstrapper/src/lux/analyser.clj
+++ b/lux-bootstrapper/src/lux/analyser.clj
@@ -99,75 +99,75 @@
(&/$Tag ?ident)
(&/with-analysis-meta location exo-type
- (analyse-variant+ analyse exo-type ?ident &/$Nil))
+ (analyse-variant+ analyse exo-type ?ident &/$End))
(&/$Identifier ?ident)
(&/with-analysis-meta location exo-type
(&&lux/analyse-identifier analyse exo-type ?ident))
- (&/$Form (&/$Cons [command-meta command] parameters))
+ (&/$Form (&/$Item [command-meta command] parameters))
(|case command
(&/$Text ?procedure)
(case ?procedure
"lux type check"
- (|let [(&/$Cons ?type
- (&/$Cons ?value
- (&/$Nil))) parameters]
+ (|let [(&/$Item ?type
+ (&/$Item ?value
+ (&/$End))) parameters]
(&/with-analysis-meta location exo-type
(&&lux/analyse-type-check analyse eval! exo-type ?type ?value)))
"lux type check type"
- (|let [(&/$Cons ?value (&/$Nil)) parameters]
+ (|let [(&/$Item ?value (&/$End)) parameters]
(analyse-ast optimize eval! compile-module compilers &type/Type ?value))
"lux type as"
- (|let [(&/$Cons ?type
- (&/$Cons ?value
- (&/$Nil))) parameters]
+ (|let [(&/$Item ?type
+ (&/$Item ?value
+ (&/$End))) parameters]
(&/with-analysis-meta location exo-type
(&&lux/analyse-type-as analyse eval! exo-type ?type ?value)))
"lux def"
- (|let [(&/$Cons [_ (&/$Identifier "" ?name)]
- (&/$Cons ?value
- (&/$Cons ?meta
- (&/$Cons exported?
- (&/$Nil)))
+ (|let [(&/$Item [_ (&/$Identifier "" ?name)]
+ (&/$Item ?value
+ (&/$Item ?meta
+ (&/$Item exported?
+ (&/$End)))
)) parameters]
(&/with-location location
(&&lux/analyse-def analyse optimize eval! compile-def ?name ?value ?meta exported?)))
"lux def alias"
- (|let [(&/$Cons [_ (&/$Identifier "" ?alias)]
- (&/$Cons [_ (&/$Identifier ?original)]
- (&/$Nil)
+ (|let [(&/$Item [_ (&/$Identifier "" ?alias)]
+ (&/$Item [_ (&/$Identifier ?original)]
+ (&/$End)
)) parameters]
(&/with-location location
(&&lux/analyse-def-alias ?alias ?original)))
"lux def type tagged"
- (|let [(&/$Cons [_ (&/$Identifier "" ?name)]
- (&/$Cons ?value
- (&/$Cons ?meta
- (&/$Cons [_ (&/$Tuple ?tags)]
- (&/$Cons exported?
- (&/$Nil))))
+ (|let [(&/$Item [_ (&/$Identifier "" ?name)]
+ (&/$Item ?value
+ (&/$Item ?meta
+ (&/$Item [_ (&/$Tuple ?tags)]
+ (&/$Item exported?
+ (&/$End))))
)) parameters]
(&/with-location location
(&&lux/analyse-def-type-tagged analyse optimize eval! compile-def ?name ?value ?meta ?tags exported?)))
"lux def program"
- (|let [(&/$Cons ?program (&/$Nil)) parameters]
+ (|let [(&/$Item ?program (&/$End)) parameters]
(&/with-location location
(&&lux/analyse-program analyse optimize compile-program ?program)))
"lux def module"
- (|let [(&/$Cons ?meta (&/$Cons ?imports (&/$Nil))) parameters]
+ (|let [(&/$Item ?meta (&/$Item ?imports (&/$End))) parameters]
(&/with-location location
(&&lux/analyse-module analyse optimize eval! compile-module ?meta ?imports)))
"lux in-module"
- (|let [(&/$Cons [_ (&/$Text ?module)] (&/$Cons ?expr (&/$Nil))) parameters]
+ (|let [(&/$Item [_ (&/$Text ?module)] (&/$Item ?expr (&/$End))) parameters]
(&/with-location location
(&/with-module ?module
(analyse exo-type ?expr))))
@@ -182,7 +182,7 @@
(&&common/analyse-proc analyse exo-type ?procedure parameters))))
(&/$Nat idx)
- (|let [(&/$Cons [_ (&/$Bit ?right)] parameters*) parameters]
+ (|let [(&/$Item [_ (&/$Bit ?right)] parameters*) parameters]
(&/with-analysis-meta location exo-type
(&&lux/analyse-variant analyse (&/$Right exo-type) (if ?right (inc idx) idx) ?right parameters*)))
@@ -192,14 +192,14 @@
;; Pattern-matching syntax.
(&/$Record ?pattern-matching)
- (|let [(&/$Cons ?input (&/$Nil)) parameters]
+ (|let [(&/$Item ?input (&/$End)) parameters]
(&/with-analysis-meta location exo-type
(&&lux/analyse-case analyse exo-type ?input ?pattern-matching)))
;; Function syntax.
- (&/$Tuple (&/$Cons [_ (&/$Identifier "" ?self)]
- (&/$Cons [_ (&/$Identifier "" ?arg)] (&/$Nil))))
- (|let [(&/$Cons ?body (&/$Nil)) parameters]
+ (&/$Tuple (&/$Item [_ (&/$Identifier "" ?self)]
+ (&/$Item [_ (&/$Identifier "" ?arg)] (&/$End))))
+ (|let [(&/$Item ?body (&/$End)) parameters]
(&/with-analysis-meta location exo-type
(&&lux/analyse-function analyse exo-type ?self ?arg ?body)))
diff --git a/lux-bootstrapper/src/lux/analyser/base.clj b/lux-bootstrapper/src/lux/analyser/base.clj
index e5f47f977..1a61bcfa5 100644
--- a/lux-bootstrapper/src/lux/analyser/base.clj
+++ b/lux-bootstrapper/src/lux/analyser/base.clj
@@ -52,7 +52,7 @@
(defn cap-1 [action]
(|do [result action]
(|case result
- (&/$Cons x (&/$Nil))
+ (&/$Item x (&/$End))
(return x)
_
diff --git a/lux-bootstrapper/src/lux/analyser/case.clj b/lux-bootstrapper/src/lux/analyser/case.clj
index d059ce189..ba8afd4e8 100644
--- a/lux-bootstrapper/src/lux/analyser/case.clj
+++ b/lux-bootstrapper/src/lux/analyser/case.clj
@@ -35,7 +35,7 @@
;; [Utils]
(def ^:private unit-tuple
- (&/T [(&/T ["" -1 -1]) (&/$Tuple &/$Nil)]))
+ (&/T [(&/T ["" -1 -1]) (&/$Tuple &/$End)]))
(defn ^:private resolve-type [type]
(if (&type/type= &type/Any type)
@@ -121,7 +121,7 @@
(&/$UnivQ ?local-env ?local-def)
(|case ?local-env
- (&/$Nil)
+ (&/$End)
(&/$UnivQ ?local-env (beta-reduce! (inc level) env ?local-def))
_
@@ -129,7 +129,7 @@
(&/$ExQ ?local-env ?local-def)
(|case ?local-env
- (&/$Nil)
+ (&/$End)
(&/$ExQ ?local-env (beta-reduce! (inc level) env ?local-def))
_
@@ -155,14 +155,14 @@
(|case type-fn
(&/$UnivQ local-env local-def)
(return (beta-reduce! 0 (->> local-env
- (&/$Cons param)
- (&/$Cons type-fn))
+ (&/$Item param)
+ (&/$Item type-fn))
local-def))
(&/$ExQ local-env local-def)
(return (beta-reduce! 0 (->> local-env
- (&/$Cons param)
- (&/$Cons type-fn))
+ (&/$Item param)
+ (&/$Item type-fn))
local-def))
(&/$Apply A F)
@@ -189,7 +189,7 @@
(&type/with-var
(fn [$var]
(|do [=type (apply-type! type $var)
- ==type (adjust-type* (&/$Cons (&/T [_aenv 1 $var])
+ ==type (adjust-type* (&/$Item (&/T [_aenv 1 $var])
(&/|map update-up-frame up))
=type)]
(&type/clean $var ==type))))
@@ -247,7 +247,7 @@
(defn adjust-type [type]
"(-> Type (Lux Type))"
- (adjust-type* &/$Nil type))
+ (adjust-type* &/$End type))
(defn ^:private analyse-pattern [var?? value-type pattern kont]
(|let [[meta pattern*] pattern]
@@ -300,12 +300,12 @@
(&/$Tuple ?members)
(|case ?members
- (&/$Nil)
+ (&/$End)
(|do [_ (&type/check value-type &type/Any)
=kont kont]
(return (&/T [($TupleTestAC (&/|list)) =kont])))
- (&/$Cons ?member (&/$Nil))
+ (&/$Item ?member (&/$End))
(analyse-pattern var?? value-type ?member kont)
_
@@ -322,9 +322,9 @@
(|do [[=tests =kont] (&/fold (fn [kont* vm]
(|let [[v m] vm]
(|do [[=test [=tests =kont]] (analyse-pattern &/$None v m kont*)]
- (return (&/T [(&/$Cons =test =tests) =kont])))))
+ (return (&/T [(&/$Item =test =tests) =kont])))))
(|do [=kont kont]
- (return (&/T [&/$Nil =kont])))
+ (return (&/T [&/$End =kont])))
(&/|reverse (&/zip2 _tuple-types ?members)))]
(return (&/T [($TupleTestAC =tests) =kont])))
(&/fail-with-loc (str "[Pattern-matching Error] Pattern-matching mismatch. Requires tuple[" (&/|length (&type/flatten-prod value-type*)) "]. Given tuple [" (&/|length ?members) "].\n"
@@ -360,7 +360,7 @@
[=test =kont] (analyse-pattern &/$None case-type unit-tuple kont)]
(return (&/T [($VariantTestAC (&/T [idx (&/|length group) =test])) =kont])))
- (&/$Form (&/$Cons [_ (&/$Nat idx)] (&/$Cons [_ (&/$Bit right?)] ?values)))
+ (&/$Form (&/$Item [_ (&/$Nat idx)] (&/$Item [_ (&/$Bit right?)] ?values)))
(let [idx (if right? (inc idx) idx)]
(|do [value-type* (adjust-type value-type)
case-type (&type/sum-at idx value-type*)
@@ -371,7 +371,7 @@
(analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$Tuple ?values)]) kont))]
(return (&/T [($VariantTestAC (&/T [idx (&/|length (&type/flatten-sum value-type*)) =test])) =kont]))))
- (&/$Form (&/$Cons [_ (&/$Tag ?ident)] ?values))
+ (&/$Form (&/$Item [_ (&/$Tag ?ident)] ?values))
(|do [[=module =name] (&&/resolved-ident ?ident)
must-infer? (&type/unknown? value-type)
variant-type (if must-infer?
@@ -398,7 +398,7 @@
(defn ^:private analyse-branch [analyse exo-type var?? value-type pattern body patterns]
(|do [pattern+body (analyse-pattern var?? value-type pattern
(&&/analyse-1 analyse exo-type body))]
- (return (&/$Cons pattern+body patterns))))
+ (return (&/$Item pattern+body patterns))))
(defn ^:private merge-total [struct test+body]
(|let [[test ?body] test+body]
@@ -461,37 +461,37 @@
(return ($BitTotal total? (&/|list ?value)))
[($BitTotal total? ?values) ($BitTestAC ?value)]
- (return ($BitTotal total? (&/$Cons ?value ?values)))
+ (return ($BitTotal total? (&/$Item ?value ?values)))
[($DefaultTotal total?) ($NatTestAC ?value)]
(return ($NatTotal total? (&/|list ?value)))
[($NatTotal total? ?values) ($NatTestAC ?value)]
- (return ($NatTotal total? (&/$Cons ?value ?values)))
+ (return ($NatTotal total? (&/$Item ?value ?values)))
[($DefaultTotal total?) ($IntTestAC ?value)]
(return ($IntTotal total? (&/|list ?value)))
[($IntTotal total? ?values) ($IntTestAC ?value)]
- (return ($IntTotal total? (&/$Cons ?value ?values)))
+ (return ($IntTotal total? (&/$Item ?value ?values)))
[($DefaultTotal total?) ($RevTestAC ?value)]
(return ($RevTotal total? (&/|list ?value)))
[($RevTotal total? ?values) ($RevTestAC ?value)]
- (return ($RevTotal total? (&/$Cons ?value ?values)))
+ (return ($RevTotal total? (&/$Item ?value ?values)))
[($DefaultTotal total?) ($FracTestAC ?value)]
(return ($FracTotal total? (&/|list ?value)))
[($FracTotal total? ?values) ($FracTestAC ?value)]
- (return ($FracTotal total? (&/$Cons ?value ?values)))
+ (return ($FracTotal total? (&/$Item ?value ?values)))
[($DefaultTotal total?) ($TextTestAC ?value)]
(return ($TextTotal total? (&/|list ?value)))
[($TextTotal total? ?values) ($TextTestAC ?value)]
- (return ($TextTotal total? (&/$Cons ?value ?values)))
+ (return ($TextTotal total? (&/$Item ?value ?values)))
[($DefaultTotal total?) ($TupleTestAC ?tests)]
(|do [structs (&/map% (fn [t]
@@ -578,7 +578,7 @@
($TupleTotal ?total ?structs)
(|case ?structs
- (&/$Nil)
+ (&/$End)
(|do [value-type* (resolve-type value-type)]
(if (&type/type= &type/Any value-type*)
(return true)
@@ -589,7 +589,7 @@
(if unknown?
(|do [=structs (&/map% (check-totality+ check-totality) ?structs)
_ (&type/check value-type (|case (->> (&/|map &/|second =structs) (&/|reverse))
- (&/$Cons last prevs)
+ (&/$Item last prevs)
(&/fold (fn [right left] (&/$Product left right))
last prevs)))]
(return (or ?total
@@ -629,7 +629,7 @@
(|do [patterns (&/fold% (fn [patterns branch]
(|let [[pattern body] branch]
(analyse-branch analyse exo-type var?? value-type pattern body patterns)))
- &/$Nil
+ &/$End
branches)
struct (&/fold% merge-total ($DefaultTotal false) patterns)
? (check-totality value-type struct)
diff --git a/lux-bootstrapper/src/lux/analyser/env.clj b/lux-bootstrapper/src/lux/analyser/env.clj
index a2b6e5ad3..c170771ea 100644
--- a/lux-bootstrapper/src/lux/analyser/env.clj
+++ b/lux-bootstrapper/src/lux/analyser/env.clj
@@ -15,7 +15,7 @@
=return (body (&/update$ &/$scopes
(fn [stack]
(let [var-analysis (&&/|meta type &/empty-location (&&/$var (&/$Local (->> (&/|head stack) (&/get$ &/$locals) (&/get$ &/$counter)))))]
- (&/$Cons (&/update$ &/$locals #(->> %
+ (&/$Item (&/update$ &/$locals #(->> %
(&/update$ &/$counter inc)
(&/update$ &/$mappings (fn [m] (&/|put name (&/T [type var-analysis]) m))))
(&/|head stack))
@@ -24,7 +24,7 @@
(|case =return
(&/$Right ?state ?value)
(return* (&/update$ &/$scopes (fn [stack*]
- (&/$Cons (&/update$ &/$locals #(->> %
+ (&/$Item (&/update$ &/$locals #(->> %
(&/update$ &/$counter dec)
(&/set$ &/$mappings old-mappings))
(&/|head stack*))
@@ -40,7 +40,7 @@
(let [old-mappings (->> state (&/get$ &/$scopes) &/|head (&/get$ &/$locals) (&/get$ &/$mappings))
=return (body (&/update$ &/$scopes
(fn [stack]
- (&/$Cons (&/update$ &/$locals #(->> %
+ (&/$Item (&/update$ &/$locals #(->> %
(&/update$ &/$mappings (fn [m] (&/|put name
(&/T [(&&/expr-type* var-analysis)
var-analysis])
@@ -51,7 +51,7 @@
(|case =return
(&/$Right ?state ?value)
(return* (&/update$ &/$scopes (fn [stack*]
- (&/$Cons (&/update$ &/$locals #(->> %
+ (&/$Item (&/update$ &/$locals #(->> %
(&/set$ &/$mappings old-mappings))
(&/|head stack*))
(&/|tail stack*)))
@@ -64,11 +64,11 @@
(def captured-vars
(fn [state]
(|case (&/get$ &/$scopes state)
- (&/$Nil)
+ (&/$End)
((&/fail-with-loc "[Analyser Error] Cannot obtain captured vars without environments.")
state)
- (&/$Cons env _)
+ (&/$Item env _)
(return* state (->> env
(&/get$ &/$captured)
(&/get$ &/$mappings)
diff --git a/lux-bootstrapper/src/lux/analyser/lux.clj b/lux-bootstrapper/src/lux/analyser/lux.clj
index e71e54f4f..857f65e00 100644
--- a/lux-bootstrapper/src/lux/analyser/lux.clj
+++ b/lux-bootstrapper/src/lux/analyser/lux.clj
@@ -53,12 +53,12 @@
(defn analyse-tuple [analyse ?exo-type ?elems]
(|case ?elems
- (&/$Nil)
+ (&/$End)
(analyse-unit analyse (|case ?exo-type
(&/$Left exo-type) exo-type
(&/$Right exo-type) exo-type))
- (&/$Cons ?elem (&/$Nil))
+ (&/$Item ?elem (&/$End))
(analyse (|case ?exo-type
(&/$Left exo-type) exo-type
(&/$Right exo-type) exo-type)
@@ -80,7 +80,7 @@
(|do [:let [=var* (next-parameter-type tuple-type)]
_ (&type/set-var iid =var*)
tuple-type* (&type/clean $var tuple-type)]
- (return (&/$UnivQ &/$Nil tuple-type*)))
+ (return (&/$UnivQ &/$End tuple-type*)))
_
(&type/clean $var tuple-type))]
@@ -97,7 +97,7 @@
(return =analysis))
?elems)
_ (&type/check exo-type (|case (->> (&/|map &&/expr-type* =elems) (&/|reverse))
- (&/$Cons last prevs)
+ (&/$Item last prevs)
(&/fold (fn [right left] (&/$Product left right))
last prevs)))
_location &/location]
@@ -158,16 +158,16 @@
(defn ^:private analyse-variant-body [analyse exo-type ?values]
(|do [_location &/location
output (|case ?values
- (&/$Nil)
+ (&/$End)
(analyse-unit analyse exo-type)
- (&/$Cons ?value (&/$Nil))
+ (&/$Item ?value (&/$End))
(analyse exo-type ?value)
_
(analyse-tuple analyse (&/$Right exo-type) ?values))]
(|case output
- (&/$Cons x (&/$Nil))
+ (&/$Item x (&/$End))
(return x)
_
@@ -189,7 +189,7 @@
(|do [:let [=var* (next-parameter-type variant-type)]
_ (&type/set-var iid =var*)
variant-type* (&type/clean $var variant-type)]
- (return (&/$UnivQ &/$Nil variant-type*)))
+ (return (&/$UnivQ &/$End variant-type*)))
_
(&type/clean $var variant-type))]
@@ -278,20 +278,20 @@
(->> % (&/get$ &/$captured) (&/get$ &/$mappings) (&/|contains? name) not))
[inner outer] (&/|split-with no-binding? stack)]
(|case outer
- (&/$Nil)
+ (&/$End)
(&/run-state (|do [module-name &/get-module-name]
(analyse-global analyse exo-type module-name name))
state)
- (&/$Cons bottom-outer _)
+ (&/$Item bottom-outer _)
(|let [scopes (&/|map #(&/get$ &/$name %) (&/|reverse inner))
[=local inner*] (&/fold2 (fn [register+new-inner frame in-scope]
(|let [[register new-inner] register+new-inner
[register* frame*] (&&function/close-over in-scope name register frame)]
- (&/T [register* (&/$Cons frame* new-inner)])))
+ (&/T [register* (&/$Item frame* new-inner)])))
(&/T [(&/|second (or (->> bottom-outer (&/get$ &/$locals) (&/get$ &/$mappings) (&/|get name))
(->> bottom-outer (&/get$ &/$captured) (&/get$ &/$mappings) (&/|get name))))
- &/$Nil])
+ &/$End])
(&/|reverse inner) scopes)]
((|do [_ (&type/check exo-type (&&/expr-type* =local))]
(return (&/|list =local)))
@@ -307,11 +307,11 @@
(defn ^:private analyse-apply* [analyse exo-type fun-type ?args]
(|case ?args
- (&/$Nil)
+ (&/$End)
(|do [_ (&type/check exo-type fun-type)]
- (return (&/T [fun-type &/$Nil])))
+ (return (&/T [fun-type &/$End])))
- (&/$Cons ?arg ?args*)
+ (&/$Item ?arg ?args*)
(|do [?fun-type* (&type/actual-type fun-type)]
(&/with-attempt
(|case ?fun-type*
@@ -328,7 +328,7 @@
(&type/clean $var =output-t)
(|do [_ (&type/set-var ?id (next-parameter-type =output-t))
cleaned-output* (&type/clean $var =output-t)
- :let [cleaned-output (&/$UnivQ &/$Nil cleaned-output*)]]
+ :let [cleaned-output (&/$UnivQ &/$End cleaned-output*)]]
(return cleaned-output)))
_ (&type/clean $var exo-type)]
(return (&/T [type** ==args])))
@@ -358,7 +358,7 @@
(&&/analyse-1 analyse ?input-t ?arg)
(fn [err]
(&/fail-with-loc (str err "\n" "[Analyser Error] Argument expected: " (&type/show-type ?input-t)))))]
- (return (&/T [=output-t (&/$Cons =arg =args)])))
+ (return (&/T [=output-t (&/$Item =arg =args)])))
_
(&/fail-with-loc (str "[Analyser Error] Cannot apply a non-function: " (&type/show-type ?fun-type*))))
@@ -418,7 +418,7 @@
(defn ^:private unravel-inf-appt [type]
(|case type
(&/$Apply (&/$Var _inf-var) =input+)
- (&/$Cons _inf-var (unravel-inf-appt =input+))
+ (&/$Item _inf-var (unravel-inf-appt =input+))
_
(&/|list)))
@@ -430,7 +430,7 @@
_ (&type/set-var iid =input*)
=func* (&type/clean $input =func)
=func** (&type/clean $output =func*)]
- (return (&/$UnivQ &/$Nil =func**)))
+ (return (&/$UnivQ &/$End =func**)))
(&/$Apply (&/$Var _inf-var) =input+)
(&/fold% (fn [_func _inf-var]
@@ -547,7 +547,7 @@
(if (= wanted-name source-name)
""
(str "\nThis is an alias for " source-name)))))
- (return &/$Nil))))
+ (return &/$End))))
(defn analyse-def* [analyse optimize eval! compile-def ?name ?value ?meta exported? & [?expected-type]]
(|do [_ &/ensure-directive
@@ -572,7 +572,7 @@
(defn analyse-def [analyse optimize eval! compile-def ?name ?value ?meta exported?]
(|do [_ (analyse-def* analyse optimize eval! compile-def ?name ?value ?meta exported?)]
- (return &/$Nil)))
+ (return &/$End)))
(defn analyse-def-type-tagged [analyse optimize eval! compile-def ?name ?value ?meta tags* exported?]
(|do [[module-name def-type def-value =exported?] (analyse-def* analyse optimize eval! compile-def ?name ?value ?meta exported? &type/Type)
@@ -587,7 +587,7 @@
(&/fail-with-loc "[Analyser Error] Incorrect format for tags.")))
tags*)
_ (&&module/declare-tags module-name tags =exported? def-value)]
- (return &/$Nil)))
+ (return &/$End)))
(defn analyse-def-alias [?alias ?original]
(|let [[r-module r-name] ?original]
@@ -596,7 +596,7 @@
_ (&&module/find-def r-module r-name)
_ (&/without-repl-closure
(&&module/define-alias module-name ?alias ?original))]
- (return &/$Nil))))
+ (return &/$End))))
(defn ^:private merge-module-states
"(-> Host Host Host)"
@@ -696,7 +696,7 @@
(&/fail ?error)))
_compiler
=asyncs)]
- (return &/$Nil)))
+ (return &/$End)))
(defn ^:private coerce
"(-> Type Analysis Analysis)"
@@ -728,4 +728,4 @@
(|do [_ &/ensure-directive
=program (&&/analyse-1 analyse program-type ?program)
_ (compile-program (optimize =program))]
- (return &/$Nil))))
+ (return &/$End))))
diff --git a/lux-bootstrapper/src/lux/analyser/module.clj b/lux-bootstrapper/src/lux/analyser/module.clj
index d41eb73d5..12e6b816a 100644
--- a/lux-bootstrapper/src/lux/analyser/module.clj
+++ b/lux-bootstrapper/src/lux/analyser/module.clj
@@ -35,7 +35,7 @@
;; "lux;defs"
(&/|table)
;; "lux;imports"
- &/$Nil
+ &/$End
;; "lux;tags"
(&/|table)
;; "lux;types"
@@ -87,7 +87,7 @@
(return* (&/update$ &/$modules
(fn [ms]
(&/|update current-module
- (fn [m] (&/update$ $imports (partial &/$Cons module) m))
+ (fn [m] (&/update$ $imports (partial &/$Item module) m))
ms))
state)
nil)))))
@@ -108,7 +108,7 @@
(defn define-alias [module name de-aliased]
(fn [state]
(|case (&/get$ &/$scopes state)
- (&/$Cons ?env (&/$Nil))
+ (&/$Item ?env (&/$End))
(return* (->> state
(&/update$ &/$modules
(fn [ms]
@@ -127,7 +127,7 @@
(defn define [module name exported? def-type def-meta def-value]
(fn [state]
(|case (&/get$ &/$scopes state)
- (&/$Cons ?env (&/$Nil))
+ (&/$Item ?env (&/$End))
(return* (->> state
(&/update$ &/$modules
(fn [ms]
@@ -287,7 +287,7 @@
(fn [state]
(return* (->> state
(&/update$ &/$modules #(&/|put name (new-module hash) %))
- (&/set$ &/$scopes (&/|list (&/env name &/$Nil)))
+ (&/set$ &/$scopes (&/|list (&/env name &/$End)))
(&/set$ &/$current-module (&/$Some name)))
nil)))
@@ -406,9 +406,9 @@
[_ (&/$Tuple _parts)]
(&/map% (fn [_part]
(|case _part
- [_ (&/$Tuple (&/$Cons [[_ (&/$Text _module)]
- (&/$Cons [[_ (&/$Text _alias)]
- (&/$Nil)])]))]
+ [_ (&/$Tuple (&/$Item [[_ (&/$Text _module)]
+ (&/$Item [[_ (&/$Text _alias)]
+ (&/$End)])]))]
(return (&/T [_module _alias]))
_
diff --git a/lux-bootstrapper/src/lux/analyser/parser.clj b/lux-bootstrapper/src/lux/analyser/parser.clj
index 15224573c..cfc26ea2a 100644
--- a/lux-bootstrapper/src/lux/analyser/parser.clj
+++ b/lux-bootstrapper/src/lux/analyser/parser.clj
@@ -20,23 +20,23 @@
(fn [state]
(|case (action state)
(&/$Left ^String error)
- (&/$Right (&/T [state &/$Nil]))
+ (&/$Right (&/T [state &/$End]))
(&/$Right state* head)
((|do [tail (repeat% action)]
- (return (&/$Cons head tail)))
+ (return (&/$Item head tail)))
state*))))
(defn ^:private spaced [action]
(fn [state]
(|case (action state)
(&/$Left ^String error)
- (&/$Right (&/T [state &/$Nil]))
+ (&/$Right (&/T [state &/$End]))
(&/$Right state* head)
((&/try-all% (&/|list (|do [_ _space_
tail (spaced action)]
- (return (&/$Cons head tail)))
+ (return (&/$Item head tail)))
(return (&/|list head))))
state*))))
@@ -129,7 +129,7 @@
(def ^:private parse-ctor-arg
(with-brackets
(|do [=class parse-gclass
- (&/$Cons =term (&/$Nil)) (with-pre-space
+ (&/$Item =term (&/$End)) (with-pre-space
&parser/parse)]
(return (&/T [=class =term])))))
@@ -181,7 +181,7 @@
(|do [[_ _ ?] (&reader/read-text? " ")]
(if ?
(|do [=tail parse-gvars]
- (return (&/$Cons =head =tail)))
+ (return (&/$Item =head =tail)))
(return (&/|list =head))))
(&/$None)
@@ -264,7 +264,7 @@
=ctor-args (with-pre-space
(with-brackets
(spaced parse-ctor-arg)))
- (&/$Cons =body (&/$Nil)) (with-pre-space
+ (&/$Item =body (&/$End)) (with-pre-space
&parser/parse)]
(return (&/$ConstructorMethodSyntax (&/T [=privacy-modifier =strict =anns =gvars =exceptions =inputs =ctor-args =body])))))
@@ -294,7 +294,7 @@
(spaced parse-arg-decl)))
=output (with-pre-space
parse-gclass)
- (&/$Cons =body (&/$Nil)) (with-pre-space
+ (&/$Item =body (&/$End)) (with-pre-space
&parser/parse)]
(return (&/$VirtualMethodSyntax (&/T [=name =privacy-modifier =final? =strict =anns =gvars =exceptions =inputs =output =body])))))
@@ -321,7 +321,7 @@
(spaced parse-arg-decl)))
=output (with-pre-space
parse-gclass)
- (&/$Cons =body (&/$Nil)) (with-pre-space
+ (&/$Item =body (&/$End)) (with-pre-space
&parser/parse)]
(return (&/$OverridenMethodSyntax (&/T [=class-decl =name =strict =anns =gvars =exceptions =inputs =output =body])))))
@@ -348,7 +348,7 @@
(spaced parse-arg-decl)))
=output (with-pre-space
parse-gclass)
- (&/$Cons =body (&/$Nil)) (with-pre-space
+ (&/$Item =body (&/$End)) (with-pre-space
&parser/parse)]
(return (&/$StaticMethodSyntax (&/T [=name =privacy-modifier =strict =anns =gvars =exceptions =inputs =output =body])))))
@@ -416,7 +416,7 @@
(spaced parse-ann)))
=type (with-pre-space
parse-gclass)
- (&/$Cons =value (&/$Nil)) (with-pre-space
+ (&/$Item =value (&/$End)) (with-pre-space
&parser/parse)]
(return (&/$ConstantFieldSyntax =name =anns =type =value)))
diff --git a/lux-bootstrapper/src/lux/analyser/proc/common.clj b/lux-bootstrapper/src/lux/analyser/proc/common.clj
index 439ad0d10..2d4c0d27e 100644
--- a/lux-bootstrapper/src/lux/analyser/proc/common.clj
+++ b/lux-bootstrapper/src/lux/analyser/proc/common.clj
@@ -10,7 +10,7 @@
(defn- analyse-lux-is [analyse exo-type ?values]
(&type/with-var
(fn [$var]
- (|do [:let [(&/$Cons reference (&/$Cons sample (&/$Nil))) ?values]
+ (|do [:let [(&/$Item reference (&/$Item sample (&/$End))) ?values]
=reference (&&/analyse-1 analyse $var reference)
=sample (&&/analyse-1 analyse $var sample)
_ (&type/check exo-type &type/Bit)
@@ -21,7 +21,7 @@
(defn- analyse-lux-try [analyse exo-type ?values]
(&type/with-var
(fn [$var]
- (|do [:let [(&/$Cons op (&/$Nil)) ?values]
+ (|do [:let [(&/$Item op (&/$End)) ?values]
=op (&&/analyse-1 analyse (&/$Function &type/Any $var) op)
_ (&type/check exo-type (&/$Sum &type/Text ;; lux.Left
$var ;; lux.Right
@@ -31,7 +31,7 @@
(&&/$proc (&/T ["lux" "try"]) (&/|list =op) (&/|list)))))))))
(defn- analyse-lux-macro [analyse exo-type ?values]
- (|do [:let [(&/$Cons macro (&/$Nil)) ?values]
+ (|do [:let [(&/$Item macro (&/$End)) ?values]
[_real-name [_exported? _def-type _meta macro-type]] (&&module/find-def! &/prelude "Macro'")
[[=macro*-type =location] =macro] (&&/analyse-1 analyse macro-type macro)
_ (&type/check exo-type &type/Macro)]
@@ -40,7 +40,7 @@
(do-template [<name> <proc> <input-type> <output-type>]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons reference (&/$Cons sample (&/$Nil))) ?values]
+ (|do [:let [(&/$Item reference (&/$Item sample (&/$End))) ?values]
=reference (&&/analyse-1 analyse <input-type> reference)
=sample (&&/analyse-1 analyse <input-type> sample)
_ (&type/check exo-type <output-type>)
@@ -53,7 +53,7 @@
)
(defn- analyse-text-concat [analyse exo-type ?values]
- (|do [:let [(&/$Cons parameter (&/$Cons subject (&/$Nil))) ?values]
+ (|do [:let [(&/$Item parameter (&/$Item subject (&/$End))) ?values]
=parameter (&&/analyse-1 analyse &type/Text parameter)
=subject (&&/analyse-1 analyse &type/Text subject)
_ (&type/check exo-type &type/Text)
@@ -62,7 +62,7 @@
(&&/$proc (&/T ["text" "concat"]) (&/|list =parameter =subject) (&/|list)))))))
(defn- analyse-text-index [analyse exo-type ?values]
- (|do [:let [(&/$Cons start (&/$Cons part (&/$Cons text (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item start (&/$Item part (&/$Item text (&/$End)))) ?values]
=start (&&/analyse-1 analyse &type/Nat start)
=part (&&/analyse-1 analyse &type/Text part)
=text (&&/analyse-1 analyse &type/Text text)
@@ -74,7 +74,7 @@
(&/|list)))))))
(defn- analyse-text-clip [analyse exo-type ?values]
- (|do [:let [(&/$Cons from (&/$Cons to (&/$Cons text (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item from (&/$Item to (&/$Item text (&/$End)))) ?values]
=from (&&/analyse-1 analyse &type/Nat from)
=to (&&/analyse-1 analyse &type/Nat to)
=text (&&/analyse-1 analyse &type/Text text)
@@ -87,7 +87,7 @@
(do-template [<name> <proc>]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons text (&/$Nil)) ?values]
+ (|do [:let [(&/$Item text (&/$End)) ?values]
=text (&&/analyse-1 analyse &type/Text text)
_ (&type/check exo-type &type/Nat)
_location &/location]
@@ -100,7 +100,7 @@
)
(defn- analyse-text-char [analyse exo-type ?values]
- (|do [:let [(&/$Cons idx (&/$Cons text (&/$Nil))) ?values]
+ (|do [:let [(&/$Item idx (&/$Item text (&/$End))) ?values]
=idx (&&/analyse-1 analyse &type/Nat idx)
=text (&&/analyse-1 analyse &type/Text text)
_ (&type/check exo-type &type/Nat)
@@ -114,7 +114,7 @@
(let [inputT (&/$Apply &type/Any &type/I64)
outputT &type/I64]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons mask (&/$Cons input (&/$Nil))) ?values]
+ (|do [:let [(&/$Item mask (&/$Item input (&/$End))) ?values]
=mask (&&/analyse-1 analyse inputT mask)
=input (&&/analyse-1 analyse inputT input)
_ (&type/check exo-type outputT)
@@ -131,7 +131,7 @@
(let [inputT (&/$Apply &type/Any &type/I64)
outputT &type/I64]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons shift (&/$Cons input (&/$Nil))) ?values]
+ (|do [:let [(&/$Item shift (&/$Item input (&/$End))) ?values]
=shift (&&/analyse-1 analyse &type/Nat shift)
=input (&&/analyse-1 analyse inputT input)
_ (&type/check exo-type outputT)
@@ -147,7 +147,7 @@
(let [inputT <input-type>
outputT <output-type>]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons parameterC (&/$Cons subjectC (&/$Nil))) ?values]
+ (|do [:let [(&/$Item parameterC (&/$Item subjectC (&/$End))) ?values]
parameterA (&&/analyse-1 analyse <input-type> parameterC)
subjectA (&&/analyse-1 analyse <input-type> subjectC)
_ (&type/check exo-type <output-type>)
@@ -175,7 +175,7 @@
(do-template [<encode> <encode-op> <decode> <decode-op> <type>]
(do (defn- <encode> [analyse exo-type ?values]
- (|do [:let [(&/$Cons x (&/$Nil)) ?values]
+ (|do [:let [(&/$Item x (&/$End)) ?values]
=x (&&/analyse-1 analyse <type> x)
_ (&type/check exo-type &type/Text)
_location &/location]
@@ -184,7 +184,7 @@
(let [decode-type (&/$Apply <type> &type/Maybe)]
(defn- <decode> [analyse exo-type ?values]
- (|do [:let [(&/$Cons x (&/$Nil)) ?values]
+ (|do [:let [(&/$Item x (&/$End)) ?values]
=x (&&/analyse-1 analyse &type/Text x)
_ (&type/check exo-type decode-type)
_location &/location]
@@ -196,7 +196,7 @@
(do-template [<name> <from-type> <to-type> <op>]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons x (&/$Nil)) ?values]
+ (|do [:let [(&/$Item x (&/$End)) ?values]
=x (&&/analyse-1 analyse <from-type> x)
_ (&type/check exo-type <to-type>)
_location &/location]
@@ -212,14 +212,14 @@
)
(defn- analyse-io-current-time [analyse exo-type ?values]
- (|do [:let [(&/$Nil) ?values]
+ (|do [:let [(&/$End) ?values]
_ (&type/check exo-type &type/Int)
_location &/location]
(return (&/|list (&&/|meta exo-type _location
(&&/$proc (&/T ["io" "current-time"]) (&/|list) (&/|list)))))))
(defn- analyse-syntax-char-case! [analyse exo-type ?values]
- (|do [:let [(&/$Cons ?input (&/$Cons [_ (&/$Tuple ?pairs)] (&/$Cons ?else (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item ?input (&/$Item [_ (&/$Tuple ?pairs)] (&/$Item ?else (&/$End)))) ?values]
_location &/location
=input (&&/analyse-1 analyse &type/Nat ?input)
_ (assert! (even? (&/|length ?pairs)) "The number of matches must be even!")
@@ -235,7 +235,7 @@
=else (&&/analyse-1 analyse exo-type ?else)]
(return (&/|list (&&/|meta exo-type _location
(&&/$proc (&/T ["lux" "syntax char case!"])
- (&/$Cons =input (&/$Cons =else (&/|map &/|second =pairs)))
+ (&/$Item =input (&/$Item =else (&/|map &/|second =pairs)))
(&/|map &/|first =pairs)))))))
(defn analyse-proc [analyse exo-type proc ?values]
diff --git a/lux-bootstrapper/src/lux/analyser/proc/jvm.clj b/lux-bootstrapper/src/lux/analyser/proc/jvm.clj
index 78362601d..38310e60c 100644
--- a/lux-bootstrapper/src/lux/analyser/proc/jvm.clj
+++ b/lux-bootstrapper/src/lux/analyser/proc/jvm.clj
@@ -93,8 +93,8 @@
(|do [[_ clean-types] (&/fold% (fn [idx+types gtype-var]
(|do [:let [[idx types] idx+types]
[idx* real-type] (clean-gtype-var idx gtype-var)]
- (return (&/T [idx* (&/$Cons real-type types)]))))
- (&/T [1 &/$Nil])
+ (return (&/T [idx* (&/$Item real-type types)]))))
+ (&/T [1 &/$End])
gtype-vars)]
(return clean-types)))
@@ -118,7 +118,7 @@
(|case obj-type
(&/$Primitive class targs)
(if (= (&/|length targs) (&/|length gvars))
- (|let [gtype-env (&/fold2 (fn [m ^TypeVariable g t] (&/$Cons (&/T [(.getName g) t]) m))
+ (|let [gtype-env (&/fold2 (fn [m ^TypeVariable g t] (&/$Item (&/T [(.getName g) t]) m))
(&/|table)
gvars
targs)]
@@ -191,14 +191,14 @@
(&/$GenericClass name params)
(case name
- "boolean" (return (&/$Primitive "java.lang.Boolean" &/$Nil))
- "byte" (return (&/$Primitive "java.lang.Byte" &/$Nil))
- "short" (return (&/$Primitive "java.lang.Short" &/$Nil))
- "int" (return (&/$Primitive "java.lang.Integer" &/$Nil))
- "long" (return (&/$Primitive "java.lang.Long" &/$Nil))
- "float" (return (&/$Primitive "java.lang.Float" &/$Nil))
- "double" (return (&/$Primitive "java.lang.Double" &/$Nil))
- "char" (return (&/$Primitive "java.lang.Character" &/$Nil))
+ "boolean" (return (&/$Primitive "java.lang.Boolean" &/$End))
+ "byte" (return (&/$Primitive "java.lang.Byte" &/$End))
+ "short" (return (&/$Primitive "java.lang.Short" &/$End))
+ "int" (return (&/$Primitive "java.lang.Integer" &/$End))
+ "long" (return (&/$Primitive "java.lang.Long" &/$End))
+ "float" (return (&/$Primitive "java.lang.Float" &/$End))
+ "double" (return (&/$Primitive "java.lang.Double" &/$End))
+ "char" (return (&/$Primitive "java.lang.Character" &/$End))
"void" (return &type/Any)
;; else
(|do [=params (&/map% (partial generic-class->type env) params)]
@@ -209,7 +209,7 @@
(return (&/$Primitive &host-type/array-data-tag (&/|list =param))))
(&/$GenericWildcard _)
- (return (&/$ExQ &/$Nil (&/$Parameter 1)))
+ (return (&/$ExQ &/$End (&/$Parameter 1)))
))
(defn gen-super-env
@@ -393,10 +393,10 @@
))
(do-template [<name> <proc> <from-class> <to-class>]
- (let [output-type (&/$Primitive <to-class> &/$Nil)]
+ (let [output-type (&/$Primitive <to-class> &/$End)]
(defn- <name> [analyse exo-type _?value]
- (|do [:let [(&/$Cons ?value (&/$Nil)) _?value]
- =value (&&/analyse-1 analyse (&/$Primitive <from-class> &/$Nil) ?value)
+ (|do [:let [(&/$Item ?value (&/$End)) _?value]
+ =value (&&/analyse-1 analyse (&/$Primitive <from-class> &/$End) ?value)
_ (&type/check exo-type output-type)
_location &/location]
(return (&/|list (&&/|meta output-type _location (&&/$proc (&/T ["jvm" <proc>]) (&/|list =value) (&/|list))))))))
@@ -433,11 +433,11 @@
)
(do-template [<name> <proc> <v1-class> <v2-class> <to-class>]
- (let [output-type (&/$Primitive <to-class> &/$Nil)]
+ (let [output-type (&/$Primitive <to-class> &/$End)]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons ?value1 (&/$Cons ?value2 (&/$Nil))) ?values]
- =value1 (&&/analyse-1 analyse (&/$Primitive <v1-class> &/$Nil) ?value1)
- =value2 (&&/analyse-1 analyse (&/$Primitive <v2-class> &/$Nil) ?value2)
+ (|do [:let [(&/$Item ?value1 (&/$Item ?value2 (&/$End))) ?values]
+ =value1 (&&/analyse-1 analyse (&/$Primitive <v1-class> &/$End) ?value1)
+ =value2 (&&/analyse-1 analyse (&/$Primitive <v2-class> &/$End) ?value2)
_ (&type/check exo-type output-type)
_location &/location]
(return (&/|list (&&/|meta output-type _location (&&/$proc (&/T ["jvm" <proc>]) (&/|list =value1 =value2) (&/|list))))))))
@@ -458,10 +458,10 @@
)
(do-template [<name> <proc> <input-class> <output-class>]
- (let [input-type (&/$Primitive <input-class> &/$Nil)
- output-type (&/$Primitive <output-class> &/$Nil)]
+ (let [input-type (&/$Primitive <input-class> &/$End)
+ output-type (&/$Primitive <output-class> &/$End)]
(defn- <name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons x (&/$Cons y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item x (&/$Item y (&/$End))) ?values]
=x (&&/analyse-1 analyse input-type x)
=y (&&/analyse-1 analyse input-type y)
_ (&type/check exo-type output-type)
@@ -513,10 +513,10 @@
(let [length-type &type/Nat
idx-type &type/Nat]
(do-template [<elem-class> <array-class> <new-name> <new-tag> <load-name> <load-tag> <store-name> <store-tag>]
- (let [elem-type (&/$Primitive <elem-class> &/$Nil)
- array-type (&/$Primitive <array-class> &/$Nil)]
+ (let [elem-type (&/$Primitive <elem-class> &/$End)
+ array-type (&/$Primitive <array-class> &/$End)]
(defn- <new-name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons length (&/$Nil)) ?values]
+ (|do [:let [(&/$Item length (&/$End)) ?values]
=length (&&/analyse-1 analyse length-type length)
_ (&type/check exo-type array-type)
_location &/location]
@@ -524,7 +524,7 @@
(&&/$proc (&/T ["jvm" <new-tag>]) (&/|list =length) (&/|list)))))))
(defn- <load-name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons array (&/$Cons idx (&/$Nil))) ?values]
+ (|do [:let [(&/$Item array (&/$Item idx (&/$End))) ?values]
=array (&&/analyse-1 analyse array-type array)
=idx (&&/analyse-1 analyse idx-type idx)
_ (&type/check exo-type elem-type)
@@ -533,7 +533,7 @@
(&&/$proc (&/T ["jvm" <load-tag>]) (&/|list =array =idx) (&/|list)))))))
(defn- <store-name> [analyse exo-type ?values]
- (|do [:let [(&/$Cons array (&/$Cons idx (&/$Cons elem (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item array (&/$Item idx (&/$Item elem (&/$End)))) ?values]
=array (&&/analyse-1 analyse array-type array)
=idx (&&/analyse-1 analyse idx-type idx)
=elem (&&/analyse-1 analyse elem-type elem)
@@ -563,7 +563,7 @@
(let [length-type &type/Nat
idx-type &type/Nat]
(defn- analyse-jvm-anewarray [analyse exo-type ?values]
- (|do [:let [(&/$Cons [_ (&/$Text _gclass)] (&/$Cons length (&/$Nil))) ?values]
+ (|do [:let [(&/$Item [_ (&/$Text _gclass)] (&/$Item length (&/$End))) ?values]
gclass (&reader/with-source "jvm-anewarray" _gclass
&&a-parser/parse-gclass)
gtype-env &/get-type-env
@@ -576,11 +576,11 @@
(&&/$proc (&/T ["jvm" "anewarray"]) (&/|list =length) (&/|list gclass gtype-env)))))))
(defn- analyse-jvm-aaload [analyse exo-type ?values]
- (|do [:let [(&/$Cons array (&/$Cons idx (&/$Nil))) ?values]
+ (|do [:let [(&/$Item array (&/$Item idx (&/$End))) ?values]
=array (&&/analyse-1+ analyse array)
[arr-class arr-params] (ensure-object (&&/expr-type* =array))
_ (&/assert! (= &host-type/array-data-tag arr-class) (str "[Analyser Error] Expected array. Instead got: " arr-class))
- :let [(&/$Cons inner-arr-type (&/$Nil)) arr-params]
+ :let [(&/$Item inner-arr-type (&/$End)) arr-params]
=idx (&&/analyse-1 analyse idx-type idx)
_ (&type/check exo-type inner-arr-type)
_location &/location]
@@ -588,12 +588,12 @@
(&&/$proc (&/T ["jvm" "aaload"]) (&/|list =array =idx) (&/|list)))))))
(defn- analyse-jvm-aastore [analyse exo-type ?values]
- (|do [:let [(&/$Cons array (&/$Cons idx (&/$Cons elem (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item array (&/$Item idx (&/$Item elem (&/$End)))) ?values]
=array (&&/analyse-1+ analyse array)
:let [array-type (&&/expr-type* =array)]
[arr-class arr-params] (ensure-object array-type)
_ (&/assert! (= &host-type/array-data-tag arr-class) (str "[Analyser Error] Expected array. Instead got: " arr-class))
- :let [(&/$Cons inner-arr-type (&/$Nil)) arr-params]
+ :let [(&/$Item inner-arr-type (&/$End)) arr-params]
=idx (&&/analyse-1 analyse idx-type idx)
=elem (&&/analyse-1 analyse inner-arr-type elem)
_ (&type/check exo-type array-type)
@@ -602,7 +602,7 @@
(&&/$proc (&/T ["jvm" "aastore"]) (&/|list =array =idx =elem) (&/|list))))))))
(defn- analyse-jvm-arraylength [analyse exo-type ?values]
- (|do [:let [(&/$Cons array (&/$Nil)) ?values]
+ (|do [:let [(&/$Item array (&/$End)) ?values]
=array (&&/analyse-1+ analyse array)
[arr-class arr-params] (ensure-object (&&/expr-type* =array))
_ (&/assert! (array-class? arr-class) (str "[Analyser Error] Expected array. Instead got: " arr-class))
@@ -613,7 +613,7 @@
)))))
(defn- analyse-jvm-object-null? [analyse exo-type ?values]
- (|do [:let [(&/$Cons object (&/$Nil)) ?values]
+ (|do [:let [(&/$Item object (&/$End)) ?values]
=object (&&/analyse-1+ analyse object)
_ (ensure-object (&&/expr-type* =object))
:let [output-type &type/Bit]
@@ -623,15 +623,15 @@
(&&/$proc (&/T ["jvm" "object null?"]) (&/|list =object) (&/|list)))))))
(defn- analyse-jvm-object-null [analyse exo-type ?values]
- (|do [:let [(&/$Nil) ?values]
- :let [output-type (&/$Primitive &host-type/null-data-tag &/$Nil)]
+ (|do [:let [(&/$End) ?values]
+ :let [output-type (&/$Primitive &host-type/null-data-tag &/$End)]
_ (&type/check exo-type output-type)
_location &/location]
(return (&/|list (&&/|meta exo-type _location
(&&/$proc (&/T ["jvm" "object null"]) (&/|list) (&/|list)))))))
(defn analyse-jvm-object-synchronized [analyse exo-type ?values]
- (|do [:let [(&/$Cons ?monitor (&/$Cons ?expr (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?monitor (&/$Item ?expr (&/$End))) ?values]
=monitor (&&/analyse-1+ analyse ?monitor)
_ (ensure-object (&&/expr-type* =monitor))
=expr (&&/analyse-1 analyse exo-type ?expr)
@@ -640,9 +640,9 @@
(&&/$proc (&/T ["jvm" "object synchronized"]) (&/|list =monitor =expr) (&/|list)))))))
(defn- analyse-jvm-throw [analyse exo-type ?values]
- (|do [:let [(&/$Cons ?ex (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?ex (&/$End)) ?values]
=ex (&&/analyse-1+ analyse ?ex)
- _ (&type/check (&/$Primitive "java.lang.Throwable" &/$Nil) (&&/expr-type* =ex))
+ _ (&type/check (&/$Primitive "java.lang.Throwable" &/$End) (&&/expr-type* =ex))
[throw-class throw-params] (ensure-object (&&/expr-type* =ex))
_location &/location
_ (&type/check exo-type &type/Nothing)]
@@ -651,10 +651,10 @@
(defn- analyse-jvm-getstatic [analyse exo-type class field ?values]
(|do [!class! (&/de-alias-class class)
- :let [(&/$Nil) ?values]
+ :let [(&/$End) ?values]
class-loader &/loader
[gvars gtype] (&host/lookup-static-field class-loader !class! field)
- =type (&host-type/instance-param &type/existential &/$Nil gtype)
+ =type (&host-type/instance-param &type/existential &/$End gtype)
:let [output-type =type]
_ (&type/check exo-type output-type)
_location &/location]
@@ -663,7 +663,7 @@
(defn- analyse-jvm-getfield [analyse exo-type class field ?values]
(|do [!class! (&/de-alias-class class)
- :let [(&/$Cons object (&/$Nil)) ?values]
+ :let [(&/$Item object (&/$End)) ?values]
class-loader &/loader
=object (&&/analyse-1+ analyse object)
_ (ensure-object (&&/expr-type* =object))
@@ -677,11 +677,11 @@
(defn- analyse-jvm-putstatic [analyse exo-type class field ?values]
(|do [!class! (&/de-alias-class class)
- :let [(&/$Cons value (&/$Nil)) ?values]
+ :let [(&/$Item value (&/$End)) ?values]
class-loader &/loader
[gvars gtype] (&host/lookup-static-field class-loader !class! field)
:let [gclass (&host-type/gtype->gclass gtype)]
- =type (&host-type/instance-param &type/existential &/$Nil gtype)
+ =type (&host-type/instance-param &type/existential &/$End gtype)
=value (&&/analyse-1 analyse =type value)
:let [output-type &type/Any]
_ (&type/check exo-type output-type)
@@ -691,7 +691,7 @@
(defn- analyse-jvm-putfield [analyse exo-type class field ?values]
(|do [!class! (&/de-alias-class class)
- :let [(&/$Cons object (&/$Cons value (&/$Nil))) ?values]
+ :let [(&/$Item object (&/$Item value (&/$End))) ?values]
class-loader &/loader
=object (&&/analyse-1+ analyse object)
:let [obj-type (&&/expr-type* =object)]
@@ -708,7 +708,7 @@
(defn- analyse-method-call-helper [analyse exo-type gret gtype-env gtype-vars gtype-args args]
(|case gtype-vars
- (&/$Nil)
+ (&/$End)
(|do [arg-types (&/map% (partial &host-type/instance-param &type/existential gtype-env) gtype-args)
=arg-types (&/map% &type/show-type+ arg-types)
=args (&/map2% (partial &&/analyse-1 analyse) arg-types args)
@@ -716,11 +716,11 @@
_ (&type/check exo-type (as-otype+ =gret))]
(return (&/T [=gret =args])))
- (&/$Cons ^TypeVariable gtv gtype-vars*)
+ (&/$Item ^TypeVariable gtv gtype-vars*)
(&type/with-var
(fn [$var]
(|do [:let [(&/$Var _id) $var
- gtype-env* (&/$Cons (&/T [(.getName gtv) $var]) gtype-env)]
+ gtype-env* (&/$Item (&/T [(.getName gtv) $var]) gtype-env)]
[=gret =args] (analyse-method-call-helper analyse exo-type gret gtype-env* gtype-vars* gtype-args args)
==gret (&type/clean $var =gret)
==args (&/map% (partial &&/clean-analysis $var) =args)]
@@ -733,7 +733,7 @@
!class!
sub-class)
sub-params)]
- (return (&/fold2 (fn [m ^TypeVariable g t] (&/$Cons (&/T [(.getName g) t]) m))
+ (return (&/fold2 (fn [m ^TypeVariable g t] (&/$Item (&/T [(.getName g) t]) m))
(&/|table)
parent-gvars
super-params*))))
@@ -751,20 +751,20 @@
(&/fail-with-loc (str "[Analyser Error] Unknown class: " !class!))))]
(return (&/T [!class! class-loader]))))
-(let [dummy-type-param (&/$Primitive "java.lang.Object" &/$Nil)]
+(let [dummy-type-param (&/$Primitive "java.lang.Object" &/$End)]
(do-template [<name> <tag> <only-interface?>]
(defn- <name> [analyse exo-type class method classes ?values]
- (|do [:let [(&/$Cons object args) ?values]
+ (|do [:let [(&/$Item object args) ?values]
[!class! class-loader] (check-method! <only-interface?> class method)
[gret exceptions parent-gvars gvars gargs] (if (= "<init>" method)
- (return (&/T [Void/TYPE &/$Nil &/$Nil &/$Nil &/$Nil]))
+ (return (&/T [Void/TYPE &/$End &/$End &/$End &/$End]))
(&host/lookup-virtual-method class-loader !class! method classes))
=object (&&/analyse-1+ analyse object)
gtype-env (up-cast class parent-gvars class-loader !class! (&&/expr-type* =object))
[output-type =args] (analyse-method-call-helper analyse exo-type gret gtype-env gvars gargs args)
_location &/location]
(return (&/|list (&&/|meta exo-type _location
- (&&/$proc (&/T ["jvm" <tag>]) (&/$Cons =object =args) (&/|list class method classes output-type gret)))))))
+ (&&/$proc (&/T ["jvm" <tag>]) (&/$Item =object =args) (&/|list class method classes output-type gret)))))))
analyse-jvm-invokevirtual "invokevirtual" false
analyse-jvm-invokespecial "invokespecial" false
@@ -784,17 +784,17 @@
(defn- analyse-jvm-new-helper [analyse gtype gtype-env gtype-vars gtype-args args]
(|case gtype-vars
- (&/$Nil)
+ (&/$End)
(|do [arg-types (&/map% (partial &host-type/instance-param &type/existential gtype-env) gtype-args)
=args (&/map2% (partial &&/analyse-1 analyse) arg-types args)
gtype-vars* (->> gtype-env (&/|map &/|second) (clean-gtype-vars))]
(return (&/T [(make-gtype gtype gtype-vars*)
=args])))
- (&/$Cons ^TypeVariable gtv gtype-vars*)
+ (&/$Item ^TypeVariable gtv gtype-vars*)
(&type/with-var
(fn [$var]
- (|do [:let [gtype-env* (&/$Cons (&/T [(.getName gtv) $var]) gtype-env)]
+ (|do [:let [gtype-env* (&/$Item (&/T [(.getName gtv) $var]) gtype-env)]
[=gret =args] (analyse-jvm-new-helper analyse gtype gtype-env* gtype-vars* gtype-args args)
==gret (&type/clean $var =gret)
==args (&/map% (partial &&/clean-analysis $var) =args)]
@@ -813,7 +813,7 @@
(&&/$proc (&/T ["jvm" "new"]) =args (&/|list class classes)))))))
(defn- analyse-jvm-instanceof [analyse exo-type class ?values]
- (|do [:let [(&/$Cons object (&/$Nil)) ?values]
+ (|do [:let [(&/$Item object (&/$End)) ?values]
=object (&&/analyse-1+ analyse object)
_ (ensure-object (&&/expr-type* =object))
:let [output-type &type/Bit]
@@ -823,7 +823,7 @@
(&&/$proc (&/T ["jvm" "instanceof"]) (&/|list =object) (&/|list class)))))))
(defn- analyse-jvm-object-class [analyse exo-type ?values]
- (|do [:let [(&/$Cons [_ (&/$Text _class-name)] (&/$Nil)) ?values]
+ (|do [:let [(&/$Item [_ (&/$Text _class-name)] (&/$End)) ?values]
^ClassLoader class-loader &/loader
_ (try (do (.loadClass class-loader _class-name)
(return nil))
@@ -849,14 +849,14 @@
:let [[?name ?params] class-decl
full-name (str (string/replace module "/" ".") "." ?name)
class-decl* (&/T [full-name ?params])
- all-supers (&/$Cons super-class interfaces)]
+ all-supers (&/$Item super-class interfaces)]
class-env (make-type-env ?params)
=fields (&/map% (partial analyse-field analyse class-env) ?fields)
_ (&host/use-dummy-class class-decl super-class interfaces &/$None =fields methods)
=methods (&/map% (partial analyse-method analyse class-decl* class-env all-supers) methods)
;; TODO: Uncomment
;; _ (check-method-completion all-supers =methods)
- _ (compile-class class-decl super-class interfaces =inheritance-modifier =anns =fields =methods &/$Nil &/$None)
+ _ (compile-class class-decl super-class interfaces =inheritance-modifier =anns =fields =methods &/$End &/$None)
_ &/pop-dummy-name
:let [_ (println 'CLASS full-name)]
_location &/location]
@@ -869,7 +869,7 @@
source))
(defn- analyse-methods [analyse class-decl all-supers methods]
- (|do [=methods (&/map% (partial analyse-method analyse class-decl &/$Nil all-supers) methods)
+ (|do [=methods (&/map% (partial analyse-method analyse class-decl &/$End all-supers) methods)
;; TODO: Uncomment
;; _ (check-method-completion all-supers =methods)
=captured &&env/captured-vars]
@@ -883,42 +883,42 @@
(let [default-<init> (fn [ctor-args]
(&/$ConstructorMethodSyntax (&/T [&/$PublicPM ;; privacy-modifier
false ;; strict
- &/$Nil ;; anns
- &/$Nil ;; gvars
- &/$Nil ;; exceptions
- &/$Nil ;; inputs
+ &/$End ;; anns
+ &/$End ;; gvars
+ &/$End ;; exceptions
+ &/$End ;; inputs
ctor-args ;; ctor-args
- (&/$Tuple &/$Nil) ;; body
+ (&/$Tuple &/$End) ;; body
])))
captured-slot-class "java.lang.Object"
- captured-slot-type (&/$GenericClass captured-slot-class &/$Nil)]
+ captured-slot-type (&/$GenericClass captured-slot-class &/$End)]
(defn- analyse-jvm-anon-class [analyse compile-class exo-type super-class interfaces ctor-args methods]
(&/with-closure
(|do [[module scope] (get-names)
:let [name (->> scope &/|reverse &/|tail &host/location)
- class-decl (&/T [name &/$Nil])
+ class-decl (&/T [name &/$End])
anon-class (str (string/replace module "/" ".") "." name)
- class-type-decl (&/T [anon-class &/$Nil])
- anon-class-type (&/$Primitive anon-class &/$Nil)]
+ class-type-decl (&/T [anon-class &/$End])
+ anon-class-type (&/$Primitive anon-class &/$End)]
=ctor-args (&/map% (fn [ctor-arg]
(|let [[arg-type arg-term] ctor-arg]
(|do [=arg-term (&&/analyse-1+ analyse arg-term)]
(return (&/T [arg-type =arg-term])))))
ctor-args)
_ (->> methods
- (&/$Cons (default-<init> =ctor-args))
- (&host/use-dummy-class class-decl super-class interfaces (&/$Some =ctor-args) &/$Nil))
- [=methods =captured] (let [all-supers (&/$Cons super-class interfaces)]
+ (&/$Item (default-<init> =ctor-args))
+ (&host/use-dummy-class class-decl super-class interfaces (&/$Some =ctor-args) &/$End))
+ [=methods =captured] (let [all-supers (&/$Item super-class interfaces)]
(analyse-methods analyse class-type-decl all-supers methods))
_ (let [=fields (&/|map (fn [^objects idx+capt]
(|let [[idx _] idx+capt]
(&/$VariableFieldAnalysis (str &c!base/closure-prefix idx)
&/$PublicPM
&/$FinalSM
- &/$Nil
+ &/$End
captured-slot-type)))
(&/enumerate =captured))]
- (compile-class class-decl super-class interfaces &/$DefaultIM &/$Nil =fields =methods =captured (&/$Some =ctor-args)))
+ (compile-class class-decl super-class interfaces &/$DefaultIM &/$End =fields =methods =captured (&/$Some =ctor-args)))
_ &/pop-dummy-name
_location &/location]
(let [sources (&/|map captured-source =captured)]
diff --git a/lux-bootstrapper/src/lux/analyser/record.clj b/lux-bootstrapper/src/lux/analyser/record.clj
index 3d3d8169f..53f6c4d5c 100644
--- a/lux-bootstrapper/src/lux/analyser/record.clj
+++ b/lux-bootstrapper/src/lux/analyser/record.clj
@@ -7,13 +7,14 @@
[module :as &&module])))
;; [Exports]
-(defn order-record [pairs]
+(defn order-record
"(-> (List (, Syntax Syntax)) (Lux (List Syntax)))"
+ [pairs]
(|do [[tag-group tag-type] (|case pairs
- (&/$Nil)
- (return (&/T [&/$Nil &type/Any]))
+ (&/$End)
+ (return (&/T [&/$End &type/Any]))
- (&/$Cons [[_ (&/$Tag tag1)] _] _)
+ (&/$Item [[_ (&/$Tag tag1)] _] _)
(|do [[module name] (&&/resolved-ident tag1)
tags (&&module/tag-group module name)
type (&&module/tag-type module name)]
diff --git a/lux-bootstrapper/src/lux/base.clj b/lux-bootstrapper/src/lux/base.clj
index 648b3341c..1367bdc1c 100644
--- a/lux-bootstrapper/src/lux/base.clj
+++ b/lux-bootstrapper/src/lux/base.clj
@@ -60,8 +60,8 @@
;; List
(defvariant
- ("Nil" 0)
- ("Cons" 2))
+ ("End" 0)
+ ("Item" 2))
;; Maybe
(defvariant
@@ -160,6 +160,7 @@
"seed"
"scope-type-vars"
"extensions"
+ "eval"
"host"])
(defvariant
@@ -285,71 +286,71 @@
(defmacro |list [& elems]
(reduce (fn [tail head]
- `($Cons ~head ~tail))
- `$Nil
+ `($Item ~head ~tail))
+ `$End
(reverse elems)))
(defmacro |table [& elems]
(reduce (fn [table [k v]]
`(|put ~k ~v ~table))
- `$Nil
+ `$End
(reverse (partition 2 elems))))
(defn |get [slot table]
(|case table
- ($Nil)
+ ($End)
nil
- ($Cons [k v] table*)
+ ($Item [k v] table*)
(if (= k slot)
v
(recur slot table*))))
(defn |put [slot value table]
(|case table
- ($Nil)
- ($Cons (T [slot value]) $Nil)
+ ($End)
+ ($Item (T [slot value]) $End)
- ($Cons [k v] table*)
+ ($Item [k v] table*)
(if (= k slot)
- ($Cons (T [slot value]) table*)
- ($Cons (T [k v]) (|put slot value table*)))
+ ($Item (T [slot value]) table*)
+ ($Item (T [k v]) (|put slot value table*)))
))
(defn |remove [slot table]
(|case table
- ($Nil)
+ ($End)
table
- ($Cons [k v] table*)
+ ($Item [k v] table*)
(if (= k slot)
table*
- ($Cons (T [k v]) (|remove slot table*)))))
+ ($Item (T [k v]) (|remove slot table*)))))
(defn |update [k f table]
(|case table
- ($Nil)
+ ($End)
table
- ($Cons [k* v] table*)
+ ($Item [k* v] table*)
(if (= k k*)
- ($Cons (T [k* (f v)]) table*)
- ($Cons (T [k* v]) (|update k f table*)))))
+ ($Item (T [k* (f v)]) table*)
+ ($Item (T [k* v]) (|update k f table*)))))
(defn |head [xs]
(|case xs
- ($Nil)
+ ($End)
(assert false (prn-str '|head))
- ($Cons x _)
+ ($Item x _)
x))
(defn |tail [xs]
(|case xs
- ($Nil)
+ ($End)
(assert false (prn-str '|tail))
- ($Cons _ xs*)
+ ($Item _ xs*)
xs*))
;; [Resources/Monads]
@@ -395,19 +396,19 @@
(defn |++ [xs ys]
(|case xs
- ($Nil)
+ ($End)
ys
- ($Cons x xs*)
- ($Cons x (|++ xs* ys))))
+ ($Item x xs*)
+ ($Item x (|++ xs* ys))))
(defn |map [f xs]
(|case xs
- ($Nil)
+ ($End)
xs
- ($Cons x xs*)
- ($Cons (f x) (|map f xs*))
+ ($Item x xs*)
+ ($Item (f x) (|map f xs*))
_
(assert false (prn-str '|map f (adt->text xs)))))
@@ -416,99 +417,99 @@
"(All [a] (-> (List a) Bit))"
[xs]
(|case xs
- ($Nil)
+ ($End)
true
- ($Cons _ _)
+ ($Item _ _)
false))
(defn |filter
"(All [a] (-> (-> a Bit) (List a) (List a)))"
[p xs]
(|case xs
- ($Nil)
+ ($End)
xs
- ($Cons x xs*)
+ ($Item x xs*)
(if (p x)
- ($Cons x (|filter p xs*))
+ ($Item x (|filter p xs*))
(|filter p xs*))))
(defn flat-map
"(All [a b] (-> (-> a (List b)) (List a) (List b)))"
[f xs]
(|case xs
- ($Nil)
+ ($End)
xs
- ($Cons x xs*)
+ ($Item x xs*)
(|++ (f x) (flat-map f xs*))))
(defn |split-with [p xs]
(|case xs
- ($Nil)
+ ($End)
(T [xs xs])
- ($Cons x xs*)
+ ($Item x xs*)
(if (p x)
(|let [[pre post] (|split-with p xs*)]
- (T [($Cons x pre) post]))
- (T [$Nil xs]))))
+ (T [($Item x pre) post]))
+ (T [$End xs]))))
(defn |contains? [k table]
(|case table
- ($Nil)
+ ($End)
false
- ($Cons [k* _] table*)
+ ($Item [k* _] table*)
(or (= k k*)
(|contains? k table*))))
(defn |member? [x xs]
(|case xs
- ($Nil)
+ ($End)
false
- ($Cons x* xs*)
+ ($Item x* xs*)
(or (= x x*) (|member? x xs*))))
(defn fold [f init xs]
(|case xs
- ($Nil)
+ ($End)
init
- ($Cons x xs*)
+ ($Item x xs*)
(recur f (f init x) xs*)))
(defn fold% [f init xs]
(|case xs
- ($Nil)
+ ($End)
(return init)
- ($Cons x xs*)
+ ($Item x xs*)
(|do [init* (f init x)]
(fold% f init* xs*))))
(defn folds [f init xs]
(|case xs
- ($Nil)
+ ($End)
(|list init)
- ($Cons x xs*)
- ($Cons init (folds f (f init x) xs*))))
+ ($Item x xs*)
+ ($Item init (folds f (f init x) xs*))))
(defn |length [xs]
(fold (fn [acc _] (inc acc)) 0 xs))
(defn |range* [from to]
(if (<= from to)
- ($Cons from (|range* (inc from) to))
- $Nil))
+ ($Item from (|range* (inc from) to))
+ $End))
(let [|range* (fn |range* [from to]
(if (< from to)
- ($Cons from (|range* (inc from) to))
- $Nil))]
+ ($Item from (|range* (inc from) to))
+ $End))]
(defn |range [n]
(|range* 0 n)))
@@ -522,68 +523,68 @@
(defn zip2 [xs ys]
(|case [xs ys]
- [($Cons x xs*) ($Cons y ys*)]
- ($Cons (T [x y]) (zip2 xs* ys*))
+ [($Item x xs*) ($Item y ys*)]
+ ($Item (T [x y]) (zip2 xs* ys*))
[_ _]
- $Nil))
+ $End))
(defn |keys [plist]
(|case plist
- ($Nil)
- $Nil
+ ($End)
+ $End
- ($Cons [k v] plist*)
- ($Cons k (|keys plist*))))
+ ($Item [k v] plist*)
+ ($Item k (|keys plist*))))
(defn |vals [plist]
(|case plist
- ($Nil)
- $Nil
+ ($End)
+ $End
- ($Cons [k v] plist*)
- ($Cons v (|vals plist*))))
+ ($Item [k v] plist*)
+ ($Item v (|vals plist*))))
(defn |interpose [sep xs]
(|case xs
- ($Nil)
+ ($End)
xs
- ($Cons _ ($Nil))
+ ($Item _ ($End))
xs
- ($Cons x xs*)
- ($Cons x ($Cons sep (|interpose sep xs*)))))
+ ($Item x xs*)
+ ($Item x ($Item sep (|interpose sep xs*)))))
(do-template [<name> <joiner>]
(defn <name> [f xs]
(|case xs
- ($Nil)
+ ($End)
(return xs)
- ($Cons x xs*)
+ ($Item x xs*)
(|do [y (f x)
ys (<name> f xs*)]
(return (<joiner> y ys)))))
- map% $Cons
+ map% $Item
flat-map% |++)
(defn list-join [xss]
- (fold |++ $Nil xss))
+ (fold |++ $End xss))
(defn |as-pairs [xs]
(|case xs
- ($Cons x ($Cons y xs*))
- ($Cons (T [x y]) (|as-pairs xs*))
+ ($Item x ($Item y xs*))
+ ($Item (T [x y]) (|as-pairs xs*))
_
- $Nil))
+ $End))
(defn |reverse [xs]
(fold (fn [tail head]
- ($Cons head tail))
- $Nil
+ ($Item head tail))
+ $End
xs))
(defn add-loc [meta ^String msg]
@@ -607,17 +608,17 @@
(defn try-all% [monads]
(|case monads
- ($Nil)
+ ($End)
(fail "[Error] There are no alternatives to try!")
- ($Cons m monads*)
+ ($Item m monads*)
(fn [state]
(let [output (m state)]
(|case [output monads*]
[($Right _) _]
output
- [_ ($Nil)]
+ [_ ($End)]
output
[_ _]
@@ -627,17 +628,17 @@
(defn try-all-% [prefix monads]
(|case monads
- ($Nil)
+ ($End)
(fail "[Error] There are no alternatives to try!")
- ($Cons m monads*)
+ ($Item m monads*)
(fn [state]
(let [output (m state)]
(|case [output monads*]
[($Right _) _]
output
- [_ ($Nil)]
+ [_ ($End)]
output
[($Left ^String error) _]
@@ -662,10 +663,10 @@
"(All [a b] (-> (-> a (Maybe b)) (List a) (Maybe b)))"
[f xs]
(|case xs
- ($Nil)
+ ($End)
$None
- ($Cons x xs*)
+ ($Item x xs*)
(|case (f x)
($None) (|some f xs*)
output output)
@@ -719,7 +720,7 @@
(defn env [name old-name]
(T [;; name
- ($Cons name old-name)
+ ($Item name old-name)
;; inner
0
;; locals
@@ -792,7 +793,7 @@
(with-jvm-host-slot $type-env (partial |++ type-env) body))
(defn push-dummy-name [real-name store-name]
- (change-jvm-host-slot $dummy-mappings (partial $Cons (T [real-name store-name]))))
+ (change-jvm-host-slot $dummy-mappings (partial $Item (T [real-name store-name]))))
(def pop-dummy-name
(change-jvm-host-slot $dummy-mappings |tail))
@@ -823,7 +824,7 @@
(T [;; "lux;info"
(default-info name mode)
;; "lux;source"
- $Nil
+ $End
;; "lux;location"
(T ["" -1 -1])
;; "current-module"
@@ -831,7 +832,7 @@
;; "lux;modules"
(|table)
;; "lux;scopes"
- $Nil
+ $End
;; "lux;type-context"
+init-type-context+
;; "lux;expected"
@@ -839,9 +840,11 @@
;; "lux;seed"
0
;; scope-type-vars
- $Nil
+ $End
;; extensions
- nil
+ "" ;; This is an invalid value. But I don't expect extensions to be used with the bootstrapping compiler.
+ ;; eval
+ "" ;; This is an invalid value. But I don't expect eval to be used with the bootstrapping compiler.
;; "lux;host"
host-data]
))
@@ -903,21 +906,21 @@
(defn ->seq [xs]
(|case xs
- ($Nil)
+ ($End)
(list)
- ($Cons x xs*)
+ ($Item x xs*)
(cons x (->seq xs*))))
(defn ->list [seq]
(if (empty? seq)
- $Nil
- ($Cons (first seq) (->list (rest seq)))))
+ $End
+ ($Item (first seq) (->list (rest seq)))))
(defn |repeat [n x]
(if (> n 0)
- ($Cons x (|repeat (dec n) x))
- $Nil))
+ ($Item x (|repeat (dec n) x))
+ $End))
(def get-module-name
(fn [state]
@@ -946,7 +949,7 @@
(defn with-scope [name body]
(fn [state]
(let [old-name (->> state (get$ $scopes) |head (get$ $name))
- output (body (update$ $scopes #($Cons (env name old-name) %) state))]
+ output (body (update$ $scopes #($Item (env name old-name) %) state))]
(|case output
($Right state* datum)
(return* (update$ $scopes |tail state*) datum)
@@ -962,7 +965,7 @@
(return (->> top (get$ $inner) str)))]
(fn [state]
(let [body* (with-scope closure-name body)]
- (run-state body* (update$ $scopes #($Cons (update$ $inner inc (|head %))
+ (run-state body* (update$ $scopes #($Item (update$ $inner inc (|head %))
(|tail %))
state))))))
@@ -974,10 +977,10 @@
(defn |last [xs]
(|case xs
- ($Cons x ($Nil))
+ ($Item x ($End))
x
- ($Cons x xs*)
+ ($Item x xs*)
(|last xs*)
_
@@ -1263,11 +1266,11 @@
(defn fold2% [f init xs ys]
(|case [xs ys]
- [($Cons x xs*) ($Cons y ys*)]
+ [($Item x xs*) ($Item y ys*)]
(|do [init* (f init x y)]
(fold2% f init* xs* ys*))
- [($Nil) ($Nil)]
+ [($End) ($End)]
(return init)
[_ _]
@@ -1275,32 +1278,32 @@
(defn map2% [f xs ys]
(|case [xs ys]
- [($Cons x xs*) ($Cons y ys*)]
+ [($Item x xs*) ($Item y ys*)]
(|do [z (f x y)
zs (map2% f xs* ys*)]
- (return ($Cons z zs)))
+ (return ($Item z zs)))
- [($Nil) ($Nil)]
- (return $Nil)
+ [($End) ($End)]
+ (return $End)
[_ _]
(assert false "Lists do not match in size.")))
(defn map2 [f xs ys]
(|case [xs ys]
- [($Cons x xs*) ($Cons y ys*)]
- ($Cons (f x y) (map2 f xs* ys*))
+ [($Item x xs*) ($Item y ys*)]
+ ($Item (f x y) (map2 f xs* ys*))
[_ _]
- $Nil))
+ $End))
(defn fold2 [f init xs ys]
(|case [xs ys]
- [($Cons x xs*) ($Cons y ys*)]
+ [($Item x xs*) ($Item y ys*)]
(and init
(fold2 f (f init x y) xs* ys*))
- [($Nil) ($Nil)]
+ [($End) ($End)]
init
[_ _]
@@ -1312,11 +1315,11 @@
"(All [a] (-> Int (List a) (List (, Int a))))"
[idx xs]
(|case xs
- ($Cons x xs*)
- ($Cons (T [idx x])
+ ($Item x xs*)
+ ($Item (T [idx x])
(enumerate* (inc idx) xs*))
- ($Nil)
+ ($End)
xs
))
@@ -1341,7 +1344,7 @@
"(All [a] (-> Int (List a) (Maybe a)))"
[idx xs]
(|case xs
- ($Cons x xs*)
+ ($Item x xs*)
(cond (< idx 0)
$None
@@ -1351,7 +1354,7 @@
:else ;; > 1
(|at (dec idx) xs*))
- ($Nil)
+ ($End)
$None))
(defn normalize
@@ -1370,15 +1373,15 @@
(defn |list-put [idx val xs]
(|case xs
- ($Nil)
+ ($End)
$None
- ($Cons x xs*)
+ ($Item x xs*)
(if (= idx 0)
- ($Some ($Cons val xs*))
+ ($Some ($Item val xs*))
(|case (|list-put (dec idx) val xs*)
($None) $None
- ($Some xs**) ($Some ($Cons x xs**)))
+ ($Some xs**) ($Some ($Item x xs**)))
)))
(do-template [<name> <default> <op>]
@@ -1386,10 +1389,10 @@
"(All [a] (-> (-> a Bit) (List a) Bit))"
[p xs]
(|case xs
- ($Nil)
+ ($End)
<default>
- ($Cons x xs*)
+ ($Item x xs*)
(<op> (p x) (<name> p xs*))))
|every? true and
@@ -1415,28 +1418,28 @@
(defn |take [n xs]
(|case (T [n xs])
- [0 _] $Nil
- [_ ($Nil)] $Nil
- [_ ($Cons x xs*)] ($Cons x (|take (dec n) xs*))
+ [0 _] $End
+ [_ ($End)] $End
+ [_ ($Item x xs*)] ($Item x (|take (dec n) xs*))
))
(defn |drop [n xs]
(|case (T [n xs])
[0 _] xs
- [_ ($Nil)] $Nil
- [_ ($Cons x xs*)] (|drop (dec n) xs*)
+ [_ ($End)] $End
+ [_ ($Item x xs*)] (|drop (dec n) xs*)
))
(defn |but-last [xs]
(|case xs
- ($Nil)
- $Nil
+ ($End)
+ $End
- ($Cons x ($Nil))
- $Nil
+ ($Item x ($End))
+ $End
- ($Cons x xs*)
- ($Cons x (|but-last xs*))
+ ($Item x xs*)
+ ($Item x (|but-last xs*))
_
(assert false (adt->text xs))))
@@ -1447,7 +1450,7 @@
(defn with-scope-type-var [id body]
(fn [state]
(|case (body (set$ $scope-type-vars
- ($Cons id (get$ $scope-type-vars state))
+ ($Item id (get$ $scope-type-vars state))
state))
($Right [state* output])
($Right (T [(set$ $scope-type-vars
diff --git a/lux-bootstrapper/src/lux/compiler/cache.clj b/lux-bootstrapper/src/lux/compiler/cache.clj
index 01e05c8de..bbe9e7882 100644
--- a/lux-bootstrapper/src/lux/compiler/cache.clj
+++ b/lux-bootstrapper/src/lux/compiler/cache.clj
@@ -71,7 +71,7 @@
(defn ^:private parse-tag-groups [^String tags-section]
(if (= "" tags-section)
- &/$Nil
+ &/$End
(-> tags-section
(.split &&core/entry-separator)
seq
@@ -131,7 +131,7 @@
(|do [^String descriptor (&&core/read-module-descriptor! module-name)
:let [imports (let [imports (vec (.split ^String _imports-section &&core/entry-separator))
imports (if (= [""] imports)
- &/$Nil
+ &/$End
(&/->list imports))]
(&/|map #(first (vec (.split ^String % &&core/datum-separator 2))) imports))]
cache-table* (&/fold% (fn [cache-table* _module]
@@ -150,7 +150,7 @@
[(&/$Some module-anns) _]))
def-entries (let [def-entries (vec (.split ^String _defs-section &&core/entry-separator))]
(if (= [""] def-entries)
- &/$Nil
+ &/$End
(&/->list def-entries)))]
(|do [_ (install-all-defs-in-module module-name)
_ (install-module load-def-value module-name module-hash
diff --git a/lux-bootstrapper/src/lux/compiler/cache/ann.clj b/lux-bootstrapper/src/lux/compiler/cache/ann.clj
index 4c08af276..9d5a8e97f 100644
--- a/lux-bootstrapper/src/lux/compiler/cache/ann.clj
+++ b/lux-bootstrapper/src/lux/compiler/cache/ann.clj
@@ -96,12 +96,12 @@
(defn ^:private deserialize-seq [deserializer ^String input]
(cond (.startsWith input nil-signal)
- [&/$Nil (.substring input 1)]
+ [&/$End (.substring input 1)]
(.startsWith input cons-signal)
(when-let [[head ^String input*] (deserializer (.substring input 1))]
(when-let [[tail ^String input*] (deserialize-seq deserializer input*)]
- [(&/$Cons head tail) input*]))
+ [(&/$Item head tail) input*]))
))
(defn ^:private deserialize-kv [input]
diff --git a/lux-bootstrapper/src/lux/compiler/cache/type.clj b/lux-bootstrapper/src/lux/compiler/cache/type.clj
index 7c622d2c4..f4d33edc1 100644
--- a/lux-bootstrapper/src/lux/compiler/cache/type.clj
+++ b/lux-bootstrapper/src/lux/compiler/cache/type.clj
@@ -64,12 +64,12 @@
(defn ^:private deserialize-list [^String input]
(cond (.startsWith input nil-signal)
- [&/$Nil (.substring input 1)]
+ [&/$End (.substring input 1)]
(.startsWith input cons-signal)
(when-let [[head ^String input*] (deserialize-type (.substring input 1))]
(when-let [[tail ^String input*] (deserialize-list input*)]
- [(&/$Cons head tail) input*]))
+ [(&/$Item head tail) input*]))
))
(defn ^:private deserialize-type* [^String input]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm.clj b/lux-bootstrapper/src/lux/compiler/jvm.clj
index e2521fec7..d5c490a97 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm.clj
@@ -200,7 +200,8 @@
(&/set$ &/$source (&reader/from name file-content) state))
(&/$Right ?state _)
(&/run-state (|do [:let [_ (.visitEnd =class)]
- _ (save-module! name file-hash (.toByteArray =class))]
+ _ (save-module! name file-hash (.toByteArray =class))
+ :let [_ (println 'MODULE name)]]
(return file-hash))
?state)
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
index f5fa88e02..973d0e8c6 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
@@ -337,7 +337,7 @@
$end (new Label)
_ (doto main-writer
;; Tail: Begin
- (.visitLdcInsn (->> #'&/$Nil meta ::&/idx int)) ;; I
+ (.visitLdcInsn (->> #'&/$End meta ::&/idx int)) ;; I
(.visitInsn Opcodes/ACONST_NULL) ;; I?
(.visitLdcInsn &/unit-tag) ;; I?U
(.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; V
@@ -375,13 +375,13 @@
(.visitInsn Opcodes/SWAP) ;; I22IV
(.visitInsn Opcodes/AASTORE) ;; I2
;; Tuple: End
- ;; Cons: Begin
- (.visitLdcInsn (->> #'&/$Cons meta ::&/idx int)) ;; I2I
+ ;; Item: Begin
+ (.visitLdcInsn (->> #'&/$Item meta ::&/idx int)) ;; I2I
(.visitLdcInsn "") ;; I2I?
(.visitInsn Opcodes/DUP2_X1) ;; II?2I?
(.visitInsn Opcodes/POP2) ;; II?2
(.visitMethodInsn Opcodes/INVOKESTATIC &rt/rt-class "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;") ;; IV
- ;; Cons: End
+ ;; Item: End
(.visitInsn Opcodes/SWAP) ;; VI
(.visitJumpInsn Opcodes/GOTO $loop)
;; Loop: End
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
index cd1b77dee..642bd3427 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
@@ -25,7 +25,7 @@
;; [Resources]
(do-template [<name> <op>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?input (&/$Cons ?mask (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?input (&/$Item ?mask (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?input)
:let [_ (&&/unwrap-long *writer*)]
@@ -43,7 +43,7 @@
(do-template [<op> <name>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?input (&/$Cons ?shift (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?input (&/$Item ?shift (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?input)
:let [_ (&&/unwrap-long *writer*)]
@@ -61,7 +61,7 @@
)
(defn ^:private compile-lux-is [compile ?values special-args]
- (|do [:let [(&/$Cons ?left (&/$Cons ?right (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?left (&/$Item ?right (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?left)
_ (compile ?right)
@@ -78,7 +78,7 @@
(return nil)))
(defn ^:private compile-lux-try [compile ?values special-args]
- (|do [:let [(&/$Cons ?op (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?op (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?op)
:let [_ (doto *writer*
@@ -88,7 +88,7 @@
(do-template [<name> <opcode> <unwrap> <wrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -117,7 +117,7 @@
(do-template [<name> <cmpcode> <cmp-output> <unwrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -147,7 +147,7 @@
)
(defn ^:private compile-frac-encode [compile ?values special-args]
- (|do [:let [(&/$Cons ?input (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?input (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?input)
:let [_ (doto *writer*
@@ -156,7 +156,7 @@
(return nil)))
(defn ^:private compile-frac-decode [compile ?values special-args]
- (|do [:let [(&/$Cons ?input (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?input (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?input)
:let [_ (doto *writer*
@@ -165,7 +165,7 @@
(return nil)))
(defn ^:private compile-int-char [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?x (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -177,7 +177,7 @@
(do-template [<name> <unwrap> <op> <wrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?input (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?input (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?input)
:let [_ (doto *writer*
@@ -191,7 +191,7 @@
)
(defn ^:private compile-text-eq [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
_ (compile ?y)
@@ -201,7 +201,7 @@
(return nil)))
(defn ^:private compile-text-lt [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -222,7 +222,7 @@
(return nil)))
(defn compile-text-concat [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -235,7 +235,7 @@
(return nil)))
(defn compile-text-clip [compile ?values special-args]
- (|do [:let [(&/$Cons ?text (&/$Cons ?offset (&/$Cons ?length (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item ?text (&/$Item ?offset (&/$Item ?length (&/$End)))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?text)
:let [_ (doto *writer*
@@ -255,7 +255,7 @@
(return nil)))
(defn ^:private compile-text-index [compile ?values special-args]
- (|do [:let [(&/$Cons ?text (&/$Cons ?part (&/$Cons ?start (&/$Nil)))) ?values]
+ (|do [:let [(&/$Item ?text (&/$Item ?part (&/$Item ?start (&/$End)))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?text)
:let [_ (doto *writer*
@@ -287,7 +287,7 @@
(do-template [<name> <class> <method>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?text (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?text (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?text)
:let [_ (doto *writer*
@@ -301,7 +301,7 @@
)
(defn ^:private compile-text-char [compile ?values special-args]
- (|do [:let [(&/$Cons ?text (&/$Cons ?idx (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?text (&/$Item ?idx (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?text)
:let [_ (doto *writer*
@@ -316,7 +316,7 @@
(return nil)))
(defn ^:private compile-io-log [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?x (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
:let [_ (doto *writer*
(.visitFieldInsn Opcodes/GETSTATIC "java/lang/System" "out" "Ljava/io/PrintStream;"))]
@@ -327,7 +327,7 @@
(return nil)))
(defn ^:private compile-io-error [compile ?values special-args]
- (|do [:let [(&/$Cons ?message (&/$Nil)) ?values]
+ (|do [:let [(&/$Item ?message (&/$End)) ?values]
^MethodVisitor *writer* &/get-writer
:let [_ (doto *writer*
(.visitTypeInsn Opcodes/NEW "java/lang/Error")
@@ -340,7 +340,7 @@
(return nil)))
(defn ^:private compile-io-current-time [compile ?values special-args]
- (|do [:let [(&/$Nil) ?values]
+ (|do [:let [(&/$End) ?values]
^MethodVisitor *writer* &/get-writer
:let [_ (doto *writer*
(.visitMethodInsn Opcodes/INVOKESTATIC "java/lang/System" "currentTimeMillis" "()J")
@@ -348,7 +348,7 @@
(return nil)))
(defn ^:private compile-syntax-char-case! [compile ?values ?patterns]
- (|do [:let [(&/$Cons ?input (&/$Cons ?else ?matches)) ?values]
+ (|do [:let [(&/$Item ?input (&/$Item ?else ?matches)) ?values]
^MethodVisitor *writer* &/get-writer
:let [pattern-labels (&/|map (fn [_] (new Label)) ?patterns)
matched-patterns (&/fold (fn [matches chars+label]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj
index a1039f0b3..a455be83a 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/host.clj
@@ -50,28 +50,28 @@
(if (&type/type= &type/Any *type*)
(.visitLdcInsn *writer* &/unit-tag)
(|case *type*
- (&/$Primitive "boolean" (&/$Nil))
+ (&/$Primitive "boolean" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name boolean-class) "valueOf" (str "(Z)" (&host-generics/->type-signature boolean-class)))
- (&/$Primitive "byte" (&/$Nil))
+ (&/$Primitive "byte" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name byte-class) "valueOf" (str "(B)" (&host-generics/->type-signature byte-class)))
- (&/$Primitive "short" (&/$Nil))
+ (&/$Primitive "short" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name short-class) "valueOf" (str "(S)" (&host-generics/->type-signature short-class)))
- (&/$Primitive "int" (&/$Nil))
+ (&/$Primitive "int" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name int-class) "valueOf" (str "(I)" (&host-generics/->type-signature int-class)))
- (&/$Primitive "long" (&/$Nil))
+ (&/$Primitive "long" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name long-class) "valueOf" (str "(J)" (&host-generics/->type-signature long-class)))
- (&/$Primitive "float" (&/$Nil))
+ (&/$Primitive "float" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name float-class) "valueOf" (str "(F)" (&host-generics/->type-signature float-class)))
- (&/$Primitive "double" (&/$Nil))
+ (&/$Primitive "double" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name double-class) "valueOf" (str "(D)" (&host-generics/->type-signature double-class)))
- (&/$Primitive "char" (&/$Nil))
+ (&/$Primitive "char" (&/$End))
(.visitMethodInsn *writer* Opcodes/INVOKESTATIC (&host-generics/->bytecode-class-name char-class) "valueOf" (str "(C)" (&host-generics/->type-signature char-class)))
(&/$Primitive _ _)
@@ -122,45 +122,45 @@
(defn ^:private compile-method-return [^MethodVisitor writer output]
(|case output
- (&/$GenericClass "void" (&/$Nil))
+ (&/$GenericClass "void" (&/$End))
(.visitInsn writer Opcodes/RETURN)
- (&/$GenericClass "boolean" (&/$Nil))
+ (&/$GenericClass "boolean" (&/$End))
(doto writer
&&/unwrap-boolean
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "byte" (&/$Nil))
+ (&/$GenericClass "byte" (&/$End))
(doto writer
&&/unwrap-byte
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "short" (&/$Nil))
+ (&/$GenericClass "short" (&/$End))
(doto writer
&&/unwrap-short
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "int" (&/$Nil))
+ (&/$GenericClass "int" (&/$End))
(doto writer
&&/unwrap-int
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "long" (&/$Nil))
+ (&/$GenericClass "long" (&/$End))
(doto writer
&&/unwrap-long
(.visitInsn Opcodes/LRETURN))
- (&/$GenericClass "float" (&/$Nil))
+ (&/$GenericClass "float" (&/$End))
(doto writer
&&/unwrap-float
(.visitInsn Opcodes/FRETURN))
- (&/$GenericClass "double" (&/$Nil))
+ (&/$GenericClass "double" (&/$End))
(doto writer
&&/unwrap-double
(.visitInsn Opcodes/DRETURN))
- (&/$GenericClass "char" (&/$Nil))
+ (&/$GenericClass "char" (&/$End))
(doto writer
&&/unwrap-char
(.visitInsn Opcodes/IRETURN))
@@ -230,15 +230,15 @@
"(-> Int (List GenericClass) MethodVisitor (Lux (List FrameTag)))"
[idx inputs method-visitor]
(|case inputs
- (&/$Nil)
- (return &/$Nil)
+ (&/$End)
+ (return &/$End)
- (&/$Cons input inputs*)
+ (&/$Item input inputs*)
(|do [[_ outputs*] (&/fold% (fn [idx+outputs input]
(|do [:let [[_idx _outputs] idx+outputs]
[idx* output] (prepare-method-input _idx input method-visitor)]
- (return (&/T [idx* (&/$Cons output _outputs)]))))
- (&/T [idx &/$Nil])
+ (return (&/T [idx* (&/$Item output _outputs)]))))
+ (&/T [idx &/$End])
inputs)]
(return (&/list-join (&/|reverse outputs*))))
))
@@ -445,7 +445,7 @@
"(-> (List FieldAnalysis) (List [Text GenericClass Analysis]))"
[fields]
(&/fold &/|++
- &/$Nil
+ &/$End
(&/|map (fn [field]
(|case field
(&/$ConstantFieldSyntax ?name ?anns ?gclass ?value)
@@ -461,7 +461,7 @@
(|do [module &/get-module-name
[file-name line column] &/location
:let [[?name ?params] class-decl
- class-signature (&host-generics/gclass-decl->signature class-decl (&/$Cons ?super-class ?interfaces))
+ class-signature (&host-generics/gclass-decl->signature class-decl (&/$Item ?super-class ?interfaces))
full-name (str module "/" ?name)
super-class* (&host-generics/->bytecode-class-name (&host-generics/super-class-name ?super-class))
=class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
@@ -513,7 +513,7 @@
(do-template [<name> <op> <unwrap> <wrap>]
(defn <name> [compile _?value special-args]
- (|do [:let [(&/$Cons ?value (&/$Nil)) _?value]
+ (|do [:let [(&/$Item ?value (&/$End)) _?value]
^MethodVisitor *writer* &/get-writer
_ (compile ?value)
:let [_ (doto *writer*
@@ -553,7 +553,7 @@
(do-template [<name> <op> <wrap>]
(defn <name> [compile _?value special-args]
- (|do [:let [(&/$Cons ?value (&/$Nil)) _?value]
+ (|do [:let [(&/$Item ?value (&/$End)) _?value]
^MethodVisitor *writer* &/get-writer
_ (compile ?value)
:let [_ (doto *writer*
@@ -569,7 +569,7 @@
(do-template [<name> <op> <unwrap-left> <unwrap-right> <wrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -599,7 +599,7 @@
(do-template [<name> <opcode> <unwrap> <wrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -639,7 +639,7 @@
(do-template [<name> <opcode> <unwrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -669,7 +669,7 @@
(do-template [<name> <cmpcode> <cmp-output> <unwrap>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?x (&/$Cons ?y (&/$Nil))) ?values]
+ (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
^MethodVisitor *writer* &/get-writer
_ (compile ?x)
:let [_ (doto *writer*
@@ -705,8 +705,8 @@
(do-template [<prim-type> <array-type> <new-name> <load-name> <load-op> <store-name> <store-op> <wrapper> <unwrapper>]
(do (defn <new-name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?length (&/$Nil)) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?length (&/$End)) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
_ (compile ?length)
@@ -717,8 +717,8 @@
(return nil)))
(defn <load-name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?array (&/$Cons ?idx (&/$Nil))) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?array (&/$Item ?idx (&/$End))) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
_ (compile ?array)
@@ -733,8 +733,8 @@
(return nil)))
(defn <store-name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?array (&/$Cons ?idx (&/$Cons ?elem (&/$Nil)))) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?array (&/$Item ?idx (&/$Item ?elem (&/$End)))) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
_ (compile ?array)
@@ -762,8 +762,8 @@
)
(defn ^:private compile-jvm-anewarray [compile ?values special-args]
- (|do [:let [(&/$Cons ?length (&/$Nil)) ?values
- (&/$Cons ?gclass (&/$Cons type-env (&/$Nil))) special-args]
+ (|do [:let [(&/$Item ?length (&/$End)) ?values
+ (&/$Item ?gclass (&/$Item type-env (&/$End))) special-args]
^MethodVisitor *writer* &/get-writer
_ (compile ?length)
:let [_ (doto *writer*
@@ -773,8 +773,8 @@
(return nil)))
(defn ^:private compile-jvm-aaload [compile ?values special-args]
- (|do [:let [(&/$Cons ?array (&/$Cons ?idx (&/$Nil))) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?array (&/$Item ?idx (&/$End))) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
array-type (&host/->java-sig (&a/expr-type* ?array))
@@ -788,8 +788,8 @@
(return nil)))
(defn ^:private compile-jvm-aastore [compile ?values special-args]
- (|do [:let [(&/$Cons ?array (&/$Cons ?idx (&/$Cons ?elem (&/$Nil)))) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?array (&/$Item ?idx (&/$Item ?elem (&/$End)))) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
array-type (&host/->java-sig (&a/expr-type* ?array))
@@ -805,8 +805,8 @@
(return nil)))
(defn ^:private compile-jvm-arraylength [compile ?values special-args]
- (|do [:let [(&/$Cons ?array (&/$Nil)) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?array (&/$End)) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
array-type (&host/->java-sig (&a/expr-type* ?array))
@@ -819,15 +819,15 @@
(return nil)))
(defn ^:private compile-jvm-object-null [compile ?values special-args]
- (|do [:let [;; (&/$Nil) ?values
- (&/$Nil) special-args]
+ (|do [:let [;; (&/$End) ?values
+ (&/$End) special-args]
^MethodVisitor *writer* &/get-writer
:let [_ (.visitInsn *writer* Opcodes/ACONST_NULL)]]
(return nil)))
(defn ^:private compile-jvm-object-null? [compile ?values special-args]
- (|do [:let [(&/$Cons ?object (&/$Nil)) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?object (&/$End)) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
_ (compile ?object)
@@ -843,8 +843,8 @@
(return nil)))
(defn compile-jvm-object-synchronized [compile ?values special-args]
- (|do [:let [(&/$Cons ?monitor (&/$Cons ?expr (&/$Nil))) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?monitor (&/$Item ?expr (&/$End))) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
_ (compile ?monitor)
@@ -858,8 +858,8 @@
(return nil)))
(defn ^:private compile-jvm-throw [compile ?values special-args]
- (|do [:let [(&/$Cons ?ex (&/$Nil)) ?values
- ;; (&/$Nil) special-args
+ (|do [:let [(&/$Item ?ex (&/$End)) ?values
+ ;; (&/$End) special-args
]
^MethodVisitor *writer* &/get-writer
_ (compile ?ex)
@@ -867,8 +867,8 @@
(return nil)))
(defn ^:private compile-jvm-getstatic [compile ?values special-args]
- (|do [:let [;; (&/$Nil) ?values
- (&/$Cons ?class (&/$Cons ?field (&/$Cons ?output-type (&/$Nil)))) special-args]
+ (|do [:let [;; (&/$End) ?values
+ (&/$Item ?class (&/$Item ?field (&/$Item ?output-type (&/$End)))) special-args]
^MethodVisitor *writer* &/get-writer
=output-type (&host/->java-sig ?output-type)
:let [_ (doto *writer*
@@ -877,8 +877,8 @@
(return nil)))
(defn ^:private compile-jvm-getfield [compile ?values special-args]
- (|do [:let [(&/$Cons ?object (&/$Nil)) ?values
- (&/$Cons ?class (&/$Cons ?field (&/$Cons ?output-type (&/$Nil)))) special-args]
+ (|do [:let [(&/$Item ?object (&/$End)) ?values
+ (&/$Item ?class (&/$Item ?field (&/$Item ?output-type (&/$End)))) special-args]
:let [class* (&host-generics/->bytecode-class-name (&host-type/as-obj ?class))]
^MethodVisitor *writer* &/get-writer
_ (compile ?object)
@@ -890,8 +890,8 @@
(return nil)))
(defn ^:private compile-jvm-putstatic [compile ?values special-args]
- (|do [:let [(&/$Cons ?value (&/$Nil)) ?values
- (&/$Cons ?class (&/$Cons ?field (&/$Cons input-gclass (&/$Nil)))) special-args]
+ (|do [:let [(&/$Item ?value (&/$End)) ?values
+ (&/$Item ?class (&/$Item ?field (&/$Item input-gclass (&/$End)))) special-args]
^MethodVisitor *writer* &/get-writer
_ (compile ?value)
:let [=input-sig (&host-type/gclass->sig input-gclass)
@@ -902,8 +902,8 @@
(return nil)))
(defn ^:private compile-jvm-putfield [compile ?values special-args]
- (|do [:let [(&/$Cons ?object (&/$Cons ?value (&/$Nil))) ?values
- (&/$Cons ?class (&/$Cons ?field (&/$Cons input-gclass (&/$Cons ?input-type (&/$Nil))))) special-args]
+ (|do [:let [(&/$Item ?object (&/$Item ?value (&/$End))) ?values
+ (&/$Item ?class (&/$Item ?field (&/$Item input-gclass (&/$Item ?input-type (&/$End))))) special-args]
:let [class* (&host-generics/->bytecode-class-name (&host-type/as-obj ?class))]
^MethodVisitor *writer* &/get-writer
_ (compile ?object)
@@ -918,7 +918,7 @@
(defn ^:private compile-jvm-invokestatic [compile ?values special-args]
(|do [:let [?args ?values
- (&/$Cons ?class (&/$Cons ?method (&/$Cons ?classes (&/$Cons ?output-type (&/$Cons ?gret (&/$Nil)))))) special-args]
+ (&/$Item ?class (&/$Item ?method (&/$Item ?classes (&/$Item ?output-type (&/$Item ?gret (&/$End)))))) special-args]
^MethodVisitor *writer* &/get-writer
:let [method-sig (str "(" (&/fold str "" (&/|map &host-generics/->type-signature ?classes)) ")" (&host-type/principal-class ?gret))]
_ (&/map2% (fn [class-name arg]
@@ -933,8 +933,8 @@
(do-template [<name> <op>]
(defn <name> [compile ?values special-args]
- (|do [:let [(&/$Cons ?object ?args) ?values
- (&/$Cons ?class (&/$Cons ?method (&/$Cons ?classes (&/$Cons ?output-type (&/$Cons ?gret (&/$Nil)))))) special-args]
+ (|do [:let [(&/$Item ?object ?args) ?values
+ (&/$Item ?class (&/$Item ?method (&/$Item ?classes (&/$Item ?output-type (&/$Item ?gret (&/$End)))))) special-args]
:let [?class* (&host-generics/->bytecode-class-name (&host-type/as-obj ?class))]
^MethodVisitor *writer* &/get-writer
:let [method-sig (str "(" (&/fold str "" (&/|map &host-generics/->type-signature ?classes)) ")" (&host-type/principal-class ?gret))]
@@ -958,7 +958,7 @@
(defn ^:private compile-jvm-new [compile ?values special-args]
(|do [:let [?args ?values
- (&/$Cons ?class (&/$Cons ?classes (&/$Nil))) special-args]
+ (&/$Item ?class (&/$Item ?classes (&/$End))) special-args]
^MethodVisitor *writer* &/get-writer
:let [init-sig (str "(" (&/fold str "" (&/|map &host-generics/->type-signature ?classes)) ")V")
class* (&host-generics/->bytecode-class-name ?class)
@@ -976,7 +976,7 @@
(return nil)))
(defn ^:private compile-jvm-object-class [compile ?values special-args]
- (|do [:let [(&/$Cons _class-name (&/$Cons ?output-type (&/$Nil))) special-args]
+ (|do [:let [(&/$Item _class-name (&/$Item ?output-type (&/$End))) special-args]
^MethodVisitor *writer* &/get-writer
:let [_ (doto *writer*
(.visitLdcInsn _class-name)
@@ -985,8 +985,8 @@
(return nil)))
(defn ^:private compile-jvm-instanceof [compile ?values special-args]
- (|do [:let [(&/$Cons object (&/$Nil)) ?values
- (&/$Cons class (&/$Nil)) special-args]
+ (|do [:let [(&/$Item object (&/$End)) ?values
+ (&/$Item class (&/$End)) special-args]
:let [class* (&host-generics/->bytecode-class-name class)]
^MethodVisitor *writer* &/get-writer
_ (compile object)
diff --git a/lux-bootstrapper/src/lux/host.clj b/lux-bootstrapper/src/lux/host.clj
index eb1bcb41c..4d49a6262 100644
--- a/lux-bootstrapper/src/lux/host.clj
+++ b/lux-bootstrapper/src/lux/host.clj
@@ -42,7 +42,7 @@
"(-> Type (, Int Type))"
[type]
(|case type
- (&/$Primitive "#Array" (&/$Cons param (&/$Nil)))
+ (&/$Primitive "#Array" (&/$Item param (&/$End)))
(|let [[count inner] (unfold-array param)]
(&/T [(inc count) inner]))
@@ -170,7 +170,7 @@
(str (&/normalize-name name) "_" (Long/toUnsignedString (hash name))))
(defn location [scope]
- (let [scope (&/$Cons (def-name (&/|head scope))
+ (let [scope (&/$Item (def-name (&/|head scope))
(&/|map &/normalize-name (&/|tail scope)))]
(->> scope
(&/|interpose "$")
@@ -185,35 +185,35 @@
(defn dummy-value [^MethodVisitor writer class]
(|case class
- (&/$GenericClass "boolean" (&/$Nil))
+ (&/$GenericClass "boolean" (&/$End))
(doto writer
(.visitLdcInsn false))
- (&/$GenericClass "byte" (&/$Nil))
+ (&/$GenericClass "byte" (&/$End))
(doto writer
(.visitLdcInsn (byte 0)))
- (&/$GenericClass "short" (&/$Nil))
+ (&/$GenericClass "short" (&/$End))
(doto writer
(.visitLdcInsn (short 0)))
- (&/$GenericClass "int" (&/$Nil))
+ (&/$GenericClass "int" (&/$End))
(doto writer
(.visitLdcInsn (int 0)))
- (&/$GenericClass "long" (&/$Nil))
+ (&/$GenericClass "long" (&/$End))
(doto writer
(.visitLdcInsn (long 0)))
- (&/$GenericClass "float" (&/$Nil))
+ (&/$GenericClass "float" (&/$End))
(doto writer
(.visitLdcInsn (float 0.0)))
- (&/$GenericClass "double" (&/$Nil))
+ (&/$GenericClass "double" (&/$End))
(doto writer
(.visitLdcInsn (double 0.0)))
- (&/$GenericClass "char" (&/$Nil))
+ (&/$GenericClass "char" (&/$End))
(doto writer
(.visitLdcInsn (char 0)))
@@ -223,45 +223,45 @@
(defn ^:private dummy-return [^MethodVisitor writer output]
(|case output
- (&/$GenericClass "void" (&/$Nil))
+ (&/$GenericClass "void" (&/$End))
(.visitInsn writer Opcodes/RETURN)
- (&/$GenericClass "boolean" (&/$Nil))
+ (&/$GenericClass "boolean" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "byte" (&/$Nil))
+ (&/$GenericClass "byte" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "short" (&/$Nil))
+ (&/$GenericClass "short" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "int" (&/$Nil))
+ (&/$GenericClass "int" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass "long" (&/$Nil))
+ (&/$GenericClass "long" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/LRETURN))
- (&/$GenericClass "float" (&/$Nil))
+ (&/$GenericClass "float" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/FRETURN))
- (&/$GenericClass "double" (&/$Nil))
+ (&/$GenericClass "double" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/DRETURN))
- (&/$GenericClass "char" (&/$Nil))
+ (&/$GenericClass "char" (&/$End))
(doto writer
(dummy-value output)
(.visitInsn Opcodes/IRETURN))
@@ -443,7 +443,7 @@
dummy-full-name (str module "/" dummy-name)
real-name (str (&host-generics/->class-name module) "." ?name)
store-name (str (&host-generics/->class-name module) "." dummy-name)
- class-signature (&host-generics/gclass-decl->signature class-decl (&/$Cons super-class interfaces))
+ class-signature (&host-generics/gclass-decl->signature class-decl (&/$Item super-class interfaces))
=class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
(.visit bytecode-version (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER)
dummy-full-name
diff --git a/lux-bootstrapper/src/lux/host/generics.clj b/lux-bootstrapper/src/lux/host/generics.clj
index 58986c100..a1795bb18 100644
--- a/lux-bootstrapper/src/lux/host/generics.clj
+++ b/lux-bootstrapper/src/lux/host/generics.clj
@@ -46,7 +46,7 @@
(defn formal-type-parameter->signature [param]
(|let [[pname pbounds] param]
(|case pbounds
- (&/$Nil)
+ (&/$End)
pname
_
diff --git a/lux-bootstrapper/src/lux/optimizer.clj b/lux-bootstrapper/src/lux/optimizer.clj
index c8c8af02f..5910d98db 100644
--- a/lux-bootstrapper/src/lux/optimizer.clj
+++ b/lux-bootstrapper/src/lux/optimizer.clj
@@ -209,12 +209,12 @@
(|case _sub-tests
;; An empty tuple corresponds to unit, which cannot be tested in
;; any meaningful way, so it's just popped.
- (&/$Nil)
+ (&/$End)
(&/|list $PopPM)
;; A tuple of a single element is equivalent to the element
;; itself, to the element's PM is generated.
- (&/$Cons _only-test (&/$Nil))
+ (&/$Item _only-test (&/$End))
(transform-pm* _only-test)
;; Single tuple PM features the tests of each tuple member
@@ -227,7 +227,7 @@
(|let [tuple-size (&/|length _sub-tests)]
(&/|++ (&/flat-map (fn [idx+test*]
(|let [[idx test*] idx+test*]
- (&/$Cons ($TuplePM (if (< idx (dec tuple-size))
+ (&/$Item ($TuplePM (if (< idx (dec tuple-size))
(&/$Left idx)
(&/$Right idx)))
(transform-pm* test*))))
@@ -246,7 +246,7 @@
;; This function cleans them all up, to avoid wasteful computation later.
(defn ^:private clean-unnecessary-pops [steps]
(|case steps
- (&/$Cons ($PopPM) _steps)
+ (&/$Item ($PopPM) _steps)
(clean-unnecessary-pops _steps)
_
@@ -442,14 +442,14 @@
;; For example: (2 3 4 5 6 7 8), instead of (8 7 6 5 4 3 2)
(defn ^:private adjust-register-indexes* [offset var-table]
(|case var-table
- (&/$Nil)
+ (&/$End)
(&/|list)
- (&/$Cons [_idx _used?] _tail)
+ (&/$Item [_idx _used?] _tail)
(if _used?
- (&/$Cons (&/T [_idx (- _idx offset)])
+ (&/$Item (&/T [_idx (- _idx offset)])
(adjust-register-indexes* offset _tail))
- (&/$Cons (&/T [_idx -1])
+ (&/$Item (&/T [_idx -1])
(adjust-register-indexes* (inc offset) _tail))
)))
@@ -576,10 +576,10 @@
pms (&/|map &/|first pms+bodies)
bodies (&/|map &/|second pms+bodies)]
(|case (&/|reverse pms)
- (&/$Nil)
+ (&/$End)
(assert false)
- (&/$Cons _head-pm _tail-pms)
+ (&/$Item _head-pm _tail-pms)
(&/T [(&/fold fuse-pms _head-pm _tail-pms)
bodies])
)))
@@ -679,7 +679,7 @@
($apply [meta-0 ($var (&/$Local 0))] args)
(if own-body?
(&/T [meta ($apply (&/T [meta-0 ($var (&/$Local 0))])
- (&/$Cons (&/T [meta-0 ($var (&/$Local 1))])
+ (&/$Item (&/T [meta-0 ($var (&/$Local 1))])
(&/|map (partial shift-function-body old-scope new-scope own-body?) args)))])
(&/T [meta ($apply (&/T [meta-0 ($var (&/$Local 0))])
(&/|map (partial shift-function-body old-scope new-scope own-body?) args))]))
@@ -692,7 +692,7 @@
(if own-body?
source
(|case scope
- (&/$Cons _ (&/$Cons _ (&/$Nil)))
+ (&/$Item _ (&/$Item _ (&/$End)))
source
_
@@ -750,10 +750,10 @@
(loop [current-idx 0
pms pms]
(|case pms
- (&/$Nil)
+ (&/$End)
&/$None
- (&/$Cons _pm _pms)
+ (&/$Item _pm _pms)
(|case _pm
(&a-case/$NoTestAC)
(recur (inc current-idx)
@@ -768,7 +768,7 @@
(&a-case/$TupleTestAC _sub-tests)
(let [sub-path (record-read-path _sub-tests member-idx)]
(if (not (&/|empty? sub-path))
- (&/$Cons (&/T [current-idx (&/|empty? _pms)]) sub-path)
+ (&/$Item (&/T [current-idx (&/|empty? _pms)]) sub-path)
(recur (inc current-idx)
_pms)
))
@@ -813,10 +813,10 @@
($ann _value-expr _type-expr)
(&/T [meta ($ann (optimize-iter arity _value-expr) _type-expr)])
- ($proc ["lux" "syntax char case!"] (&/$Cons ?input (&/$Cons ?else ?matches)) ?special-args)
+ ($proc ["lux" "syntax char case!"] (&/$Item ?input (&/$Item ?else ?matches)) ?special-args)
(&/T [meta ($proc (&/T ["lux" "syntax char case!"])
- (&/$Cons ?input
- (&/$Cons (optimize-iter arity ?else)
+ (&/$Item ?input
+ (&/$Item (optimize-iter arity ?else)
(&/|map (partial optimize-iter arity)
?matches)))
?special-args)])
@@ -858,7 +858,7 @@
(or (contains-self-reference? func)
(&/fold stepwise-test false args))
- ($proc ["lux" "syntax char case!"] (&/$Cons ?input (&/$Cons ?else ?matches)) ?special-args)
+ ($proc ["lux" "syntax char case!"] (&/$Item ?input (&/$Item ?else ?matches)) ?special-args)
(or (contains-self-reference? ?input)
(contains-self-reference? ?else)
(&/fold stepwise-test false ?matches))
@@ -1064,33 +1064,33 @@
(|case branches
;; The pattern for a let-expression is a single branch,
;; tying the value to a register.
- (&/$Cons [(&a-case/$StoreTestAC _register) _body] (&/$Nil))
+ (&/$Item [(&a-case/$StoreTestAC _register) _body] (&/$End))
(&/T [meta ($let (pass-0 top-level-func? value) _register (pass-0 top-level-func? _body))])
- (&/$Cons [(&a-case/$BitTestAC true) _then]
- (&/$Cons [(&a-case/$BitTestAC false) _else]
- (&/$Nil)))
+ (&/$Item [(&a-case/$BitTestAC true) _then]
+ (&/$Item [(&a-case/$BitTestAC false) _else]
+ (&/$End)))
(&/T [meta ($if (pass-0 top-level-func? value) (pass-0 top-level-func? _then) (pass-0 top-level-func? _else))])
- (&/$Cons [(&a-case/$BitTestAC true) _then]
- (&/$Cons [(&a-case/$NoTestAC false) _else]
- (&/$Nil)))
+ (&/$Item [(&a-case/$BitTestAC true) _then]
+ (&/$Item [(&a-case/$NoTestAC false) _else]
+ (&/$End)))
(&/T [meta ($if (pass-0 top-level-func? value) (pass-0 top-level-func? _then) (pass-0 top-level-func? _else))])
- (&/$Cons [(&a-case/$BitTestAC false) _else]
- (&/$Cons [(&a-case/$BitTestAC true) _then]
- (&/$Nil)))
+ (&/$Item [(&a-case/$BitTestAC false) _else]
+ (&/$Item [(&a-case/$BitTestAC true) _then]
+ (&/$End)))
(&/T [meta ($if (pass-0 top-level-func? value) (pass-0 top-level-func? _then) (pass-0 top-level-func? _else))])
- (&/$Cons [(&a-case/$BitTestAC false) _else]
- (&/$Cons [(&a-case/$NoTestAC) _then]
- (&/$Nil)))
+ (&/$Item [(&a-case/$BitTestAC false) _else]
+ (&/$Item [(&a-case/$NoTestAC) _then]
+ (&/$End)))
(&/T [meta ($if (pass-0 top-level-func? value) (pass-0 top-level-func? _then) (pass-0 top-level-func? _else))])
;; The pattern for a record-get is a single branch, with a
;; tuple pattern and a body corresponding to a
;; local-variable extracted from the tuple.
- (&/$Cons [(&a-case/$TupleTestAC _sub-tests) [_ (&a/$var (&/$Local _member-idx))]] (&/$Nil))
+ (&/$Item [(&a-case/$TupleTestAC _sub-tests) [_ (&a/$var (&/$Local _member-idx))]] (&/$End))
(|let [_path (record-read-path _sub-tests _member-idx)]
(if (&/|empty? _path)
;; If the path is empty, that means it was a
diff --git a/lux-bootstrapper/src/lux/parser.clj b/lux-bootstrapper/src/lux/parser.clj
index dd33129b8..5d409400e 100644
--- a/lux-bootstrapper/src/lux/parser.clj
+++ b/lux-bootstrapper/src/lux/parser.clj
@@ -16,11 +16,11 @@
(if (or (.contains error base-uneven-record-error)
(not (.contains error "[Parser Error]")))
(&/$Left error)
- (&/$Right (&/T [state &/$Nil])))
+ (&/$Right (&/T [state &/$End])))
(&/$Right state* head)
((|do [tail (repeat% action)]
- (return (&/$Cons head tail)))
+ (return (&/$Item head tail)))
state*))))
(do-template [<name> <close-tag> <description> <tag>]
@@ -29,7 +29,7 @@
token &lexer/lex]
(|case token
[meta (<close-tag> _)]
- (return (<tag> (&/fold &/|++ &/$Nil elems)))
+ (return (<tag> (&/fold &/|++ &/$End elems)))
_
(&/fail-with-loc (str "[Parser Error] Unbalanced " <description> "."))
@@ -42,7 +42,7 @@
(defn ^:private parse-record [parse]
(|do [elems* (repeat% parse)
token &lexer/lex
- :let [elems (&/fold &/|++ &/$Nil elems*)]]
+ :let [elems (&/fold &/|++ &/$End elems*)]]
(|case token
[meta (&lexer/$Close_Brace _)]
(|do [_ (&/assert! (even? (&/|length elems))
@@ -59,10 +59,10 @@
:let [[meta token*] token]]
(|case token*
(&lexer/$White_Space _)
- (return &/$Nil)
+ (return &/$End)
(&lexer/$Comment _)
- (return &/$Nil)
+ (return &/$End)
(&lexer/$Bit ?value)
(return (&/|list (&/T [meta (&/$Bit (.equals ^String ?value "#1"))])))
diff --git a/lux-bootstrapper/src/lux/reader.clj b/lux-bootstrapper/src/lux/reader.clj
index 14914cc2e..63d4db9fb 100644
--- a/lux-bootstrapper/src/lux/reader.clj
+++ b/lux-bootstrapper/src/lux/reader.clj
@@ -14,10 +14,10 @@
(defn- with-line [body]
(fn [state]
(|case (&/get$ &/$source state)
- (&/$Nil)
+ (&/$End)
((&/fail-with-loc "[Reader Error] EOF") state)
- (&/$Cons [[file-name line-num column-num] line]
+ (&/$Item [[file-name line-num column-num] line]
more)
(|case (body file-name line-num column-num line)
($No msg)
@@ -28,7 +28,7 @@
output)
($Yes output line*)
- (return* (&/set$ &/$source (&/$Cons line* more) state)
+ (return* (&/set$ &/$source (&/$Item line* more) state)
output))
)))
@@ -84,10 +84,10 @@
(loop [prefix ""
reader* reader]
(|case reader*
- (&/$Nil)
+ (&/$End)
(&/$Left "[Reader Error] EOF")
- (&/$Cons [[file-name line-num column-num] ^String line]
+ (&/$Item [[file-name line-num column-num] ^String line]
reader**)
(if-let [^String match (re-find! regex column-num line)]
(let [match-length (.length match)
@@ -97,7 +97,7 @@
(str prefix match))]
(if (= column-num* (.length line))
(recur prefix* reader**)
- (&/$Right (&/T [(&/$Cons (&/T [(&/T [file-name line-num column-num*]) line])
+ (&/$Right (&/T [(&/$Item (&/T [(&/T [file-name line-num column-num*]) line])
reader**)
(&/T [(&/T [file-name line-num column-num]) prefix*])]))))
(&/$Left (str "[Reader Error] Pattern failed: " regex))))))))
@@ -138,8 +138,8 @@
line]))
lines
(range (count lines)))]
- (reduce (fn [tail head] (&/$Cons head tail))
- &/$Nil
+ (reduce (fn [tail head] (&/$Item head tail))
+ &/$End
(reverse indexed-lines))))
(defn with-source [name content body]
diff --git a/lux-bootstrapper/src/lux/type.clj b/lux-bootstrapper/src/lux/type.clj
index 267b6d67b..6472a341d 100644
--- a/lux-bootstrapper/src/lux/type.clj
+++ b/lux-bootstrapper/src/lux/type.clj
@@ -12,10 +12,10 @@
;; [Utils]
(defn |list? [xs]
(|case xs
- (&/$Nil)
+ (&/$End)
true
- (&/$Cons x xs*)
+ (&/$Item x xs*)
(|list? xs*)
_
@@ -23,21 +23,21 @@
(def max-stack-size 256)
-(def empty-env &/$Nil)
+(def empty-env &/$End)
(def I64 (&/$Named (&/T [&/prelude "I64"])
(&/$UnivQ empty-env
(&/$Primitive "#I64" (&/|list (&/$Parameter 1))))))
-(def Nat* (&/$Primitive &&host/nat-data-tag &/$Nil))
-(def Rev* (&/$Primitive &&host/rev-data-tag &/$Nil))
-(def Int* (&/$Primitive &&host/int-data-tag &/$Nil))
+(def Nat* (&/$Primitive &&host/nat-data-tag &/$End))
+(def Rev* (&/$Primitive &&host/rev-data-tag &/$End))
+(def Int* (&/$Primitive &&host/int-data-tag &/$End))
-(def Bit (&/$Named (&/T [&/prelude "Bit"]) (&/$Primitive "#Bit" &/$Nil)))
+(def Bit (&/$Named (&/T [&/prelude "Bit"]) (&/$Primitive "#Bit" &/$End)))
(def Nat (&/$Named (&/T [&/prelude "Nat"]) (&/$Apply Nat* I64)))
(def Rev (&/$Named (&/T [&/prelude "Rev"]) (&/$Apply Rev* I64)))
(def Int (&/$Named (&/T [&/prelude "Int"]) (&/$Apply Int* I64)))
-(def Frac (&/$Named (&/T [&/prelude "Frac"]) (&/$Primitive "#Frac" &/$Nil)))
-(def Text (&/$Named (&/T [&/prelude "Text"]) (&/$Primitive "#Text" &/$Nil)))
+(def Frac (&/$Named (&/T [&/prelude "Frac"]) (&/$Primitive "#Frac" &/$End)))
+(def Text (&/$Named (&/T [&/prelude "Text"]) (&/$Primitive "#Text" &/$End)))
(def Ident (&/$Named (&/T [&/prelude "Ident"]) (&/$Product Text Text)))
(defn Array [elemT]
@@ -64,9 +64,9 @@
(&/$Named (&/T [&/prelude "List"])
(&/$UnivQ empty-env
(&/$Sum
- ;; lux;Nil
+ ;; lux;End
Any
- ;; lux;Cons
+ ;; lux;Item
(&/$Product (&/$Parameter 1)
(&/$Apply (&/$Parameter 1)
(&/$Parameter 0)))))))
@@ -172,7 +172,7 @@
(def Macro
(&/$Named (&/T [&/prelude "Macro"])
- (&/$Primitive "#Macro" &/$Nil)))
+ (&/$Primitive "#Macro" &/$End)))
(defn bound? [id]
(fn [state]
@@ -357,21 +357,21 @@
(|case type
(&/$Function ?in ?out)
(|let [[??out ?args] (unravel-fun ?out)]
- (&/T [??out (&/$Cons ?in ?args)]))
+ (&/T [??out (&/$Item ?in ?args)]))
_
- (&/T [type &/$Nil])))
+ (&/T [type &/$End])))
(defn ^:private unravel-app
([fun-type tail]
(|case fun-type
(&/$Apply ?arg ?func)
- (unravel-app ?func (&/$Cons ?arg tail))
+ (unravel-app ?func (&/$Item ?arg tail))
_
(&/T [fun-type tail])))
([fun-type]
- (unravel-app fun-type &/$Nil)))
+ (unravel-app fun-type &/$End)))
(do-template [<tag> <flatten> <at> <desc>]
(do (defn <flatten>
@@ -379,7 +379,7 @@
[type]
(|case type
(<tag> left right)
- (&/$Cons left (<flatten> right))
+ (&/$Item left (<flatten> right))
_
(&/|list type)))
@@ -411,10 +411,10 @@
"(-> (List Type) Type)"
[types]
(|case (&/|reverse types)
- (&/$Cons last prevs)
+ (&/$Item last prevs)
(&/fold (fn [right left] (<ctor> left right)) last prevs)
- (&/$Nil)
+ (&/$End)
<unit>))
Variant$ &/$Sum Nothing
@@ -425,7 +425,7 @@
(|case type
(&/$Primitive name params)
(|case params
- (&/$Nil)
+ (&/$End)
(str "(primitive " (pr-str name) ")")
_
@@ -521,10 +521,10 @@
(defn ^:private fp-get [k fixpoints]
(|let [[e a] k]
(|case fixpoints
- (&/$Nil)
+ (&/$End)
&/$None
- (&/$Cons [[e* a*] v*] fixpoints*)
+ (&/$Item [[e* a*] v*] fixpoints*)
(if (and (type= e e*)
(type= a a*))
(&/$Some v*)
@@ -532,7 +532,7 @@
)))
(defn ^:private fp-put [k v fixpoints]
- (&/$Cons (&/T [k v]) fixpoints))
+ (&/$Item (&/T [k v]) fixpoints))
(defn show-type+ [type]
(|case type
@@ -573,7 +573,7 @@
(&/$UnivQ ?local-env ?local-def)
(|case ?local-env
- (&/$Nil)
+ (&/$End)
(&/$UnivQ env ?local-def)
_
@@ -581,7 +581,7 @@
(&/$ExQ ?local-env ?local-def)
(|case ?local-env
- (&/$Nil)
+ (&/$End)
(&/$ExQ env ?local-def)
_
@@ -606,14 +606,14 @@
(|case type-fn
(&/$UnivQ local-env local-def)
(return (beta-reduce (->> local-env
- (&/$Cons param)
- (&/$Cons type-fn))
+ (&/$Item param)
+ (&/$Item type-fn))
local-def))
(&/$ExQ local-env local-def)
(return (beta-reduce (->> local-env
- (&/$Cons param)
- (&/$Cons type-fn))
+ (&/$Item param)
+ (&/$Item type-fn))
local-def))
(&/$Apply A F)
@@ -635,7 +635,7 @@
(&/fail-with-loc (str "[Type System] Not a type function:\n" (show-type type-fn) "\n"
"for arg: " (show-type param)))))
-(def ^:private init-fixpoints &/$Nil)
+(def ^:private init-fixpoints &/$End)
(defn ^:private check* [fixpoints invariant?? expected actual]
(if (clojure.lang.Util/identical expected actual)
@@ -710,7 +710,7 @@
(&/$Left _)
(|case F2
- (&/$UnivQ (&/$Cons _) _)
+ (&/$UnivQ (&/$Item _) _)
((|do [actual* (apply-type F2 A2)]
(check* fixpoints invariant?? expected actual*))
state)
@@ -910,7 +910,7 @@
(if (>= size-types size-members)
(&/T [size-members (&/|++ (&/|take (dec size-members) ?member-types)
(&/|list (|case (->> ?member-types (&/|drop (dec size-members)) (&/|reverse))
- (&/$Cons last prevs)
+ (&/$Item last prevs)
(&/fold (fn [right left] (&/$Product left right))
last prevs))))])
(&/T [size-types ?member-types])
@@ -919,13 +919,13 @@
(do-template [<name> <zero> <plus>]
(defn <name> [types]
(|case (&/|reverse types)
- (&/$Nil)
+ (&/$End)
<zero>
- (&/$Cons type (&/$Nil))
+ (&/$Item type (&/$End))
type
- (&/$Cons last prevs)
+ (&/$Item last prevs)
(&/fold (fn [r l] (<plus> l r)) last prevs)))
fold-prod Any &/$Product
diff --git a/lux-bootstrapper/src/lux/type/host.clj b/lux-bootstrapper/src/lux/type/host.clj
index dbf780a84..692062f50 100644
--- a/lux-bootstrapper/src/lux/type/host.clj
+++ b/lux-bootstrapper/src/lux/type/host.clj
@@ -86,17 +86,17 @@
stack (&/|list)]
(if-let [super-interface (some valid-sub? (.getInterfaces sub-class))]
(if (= super-class super-interface)
- (&/$Cons super-interface stack)
- (recur super-interface (&/$Cons super-interface stack)))
+ (&/$Item super-interface stack)
+ (recur super-interface (&/$Item super-interface stack)))
(if-let [super* (.getSuperclass sub-class)]
- (recur super* (&/$Cons super* stack))
+ (recur super* (&/$Item super* stack))
stack)))
(loop [sub-class sub-class
stack (&/|list)]
(let [super* (.getSuperclass sub-class)]
(if (= super* super-class)
- (&/$Cons super* stack)
- (recur super* (&/$Cons super* stack))))))))
+ (&/$Item super* stack)
+ (recur super* (&/$Item super* stack))))))))
(defn ^:private trace-lineage
"(-> Class Class (List Class))"
@@ -105,7 +105,7 @@
(&/|list)
(&/|reverse (trace-lineage* super-class sub-class))))
-(let [matcher (fn [m ^TypeVariable jt lt] (&/$Cons (&/T [(.getName jt) lt]) m))]
+(let [matcher (fn [m ^TypeVariable jt lt] (&/$Item (&/T [(.getName jt) lt]) m))]
(defn ^:private match-params [sub-type-params params]
(assert (and (= (&/|length sub-type-params) (&/|length params))
(&/|every? (partial instance? TypeVariable) sub-type-params)))
@@ -137,7 +137,7 @@
Any
(reduce (fn [inner _] (&/$Primitive array-data-tag (&/|list inner)))
(&/$Primitive base (try (-> (Class/forName base) .getTypeParameters
- seq count (repeat (&/$Primitive "java.lang.Object" &/$Nil))
+ seq count (repeat (&/$Primitive "java.lang.Object" &/$End))
&/->list)
(catch Exception e
(&/|list))))
@@ -183,7 +183,7 @@
(if (type= Any class-type)
"V"
(|case class-type
- (&/$Primitive "#Array" (&/$Cons (&/$Primitive class-name _) (&/$Nil)))
+ (&/$Primitive "#Array" (&/$Item (&/$Primitive class-name _) (&/$End)))
(str "[" (&host-generics/->type-signature class-name))
(&/$Primitive class-name _)
@@ -357,7 +357,7 @@
"(-> GenericType GenericClass)"
[gtype]
(cond (instance? Class gtype)
- (&/$GenericClass (.getName ^Class gtype) &/$Nil)
+ (&/$GenericClass (.getName ^Class gtype) &/$End)
(instance? GenericArrayType gtype)
(&/$GenericArray (gtype->gclass (.getGenericComponentType ^GenericArrayType gtype)))
@@ -385,7 +385,7 @@
"(-> GenericClass Text)"
[gclass]
(|case gclass
- (&/$GenericClass gclass-name (&/$Nil))
+ (&/$GenericClass gclass-name (&/$End))
(case gclass-name
"void" "V"
"boolean" "Z"