aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm')
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux140
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm.lux34
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/def.lux16
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/inst.lux2
-rw-r--r--lux-jvm/source/luxc/lang/synthesis/variable.lux4
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm.lux6
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux28
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux154
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/function.lux142
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/loop.lux36
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/reference.lux4
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/runtime.lux22
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/structure.lux16
-rw-r--r--lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux18
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/loop.lux16
-rw-r--r--lux-jvm/test/test/luxc/lang/synthesis/procedure.lux2
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/js.lux12
-rw-r--r--lux-jvm/test/test/luxc/lang/translation/jvm.lux36
18 files changed, 344 insertions, 344 deletions
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index 2c6577ae1..5511b5913 100644
--- a/lux-jvm/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
@@ -530,7 +530,7 @@
(|>> [..fresh]
..relabel_bytecode
product.right
- (row\map ..instruction)
+ (row\each ..instruction)
row.list
_.fuse))
@@ -553,7 +553,7 @@
(def: (true_handler extender pseudo)
(-> jvm.Extender Any jvm.Handler)
(function (_ extension_name phase archive inputs)
- (\ phase.monad map
+ (\ phase.monad each
(|>> (:as (/.Bytecode Inst /.Label)) ..bytecode)
((extender pseudo) extension_name phase archive inputs))))
@@ -904,7 +904,7 @@
(def.abstract_method (..visibility privacy)
jvm.noneM
name
- (/type.method [variables (list\map product.right arguments) return exceptions]))))
+ (/type.method [variables (list\each product.right arguments) return exceptions]))))
(def: (method_header super_class method)
(-> (Type Class) (Method Code) jvm.Def)
@@ -914,10 +914,10 @@
body])
(let [[super_name super_vars] (parser.read_class super_class)
init_constructor_arguments (|> constructor_arguments
- (list\map (|>> product.left ..header_value))
+ (list\each (|>> product.left ..header_value))
_.fuse)
super_constructorT (/type.method [(list)
- (list\map product.left constructor_arguments)
+ (list\each product.left constructor_arguments)
/type.void
(list)])]
(def.method (..visibility privacy)
@@ -925,7 +925,7 @@
jvm.strictM
jvm.noneM)
..constructor_name
- (/type.method [variables (list\map product.right arguments) /type.void exceptions])
+ (/type.method [variables (list\each product.right arguments) /type.void exceptions])
(|>> (_.ALOAD 0)
init_constructor_arguments
(_.INVOKESPECIAL super_class ..constructor_name super_constructorT)
@@ -939,7 +939,7 @@
jvm.strictM
jvm.noneM)
name
- (/type.method [variables (list\map product.right arguments) return exceptions])
+ (/type.method [variables (list\each product.right arguments) return exceptions])
(..header_return return))
(#Virtual [name privacy final? strict_floating_point? annotations variables
@@ -954,7 +954,7 @@
jvm.finalM
jvm.noneM)))
name
- (/type.method [variables (list\map product.right arguments) return exceptions])
+ (/type.method [variables (list\each product.right arguments) return exceptions])
(..header_return return))
(#Static [name privacy strict_floating_point? annotations variables
@@ -966,7 +966,7 @@
jvm.strictM
jvm.noneM)))
name
- (/type.method [variables (list\map product.right arguments) return exceptions])
+ (/type.method [variables (list\each product.right arguments) return exceptions])
(..header_return return))
(#Abstract method)
@@ -986,11 +986,11 @@
(List Field)
(List (Method Code))
[External Binary])
- (let [constraints (list\map ..constraint type_variables)
- field_definitions (list\map ..field_header fields)
- method_definitions (list\map (..method_header super_class) methods)
- definitions (def.fuse (list\compose field_definitions
- method_definitions))]
+ (let [constraints (list\each ..constraint type_variables)
+ field_definitions (list\each ..field_header fields)
+ method_definitions (list\each (..method_header super_class) methods)
+ definitions (def.fuse (list\composite field_definitions
+ method_definitions))]
[class_name
(case inheritance
#ffi.DefaultI
@@ -1016,19 +1016,19 @@
(do !
[mapping (//A.with_fresh_type_vars class_tvars luxT.fresh)
mapping (//A.with_fresh_type_vars method_tvars mapping)
- constructor_argumentsA (monad.map ! (function (_ [typeJ termC])
- (do !
- [typeL (//A.reflection_type mapping typeJ)
- termA (typeA.with_type typeL
- (analyse archive termC))]
- (in [typeJ termA])))
- constructor_argumentsC)
+ constructor_argumentsA (monad.each ! (function (_ [typeJ termC])
+ (do !
+ [typeL (//A.reflection_type mapping typeJ)
+ termA (typeA.with_type typeL
+ (analyse archive termC))]
+ (in [typeJ termA])))
+ constructor_argumentsC)
selfT (//A.reflection_type mapping (/type.class class_name class_tvars))
- arguments' (monad.map !
- (function (_ [name type])
- (\ ! map (|>> [name])
- (//A.boxed_reflection_type mapping type)))
- arguments)
+ arguments' (monad.each !
+ (function (_ [name type])
+ (\ ! each (|>> [name])
+ (//A.boxed_reflection_type mapping type)))
+ arguments)
returnT (//A.boxed_reflection_return mapping /type.void)
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
@@ -1054,11 +1054,11 @@
mapping (//A.with_override_mapping supers parent_type mapping)
mapping (//A.with_fresh_type_vars method_tvars mapping)
selfT (//A.reflection_type mapping (/type.class class_name class_tvars))
- arguments' (monad.map !
- (function (_ [name type])
- (\ ! map (|>> [name])
- (//A.boxed_reflection_type mapping type)))
- arguments)
+ arguments' (monad.each !
+ (function (_ [name type])
+ (\ ! each (|>> [name])
+ (//A.boxed_reflection_type mapping type)))
+ arguments)
returnT (//A.boxed_reflection_return mapping returnJ)
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
@@ -1082,11 +1082,11 @@
[mapping (//A.with_fresh_type_vars class_tvars luxT.fresh)
mapping (//A.with_fresh_type_vars method_tvars mapping)
selfT (//A.reflection_type mapping (/type.class class_name class_tvars))
- arguments' (monad.map !
- (function (_ [name type])
- (\ ! map (|>> [name])
- (//A.boxed_reflection_type mapping type)))
- arguments)
+ arguments' (monad.each !
+ (function (_ [name type])
+ (\ ! each (|>> [name])
+ (//A.boxed_reflection_type mapping type)))
+ arguments)
returnT (//A.boxed_reflection_return mapping returnJ)
[_scope bodyA] (|> arguments'
(#.Item [self selfT])
@@ -1108,11 +1108,11 @@
(directive.lifted_analysis
(do !
[mapping (//A.with_fresh_type_vars method_tvars luxT.fresh)
- arguments' (monad.map !
- (function (_ [name type])
- (\ ! map (|>> [name])
- (//A.boxed_reflection_type mapping type)))
- arguments)
+ arguments' (monad.each !
+ (function (_ [name type])
+ (\ ! each (|>> [name])
+ (//A.boxed_reflection_type mapping type)))
+ arguments)
returnT (//A.boxed_reflection_return mapping returnJ)
[_scope bodyA] (|> arguments'
list.reversed
@@ -1127,19 +1127,19 @@
(-> Archive Declaration (List (Type Class)) (Method Code) (Operation (Method Analysis)))
(case method
(#Constructor method)
- (\ phase.monad map (|>> #Constructor)
+ (\ phase.monad each (|>> #Constructor)
(constructor_method_analysis archive declaration method))
(#Override method)
- (\ phase.monad map (|>> #Override)
+ (\ phase.monad each (|>> #Override)
(override_method_analysis archive declaration supers method))
(#Virtual method)
- (\ phase.monad map (|>> #Virtual)
+ (\ phase.monad each (|>> #Virtual)
(virtual_method_analysis archive declaration method))
(#Static method)
- (\ phase.monad map (|>> #Static)
+ (\ phase.monad each (|>> #Static)
(static_method_analysis archive method))
(#Abstract method)
@@ -1162,10 +1162,10 @@
synthesise directive.synthesis]
(directive.lifted_synthesis
(do !
- [constructor_argumentsS (monad.map ! (function (_ [typeJ termA])
- (\ ! map (|>> [typeJ])
- (synthesise archive termA)))
- constructor_argumentsA)
+ [constructor_argumentsS (monad.each ! (function (_ [typeJ termA])
+ (\ ! each (|>> [typeJ])
+ (synthesise archive termA)))
+ constructor_argumentsA)
bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))]
(in [privacy strict_floating_point? annotations method_tvars exceptions
self arguments constructor_argumentsS
@@ -1237,19 +1237,19 @@
(-> Archive (Method Analysis) (Operation (Method Synthesis)))
(case method
(#Constructor method)
- (\ phase.monad map (|>> #Constructor)
+ (\ phase.monad each (|>> #Constructor)
(constructor_method_synthesis archive method))
(#Override method)
- (\ phase.monad map (|>> #Override)
+ (\ phase.monad each (|>> #Override)
(override_method_synthesis archive method))
(#Virtual method)
- (\ phase.monad map (|>> #Virtual)
+ (\ phase.monad each (|>> #Virtual)
(virtual_method_synthesis archive method))
(#Static method)
- (\ phase.monad map (|>> #Static)
+ (\ phase.monad each (|>> #Static)
(static_method_synthesis archive method))
(#Abstract method)
@@ -1265,16 +1265,16 @@
generate directive.generation]
(directive.lifted_generation
(do !
- [constructor_argumentsG (monad.map ! (|>> product.right (generate archive))
- constructor_argumentsS)
+ [constructor_argumentsG (monad.each ! (|>> product.right (generate archive))
+ constructor_argumentsS)
bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS))
.let [[super_name super_vars] (parser.read_class super_class)
super_constructor_argument_values (_.fuse constructor_argumentsG)
super_constructorT (/type.method [(list)
- (list\map product.left constructor_argumentsS)
+ (list\each product.left constructor_argumentsS)
/type.void
(list)])
- argumentsT (list\map product.right arguments)
+ argumentsT (list\each product.right arguments)
initialize_object! (: Inst
(|>> (_.ALOAD 0)
super_constructor_argument_values
@@ -1300,7 +1300,7 @@
(directive.lifted_generation
(do !
[bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS))
- .let [argumentsT (list\map product.right arguments)]]
+ .let [argumentsT (list\each product.right arguments)]]
(in (def.method #jvm.Public
(if strict_floating_point?
jvm.strictM
@@ -1321,7 +1321,7 @@
(directive.lifted_generation
(do !
[bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS))
- .let [argumentsT (list\map product.right arguments)]]
+ .let [argumentsT (list\each product.right arguments)]]
(in (def.method (..visibility privacy)
(|> jvm.noneM
(jvm.++M (if strict_floating_point?
@@ -1346,7 +1346,7 @@
(directive.lifted_generation
(do !
[bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS))
- .let [argumentsT (list\map product.right arguments)]]
+ .let [argumentsT (list\each product.right arguments)]]
(in (def.method (..visibility privacy)
(|> jvm.staticM
(jvm.++M (if strict_floating_point?
@@ -1429,16 +1429,16 @@
(list.all ..convert_overriden_method)
(//A.require_complete_method_concretion class_loader supers)
directive.lifted_analysis)
- methodsA (monad.map ! (method_analysis archive declaration supers) methodsC)
- methodsS (monad.map ! (method_synthesis archive) methodsA)
- methodsG (monad.map ! (method_generation archive super_class) methodsS)
+ methodsA (monad.each ! (method_analysis archive declaration supers) methodsC)
+ methodsS (monad.each ! (method_synthesis archive) methodsA)
+ methodsG (monad.each ! (method_generation archive super_class) methodsS)
.let [directive [class_name
(def.class #jvm.V1_6 #jvm.Public jvm.noneC class_name
- (list\map ..constraint type_variables)
+ (list\each ..constraint type_variables)
super_class
super_interfaces
- (def.fuse (list\compose (list\map ..field_header fields)
- methodsG)))]]]
+ (def.fuse (list\composite (list\each ..field_header fields)
+ methodsG)))]]]
(directive.lifted_generation
(do !
[artifact_id (generation.learn_custom class_name)
@@ -1459,12 +1459,12 @@
(do {! phase.monad}
[.let [directive [class_name
(def.interface #jvm.V1_6 #jvm.Public jvm.noneC class_name
- (list\map ..constraint type_variables)
+ (list\each ..constraint type_variables)
supers
(|> method_declarations
- (list\map (function (_ (^slots [#name #annotations #type_variables #exceptions #arguments #return]))
- (def.abstract_method #jvm.Public jvm.noneM name
- (/type.method [type_variables arguments return exceptions]))))
+ (list\each (function (_ (^slots [#name #annotations #type_variables #exceptions #arguments #return]))
+ (def.abstract_method #jvm.Public jvm.noneM name
+ (/type.method [type_variables arguments return exceptions]))))
def.fuse))]]]
(directive.lifted_generation
(do !
diff --git a/lux-jvm/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux
index e24922771..305d04f8c 100644
--- a/lux-jvm/source/luxc/lang/host/jvm.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm.lux
@@ -94,32 +94,32 @@
options (<code>.tuple (<>.many <code>.local_identifier))])
(let [g!type (code.local_identifier type)
g!none (code.local_identifier none)
- g!tags+ (list/map code.local_tag options)
+ g!tags+ (list/each code.local_tag options)
g!_left (code.local_identifier "_left")
g!_right (code.local_identifier "_right")
- g!options+ (list/map (function (_ option)
- (` (def: .public (~ (code.local_identifier option))
- (~ g!type)
- (|> (~ g!none)
- (with@ (~ (code.local_tag option)) #1)))))
- options)]
+ g!options+ (list/each (function (_ option)
+ (` (def: .public (~ (code.local_identifier option))
+ (~ g!type)
+ (|> (~ g!none)
+ (with@ (~ (code.local_tag option)) #1)))))
+ options)]
(in (list& (` (type: .public (~ g!type)
- (~ (code.record (list/map (function (_ tag)
- [tag (` .Bit)])
- g!tags+)))))
+ (~ (code.record (list/each (function (_ tag)
+ [tag (` .Bit)])
+ g!tags+)))))
(` (def: .public (~ g!none)
(~ g!type)
- (~ (code.record (list/map (function (_ tag)
- [tag (` #0)])
- g!tags+)))))
+ (~ (code.record (list/each (function (_ tag)
+ [tag (` #0)])
+ g!tags+)))))
(` (def: .public ((~ (code.local_identifier ++)) (~ g!_left) (~ g!_right))
(-> (~ g!type) (~ g!type) (~ g!type))
- (~ (code.record (list/map (function (_ tag)
- [tag (` (or (value@ (~ tag) (~ g!_left))
- (value@ (~ tag) (~ g!_right))))])
- g!tags+)))))
+ (~ (code.record (list/each (function (_ tag)
+ [tag (` (or (value@ (~ tag) (~ g!_left))
+ (value@ (~ tag) (~ g!_right))))])
+ g!tags+)))))
g!options+))))
diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux
index 130e0bb56..b772435cd 100644
--- a/lux-jvm/source/luxc/lang/host/jvm/def.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux
@@ -82,9 +82,9 @@
(def: (string_array values)
(-> (List Text) (Array Text))
(let [output (ffi.array java/lang/String (list.size values))]
- (exec (list@map (function (_ [idx value])
- (ffi.write! idx value output))
- (list.enumeration values))
+ (exec (list@each (function (_ [idx value])
+ (ffi.write! idx value output))
+ (list.enumeration values))
output)))
(def: (version_flag version)
@@ -137,7 +137,7 @@
(format name
(param_signature super)
(|> interfaces
- (list@map param_signature)
+ (list@each param_signature)
(text.interposed ""))))
(def: (constraints_signature constraints super interfaces)
@@ -147,13 +147,13 @@
""
(format "<"
(|> constraints
- (list@map formal_param)
+ (list@each formal_param)
(text.interposed ""))
">"))]
(format formal_params
(..signature super)
(|> interfaces
- (list@map ..signature)
+ (list@each ..signature)
(text.interposed "")))))
(def: class_computes
@@ -181,7 +181,7 @@
(constraints_signature constraints super interfaces)
(..class_name super)
(|> interfaces
- (list@map ..class_name)
+ (list@each ..class_name)
string_array)))
definitions)
_ (org/objectweb/asm/ClassWriter::visitEnd writer)]
@@ -210,7 +210,7 @@
(constraints_signature constraints $Object interfaces)
(..class_name $Object)
(|> interfaces
- (list@map ..class_name)
+ (list@each ..class_name)
string_array)))
definitions)
_ (org/objectweb/asm/ClassWriter::visitEnd writer)]
diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
index e0402d924..2dac20c54 100644
--- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
@@ -46,7 +46,7 @@
(syntax: (declare [codes (p.many s.local_identifier)])
(|> codes
- (list@map (function (_ code) (` ((~' #static) (~ (code.local_identifier code)) (~' int)))))
+ (list@each (function (_ code) (` ((~' #static) (~ (code.local_identifier code)) (~' int)))))
in))
(`` (import: org/objectweb/asm/Opcodes
diff --git a/lux-jvm/source/luxc/lang/synthesis/variable.lux b/lux-jvm/source/luxc/lang/synthesis/variable.lux
index f4e68d25b..1fa63446e 100644
--- a/lux-jvm/source/luxc/lang/synthesis/variable.lux
+++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux
@@ -15,7 +15,7 @@
(list (.int register))
(^or (#ls.SeqP pre post) (#ls.AltP pre post))
- (list/compose (bound-vars pre) (bound-vars post))
+ (list/composite (bound-vars pre) (bound-vars post))
_
(list)))
@@ -30,7 +30,7 @@
(path-bodies post)
(#ls.AltP pre post)
- (list/compose (path-bodies pre) (path-bodies post))
+ (list/composite (path-bodies pre) (path-bodies post))
_
(list)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux
index 71dcfa645..18c05fecc 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm.lux
@@ -137,8 +137,8 @@
(-> Library java/lang/ClassLoader Definition (Try Any))
(io.run! (do (try.with io.monad)
[existing_class? (|> (atom.read! library)
- (\ io.monad map (function (_ library)
- (dictionary.key? library class_name)))
+ (\ io.monad each (function (_ library)
+ (dictionary.key? library class_name)))
(try.lifted io.monad)
(: (IO (Try Bit))))
_ (if existing_class?
@@ -162,7 +162,7 @@
(: Host
(implementation
(def: (evaluate! context valueI)
- (\ try.monad map product.left
+ (\ try.monad each product.left
(..evaluate! library loader context valueI)))
(def: execute!
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
index eaee3b51e..96fdefe31 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
@@ -100,22 +100,22 @@
elseG (phase archive else)
conditionalsG+ (: (Operation (List [(List [Int Label])
Inst]))
- (monad.map @ (function (_ [chars branch])
- (do @
- [branchG (phase archive branch)]
- (in (<| _.with_label (function (_ @branch))
- [(list@map (function (_ char)
- [(.int char) @branch])
- chars)
- (|>> (_.label @branch)
- branchG
- (_.GOTO @end))]))))
- conditionals))
+ (monad.each @ (function (_ [chars branch])
+ (do @
+ [branchG (phase archive branch)]
+ (in (<| _.with_label (function (_ @branch))
+ [(list@each (function (_ char)
+ [(.int char) @branch])
+ chars)
+ (|>> (_.label @branch)
+ branchG
+ (_.GOTO @end))]))))
+ conditionals))
.let [table (|> conditionalsG+
- (list@map product.left)
- list@join)
+ (list@each product.left)
+ list@conjoint)
conditionalsG (|> conditionalsG+
- (list@map product.right)
+ (list@each product.right)
_.fuse)]]
(in (|>> inputG (_.unwrap type.long) _.L2I
(_.LOOKUPSWITCH @else table)
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
index e2855e999..826c45f1a 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -734,9 +734,9 @@
[($_ <>.and ..class <synthesis>.text ..return (<>.some ..input))
(function (_ extension_name generate archive [class method outputT inputsTS])
(do {! phase.monad}
- [inputsTI (monad.map ! (generate_input generate archive) inputsTS)]
- (in (|>> (_.fuse (list\map product.right inputsTI))
- (_.INVOKESTATIC class method (type.method [(list) (list\map product.left inputsTI) outputT (list)]))
+ [inputsTI (monad.each ! (generate_input generate archive) inputsTS)]
+ (in (|>> (_.fuse (list\each product.right inputsTI))
+ (_.INVOKESTATIC class method (type.method [(list) (list\each product.left inputsTI) outputT (list)]))
(prepare_output outputT)))))]))
(template [<name> <invoke>]
@@ -747,13 +747,13 @@
(function (_ extension_name generate archive [class method outputT objectS inputsTS])
(do {! phase.monad}
[objectI (generate archive objectS)
- inputsTI (monad.map ! (generate_input generate archive) inputsTS)]
+ inputsTI (monad.each ! (generate_input generate archive) inputsTS)]
(in (|>> objectI
(_.CHECKCAST class)
- (_.fuse (list\map product.right inputsTI))
+ (_.fuse (list\each product.right inputsTI))
(<invoke> class method
(type.method [(list)
- (list\map product.left inputsTI)
+ (list\each product.left inputsTI)
outputT
(list)]))
(prepare_output outputT)))))]))]
@@ -769,11 +769,11 @@
[($_ <>.and ..class (<>.some ..input))
(function (_ extension_name generate archive [class inputsTS])
(do {! phase.monad}
- [inputsTI (monad.map ! (generate_input generate archive) inputsTS)]
+ [inputsTI (monad.each ! (generate_input generate archive) inputsTS)]
(in (|>> (_.NEW class)
_.DUP
- (_.fuse (list\map product.right inputsTI))
- (_.INVOKESPECIAL class "<init>" (type.method [(list) (list\map product.left inputsTI) type.void (list)]))))))]))
+ (_.fuse (list\each product.right inputsTI))
+ (_.INVOKESPECIAL class "<init>" (type.method [(list) (list\each product.left inputsTI) type.void (list)]))))))]))
(def: member_bundle
Bundle
@@ -886,14 +886,14 @@
[#synthesis.Access])
(#synthesis.Bit_Fork when then else)
- (#synthesis.Bit_Fork when (recur then) (maybe\map recur else))
+ (#synthesis.Bit_Fork when (recur then) (maybe\each recur else))
(^template [<tag>]
[(<tag> [[test then] elses])
(<tag> [[test (recur then)]
- (list\map (function (_ [else_test else_then])
- [else_test (recur else_then)])
- elses)])])
+ (list\each (function (_ [else_test else_then])
+ [else_test (recur else_then)])
+ elses)])])
([#synthesis.I64_Fork]
[#synthesis.F64_Fork]
[#synthesis.Text_Fork])
@@ -913,7 +913,7 @@
(synthesis.variant [lefts right? (recur sub)])
(^ (synthesis.tuple members))
- (synthesis.tuple (list\map recur members))
+ (synthesis.tuple (list\each recur members))
(^ (synthesis.variable var))
(|> mapping
@@ -934,31 +934,31 @@
(synthesis.branch/get [path (recur recordS)])
(^ (synthesis.loop/scope [offset initsS+ bodyS]))
- (synthesis.loop/scope [offset (list\map recur initsS+) (recur bodyS)])
+ (synthesis.loop/scope [offset (list\each recur initsS+) (recur bodyS)])
(^ (synthesis.loop/recur updatesS+))
- (synthesis.loop/recur (list\map recur updatesS+))
+ (synthesis.loop/recur (list\each recur updatesS+))
(^ (synthesis.function/abstraction [environment arity bodyS]))
- (synthesis.function/abstraction [(list\map (function (_ captured)
- (case captured
- (^ (synthesis.variable var))
- (|> mapping
- (dictionary.value captured)
- (maybe.else var)
- synthesis.variable)
-
- _
- captured))
- environment)
+ (synthesis.function/abstraction [(list\each (function (_ captured)
+ (case captured
+ (^ (synthesis.variable var))
+ (|> mapping
+ (dictionary.value captured)
+ (maybe.else var)
+ synthesis.variable)
+
+ _
+ captured))
+ environment)
arity
bodyS])
(^ (synthesis.function/apply [functionS inputsS+]))
- (synthesis.function/apply [(recur functionS) (list\map recur inputsS+)])
+ (synthesis.function/apply [(recur functionS) (list\each recur inputsS+)])
(#synthesis.Extension [name inputsS+])
- (#synthesis.Extension [name (list\map recur inputsS+)]))))
+ (#synthesis.Extension [name (list\each recur inputsS+)]))))
(def: $Object
(type.class "java.lang.Object" (list)))
@@ -975,22 +975,22 @@
(let [store_capturedI (|> env
list.size
list.indices
- (list\map (.function (_ register)
- (|>> (_.ALOAD 0)
- (_.ALOAD (++ register))
- (_.PUTFIELD class (///reference.foreign_name register) $Object))))
+ (list\each (.function (_ register)
+ (|>> (_.ALOAD 0)
+ (_.ALOAD (++ register))
+ (_.PUTFIELD class (///reference.foreign_name register) $Object))))
_.fuse)]
(_def.method #$.Public $.noneM "<init>" (anonymous_init_method env)
(|>> (_.ALOAD 0)
- ((_.fuse (list\map product.right inputsTI)))
- (_.INVOKESPECIAL super_class "<init>" (type.method [(list) (list\map product.left inputsTI) type.void (list)]))
+ ((_.fuse (list\each product.right inputsTI)))
+ (_.INVOKESPECIAL super_class "<init>" (type.method [(list) (list\each product.left inputsTI) type.void (list)]))
store_capturedI
_.RETURN))))
(def: (anonymous_instance generate archive class env)
(-> Phase Archive (Type Class) (Environment Synthesis) (Operation Inst))
(do {! phase.monad}
- [captureI+ (monad.map ! (generate archive) env)]
+ [captureI+ (monad.each ! (generate archive) env)]
(in (|>> (_.NEW class)
_.DUP
(_.fuse captureI+)
@@ -1092,56 +1092,56 @@
class (type.class anonymous_class_name (list))
total_environment (|> overriden_methods
... Get all the environments.
- (list\map product.left)
+ (list\each product.left)
... Combine them.
- list\join
+ list\conjoint
... Remove duplicates.
(set.of_list synthesis.hash)
set.list)
global_mapping (|> total_environment
... Give them names as "foreign" variables.
list.enumeration
- (list\map (function (_ [id capture])
- [capture (#variable.Foreign id)]))
+ (list\each (function (_ [id capture])
+ [capture (#variable.Foreign id)]))
(dictionary.of_list synthesis.hash))
- normalized_methods (list\map (function (_ [environment
- [ownerT name
- strict_fp? annotations vars
- self_name arguments returnT exceptionsT
- body]])
- (let [local_mapping (|> environment
- list.enumeration
- (list\map (function (_ [foreign_id capture])
- [(synthesis.variable/foreign foreign_id)
- (|> global_mapping
- (dictionary.value capture)
- maybe.trusted)]))
- (dictionary.of_list synthesis.hash))]
- [ownerT name
- strict_fp? annotations vars
- self_name arguments returnT exceptionsT
- (normalize_method_body local_mapping body)]))
- overriden_methods)]
- inputsTI (monad.map ! (generate_input generate archive) inputsTS)
+ normalized_methods (list\each (function (_ [environment
+ [ownerT name
+ strict_fp? annotations vars
+ self_name arguments returnT exceptionsT
+ body]])
+ (let [local_mapping (|> environment
+ list.enumeration
+ (list\each (function (_ [foreign_id capture])
+ [(synthesis.variable/foreign foreign_id)
+ (|> global_mapping
+ (dictionary.value capture)
+ maybe.trusted)]))
+ (dictionary.of_list synthesis.hash))]
+ [ownerT name
+ strict_fp? annotations vars
+ self_name arguments returnT exceptionsT
+ (normalize_method_body local_mapping body)]))
+ overriden_methods)]
+ inputsTI (monad.each ! (generate_input generate archive) inputsTS)
method_definitions (|> normalized_methods
- (monad.map ! (function (_ [ownerT name
- strict_fp? annotations varsT
- self_name arguments returnT exceptionsT
- bodyS])
- (do !
- [bodyG (generation.with_context artifact_id
- (generate archive bodyS))
- .let [argumentsT (list\map product.right arguments)]]
- (in (_def.method #$.Public
- (if strict_fp?
- ($_ $.++M $.finalM $.strictM)
- $.finalM)
- name
- (type.method [varsT argumentsT returnT exceptionsT])
- (|>> (prepare_arguments 1 argumentsT)
- bodyG
- (returnI returnT)))))))
- (\ ! map _def.fuse))
+ (monad.each ! (function (_ [ownerT name
+ strict_fp? annotations varsT
+ self_name arguments returnT exceptionsT
+ bodyS])
+ (do !
+ [bodyG (generation.with_context artifact_id
+ (generate archive bodyS))
+ .let [argumentsT (list\each product.right arguments)]]
+ (in (_def.method #$.Public
+ (if strict_fp?
+ ($_ $.++M $.finalM $.strictM)
+ $.finalM)
+ name
+ (type.method [varsT argumentsT returnT exceptionsT])
+ (|>> (prepare_arguments 1 argumentsT)
+ bodyG
+ (returnI returnT)))))))
+ (\ ! each _def.fuse))
.let [directive [anonymous_class_name
(_def.class #$.V1_6 #$.Public $.finalC
anonymous_class_name (list)
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
index 0508e9c62..df80c6088 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
@@ -81,7 +81,7 @@
(def: (inputsI start amount)
(-> Register Nat Inst)
(|> (enum.range n.enum start (n.+ start (-- amount)))
- (list@map _.ALOAD)
+ (list@each _.ALOAD)
_.fuse))
(def: (applysI start amount)
@@ -109,7 +109,7 @@
(def: (instance generate archive class arity env)
(-> Phase Archive (Type Class) Arity (Environment Synthesis) (Operation Inst))
(do {@ phase.monad}
- [captureI+ (monad.map @ (generate archive) env)
+ [captureI+ (monad.each @ (generate archive) env)
.let [argsI (if (poly_arg? arity)
(|> (nullsI (-- arity))
(list (_.int +0))
@@ -133,9 +133,9 @@
captureI (|> (case env_size
0 (list)
_ (enum.range n.enum 0 (-- env_size)))
- (list@map (.function (_ source)
- (|>> (_.ALOAD 0)
- (_.GETFIELD class (reference.foreign_name source) //.$Value))))
+ (list@each (.function (_ source)
+ (|>> (_.ALOAD 0)
+ (_.GETFIELD class (reference.foreign_name source) //.$Value))))
_.fuse)
argsI (|> (nullsI (-- arity))
(list (_.int +0))
@@ -175,18 +175,18 @@
store_capturedI (|> (case env_size
0 (list)
_ (enum.range n.enum 0 (-- env_size)))
- (list@map (.function (_ register)
- (|>> (_.ALOAD 0)
- (_.ALOAD (++ register))
- (_.PUTFIELD class (reference.foreign_name register) //.$Value))))
+ (list@each (.function (_ register)
+ (|>> (_.ALOAD 0)
+ (_.ALOAD (++ register))
+ (_.PUTFIELD class (reference.foreign_name register) //.$Value))))
_.fuse)
store_partialI (if (poly_arg? arity)
(|> (enum.range n.enum 0 (n.- 2 arity))
- (list@map (.function (_ idx)
- (let [register (offset_partial idx)]
- (|>> (_.ALOAD 0)
- (_.ALOAD (++ register))
- (_.PUTFIELD class (reference.partial_name idx) //.$Value)))))
+ (list@each (.function (_ idx)
+ (let [register (offset_partial idx)]
+ (|>> (_.ALOAD 0)
+ (_.ALOAD (++ register))
+ (_.PUTFIELD class (reference.partial_name idx) //.$Value)))))
_.fuse)
function.identity)]
(def.method #$.Public $.noneM "<init>" (init_method env arity)
@@ -201,57 +201,57 @@
Def)
(let [num_partials (-- function_arity)
@default ($.new_label [])
- @labels (list@map $.new_label (list.repeated num_partials []))
+ @labels (list@each $.new_label (list.repeated num_partials []))
over_extent (|> (.int function_arity) (i.- (.int apply_arity)))
- casesI (|> (list@compose @labels (list @default))
+ casesI (|> (list@composite @labels (list @default))
(list.zipped/2 (enum.range n.enum 0 num_partials))
- (list@map (.function (_ [stage @label])
- (let [load_partialsI (if (n.> 0 stage)
- (|> (enum.range n.enum 0 (-- stage))
- (list@map (|>> reference.partial_name (load_fieldI class)))
- _.fuse)
- function.identity)]
- (cond (i.= over_extent (.int stage))
- (|>> (_.label @label)
- (_.ALOAD 0)
- (when> [(new> (n.> 0 stage) [])]
- [(_.INVOKEVIRTUAL class "reset" (reset_method class))])
- load_partialsI
- (inputsI 1 apply_arity)
- (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity))
- _.ARETURN)
+ (list@each (.function (_ [stage @label])
+ (let [load_partialsI (if (n.> 0 stage)
+ (|> (enum.range n.enum 0 (-- stage))
+ (list@each (|>> reference.partial_name (load_fieldI class)))
+ _.fuse)
+ function.identity)]
+ (cond (i.= over_extent (.int stage))
+ (|>> (_.label @label)
+ (_.ALOAD 0)
+ (when> [(new> (n.> 0 stage) [])]
+ [(_.INVOKEVIRTUAL class "reset" (reset_method class))])
+ load_partialsI
+ (inputsI 1 apply_arity)
+ (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity))
+ _.ARETURN)
- (i.> over_extent (.int stage))
- (let [args_to_completion (|> function_arity (n.- stage))
- args_left (|> apply_arity (n.- args_to_completion))]
- (|>> (_.label @label)
- (_.ALOAD 0)
- (_.INVOKEVIRTUAL class "reset" (reset_method class))
- load_partialsI
- (inputsI 1 args_to_completion)
- (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity))
- (applysI (++ args_to_completion) args_left)
- _.ARETURN))
+ (i.> over_extent (.int stage))
+ (let [args_to_completion (|> function_arity (n.- stage))
+ args_left (|> apply_arity (n.- args_to_completion))]
+ (|>> (_.label @label)
+ (_.ALOAD 0)
+ (_.INVOKEVIRTUAL class "reset" (reset_method class))
+ load_partialsI
+ (inputsI 1 args_to_completion)
+ (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity))
+ (applysI (++ args_to_completion) args_left)
+ _.ARETURN))
- ... (i.< over_extent (.int stage))
- (let [env_size (list.size env)
- load_capturedI (|> (case env_size
- 0 (list)
- _ (enum.range n.enum 0 (-- env_size)))
- (list@map (|>> reference.foreign_name (load_fieldI class)))
- _.fuse)]
- (|>> (_.label @label)
- (_.NEW class)
- _.DUP
- load_capturedI
- get_amount_of_partialsI
- (inc_intI apply_arity)
- load_partialsI
- (inputsI 1 apply_arity)
- (nullsI (|> num_partials (n.- apply_arity) (n.- stage)))
- (_.INVOKESPECIAL class "<init>" (init_method env function_arity))
- _.ARETURN))
- ))))
+ ... (i.< over_extent (.int stage))
+ (let [env_size (list.size env)
+ load_capturedI (|> (case env_size
+ 0 (list)
+ _ (enum.range n.enum 0 (-- env_size)))
+ (list@each (|>> reference.foreign_name (load_fieldI class)))
+ _.fuse)]
+ (|>> (_.label @label)
+ (_.NEW class)
+ _.DUP
+ load_capturedI
+ get_amount_of_partialsI
+ (inc_intI apply_arity)
+ load_partialsI
+ (inputsI 1 apply_arity)
+ (nullsI (|> num_partials (n.- apply_arity) (n.- stage)))
+ (_.INVOKESPECIAL class "<init>" (init_method env function_arity))
+ _.ARETURN))
+ ))))
_.fuse)]
(def.method #$.Public $.noneM //runtime.apply_method (//runtime.apply_signature apply_arity)
(|>> get_amount_of_partialsI
@@ -263,16 +263,16 @@
(def: .public with_environment
(-> (Environment Synthesis) Def)
(|>> list.enumeration
- (list@map (.function (_ [env_idx env_source])
- (def.field #$.Private $.finalF (reference.foreign_name env_idx) //.$Value)))
+ (list@each (.function (_ [env_idx env_source])
+ (def.field #$.Private $.finalF (reference.foreign_name env_idx) //.$Value)))
def.fuse))
(def: (with_partial arity)
(-> Arity Def)
(if (poly_arg? arity)
(|> (enum.range n.enum 0 (n.- 2 arity))
- (list@map (.function (_ idx)
- (def.field #$.Private $.finalF (reference.partial_name idx) //.$Value)))
+ (list@each (.function (_ idx)
+ (def.field #$.Private $.finalF (reference.partial_name idx) //.$Value)))
def.fuse)
function.identity))
@@ -284,7 +284,7 @@
(if (poly_arg? arity)
(|> (n.min arity //runtime.num_apply_variants)
(enum.range n.enum 1)
- (list@map (with_apply classD env arity @begin bodyI))
+ (list@each (with_apply classD env arity @begin bodyI))
(list& (with_implementation arity @begin bodyI))
def.fuse)
(def.method #$.Public $.strictM //runtime.apply_method (//runtime.apply_signature 1)
@@ -343,13 +343,13 @@
(Generator Apply)
(do {@ phase.monad}
[functionI (generate archive functionS)
- argsI (monad.map @ (generate archive) argsS)
+ argsI (monad.each @ (generate archive) argsS)
.let [applyI (|> argsI
(list.sub //runtime.num_apply_variants)
- (list@map (.function (_ subI+)
- (|>> (_.CHECKCAST //.$Function)
- (_.fuse subI+)
- (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size subI+))))))
+ (list@each (.function (_ subI+)
+ (|>> (_.CHECKCAST //.$Function)
+ (_.fuse subI+)
+ (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size subI+))))))
_.fuse)]]
(in (|>> functionI
applyI))))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
index 85187815d..ae1300cf9 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
@@ -42,8 +42,8 @@
[[@begin start] generation.anchor
.let [pairs (|> argsS
list.enumeration
- (list@map (function (_ [register argument])
- [(n.+ start register) argument])))]
+ (list@each (function (_ [register argument])
+ [(n.+ start register) argument])))]
... It may look weird that first I compile the values separately,
... and then I compile the stores/allocations.
... It must be done that way in order to avoid a potential bug.
@@ -52,18 +52,18 @@
... and stores separately, then by the time Y is evaluated, it
... will refer to the new value of X, instead of the old value, and
... shouldn't be the case.
- valuesI+ (monad.map @ (function (_ [register argS])
- (: (Operation Inst)
- (if (invariant? register argS)
- (in function.identity)
- (translate archive argS))))
- pairs)
- .let [storesI+ (list@map (function (_ [register argS])
- (: Inst
- (if (invariant? register argS)
- function.identity
- (_.ASTORE register))))
- (list.reversed pairs))]]
+ valuesI+ (monad.each @ (function (_ [register argS])
+ (: (Operation Inst)
+ (if (invariant? register argS)
+ (in function.identity)
+ (translate archive argS))))
+ pairs)
+ .let [storesI+ (list@each (function (_ [register argS])
+ (: Inst
+ (if (invariant? register argS)
+ function.identity
+ (_.ASTORE register))))
+ (list.reversed pairs))]]
(in (|>> (_.fuse valuesI+)
(_.fuse storesI+)
(_.GOTO @begin)))))
@@ -72,13 +72,13 @@
(Generator [Nat (List Synthesis) Synthesis])
(do {@ phase.monad}
[@begin _.make_label
- initsI+ (monad.map @ (translate archive) initsS+)
+ initsI+ (monad.each @ (translate archive) initsS+)
iterationI (generation.with_anchor [@begin start]
(translate archive iterationS))
.let [initializationI (|> (list.enumeration initsI+)
- (list@map (function (_ [register initI])
- (|>> initI
- (_.ASTORE (n.+ start register)))))
+ (list@each (function (_ [register initI])
+ (|>> initI
+ (_.ASTORE (n.+ start register)))))
_.fuse)]]
(in (|>> initializationI
(_.label @begin)
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
index a62dc5eea..2c37cf101 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
@@ -39,7 +39,7 @@
(def: (foreign archive variable)
(-> Archive Register (Operation Inst))
(do {@ phase.monad}
- [class_name (\ @ map //.class_name
+ [class_name (\ @ each //.class_name
(generation.context archive))]
(in (|>> (_.ALOAD 0)
(_.GETFIELD (type.class class_name (list))
@@ -62,6 +62,6 @@
(def: .public (constant archive name)
(-> Archive Name (Operation Inst))
(do {@ phase.monad}
- [class_name (\ @ map //.class_name
+ [class_name (\ @ each //.class_name
(generation.remember archive name))]
(in (_.GETSTATIC (type.class class_name (list)) //.value_field //.$Value))))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
index 23d59b8f4..0e758f149 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
@@ -359,17 +359,17 @@
(def: translate_function
(Operation [artifact.ID (Maybe Text) Binary])
(let [applyI (|> (enum.range n.enum 2 num_apply_variants)
- (list@map (function (_ arity)
- ($d.method #$.Public $.noneM apply_method (apply_signature arity)
- (let [preI (|> (enum.range n.enum 0 (-- arity))
- (list@map _.ALOAD)
- _.fuse)]
- (|>> preI
- (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature (-- arity)))
- (_.CHECKCAST //.$Function)
- (_.ALOAD arity)
- (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature 1))
- _.ARETURN)))))
+ (list@each (function (_ arity)
+ ($d.method #$.Public $.noneM apply_method (apply_signature arity)
+ (let [preI (|> (enum.range n.enum 0 (-- arity))
+ (list@each _.ALOAD)
+ _.fuse)]
+ (|>> preI
+ (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature (-- arity)))
+ (_.CHECKCAST //.$Function)
+ (_.ALOAD arity)
+ (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature 1))
+ _.ARETURN)))))
(list& ($d.abstract_method #$.Public $.noneM apply_method (apply_signature 1)))
$d.fuse)
$Object (type.class "java.lang.Object" (list))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
index 71e9c514f..5676fa5f9 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
@@ -50,14 +50,14 @@
(n.>= 2 size))
membersI (|> members
list.enumeration
- (monad.map @ (function (_ [idx member])
- (do @
- [memberI (generate archive member)]
- (in (|>> _.DUP
- (_.int (.int idx))
- memberI
- _.AASTORE)))))
- (\ @ map _.fuse))]
+ (monad.each @ (function (_ [idx member])
+ (do @
+ [memberI (generate archive member)]
+ (in (|>> _.DUP
+ (_.int (.int idx))
+ memberI
+ _.AASTORE)))))
+ (\ @ each _.fuse))]
(in (|>> (_.int (.int size))
(_.array //runtime.$Value)
membersI))))
diff --git a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
index f3af659fa..5d1fd5d7d 100644
--- a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux
@@ -266,7 +266,7 @@
(let [entries (dict.entries hostAE.boxes)
num-entries (list.size entries)]
(do r.Monad<Random>
- [choice (|> r.nat (:: @ map (n/% (++ num-entries))))
+ [choice (|> r.nat (:: @ each (n/% (++ num-entries))))
#let [[unboxed boxed] (: [Text Text]
(|> entries
(list.nth choice)
@@ -278,9 +278,9 @@
(do @
[#let [cap (|>> (n/% +10) (n/max +1))]
[unboxed boxed] array-type
- size (|> r.nat (:: @ map cap))
- idx (|> r.nat (:: @ map (n/% size)))
- level (|> r.nat (:: @ map cap))
+ size (|> r.nat (:: @ each cap))
+ idx (|> r.nat (:: @ each (n/% size)))
+ level (|> r.nat (:: @ each cap))
#let [unboxedT (#.Primitive unboxed (list))
arrayT (#.Primitive "#Array" (list unboxedT))
arrayC (`' ("lux check" (+0 "#Array" (+1 (+0 (~ (code.text unboxed)) (+0)) (+0)))
@@ -343,11 +343,11 @@
unboxedC (`' ("lux check" (+0 (~ (code.text unboxed)) (+0))
("jvm object null")))]
throwable (|> r.nat
- (:: @ map (n/% (++ (list.size throwables))))
- (:: @ map (function (_ idx)
- (|> throwables
- (list.nth idx)
- (maybe.default "java.lang.Object")))))
+ (:: @ each (n/% (++ (list.size throwables))))
+ (:: @ each (function (_ idx)
+ (|> throwables
+ (list.nth idx)
+ (maybe.default "java.lang.Object")))))
#let [throwableC (`' ("lux check" (+0 (~ (code.text throwable)) (+0))
("jvm object null")))]]
($_ seq
diff --git a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
index 2b09fb3e7..48efb99c9 100644
--- a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux
@@ -55,13 +55,13 @@
(-> Nat la.Analysis (r.Random la.Analysis))
(r.either (r.either (r/wrap output)
(do r.Monad<Random>
- [inputA (|> r.nat (:: @ map code.nat))
- num-cases (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
+ [inputA (|> r.nat (:: @ each code.nat))
+ num-cases (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
tests (|> (r.set number.Hash<Nat> num-cases r.nat)
- (:: @ map (|>> set.to-list (list/map code.nat))))
+ (:: @ each (|>> set.to-list (list/each code.nat))))
#let [bad-bodies (list.repeat num-cases (' []))]
good-body (gen-body arity output)
- where-to-set (|> r.nat (:: @ map (n/% num-cases)))
+ where-to-set (|> r.nat (:: @ each (n/% num-cases)))
#let [bodies (list.together (list (list.first where-to-set bad-bodies)
(list good-body)
(list.after (n/++ where-to-set) bad-bodies)))]]
@@ -92,13 +92,13 @@
(def: gen-recursion
(r.Random [Bit Nat la.Analysis])
(do r.Monad<Random>
- [arity (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
+ [arity (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
recur? r.bit
outputS (if recur?
(wrap (la.apply (list.repeat arity (' [])) (la.var 0)))
(do @
[plus-or-minus? r.bit
- how-much (|> r.nat (:: @ map (|>> (n/% arity) (n/max +1))))
+ how-much (|> r.nat (:: @ each (|>> (n/% arity) (n/max +1))))
#let [shift (if plus-or-minus? n/+ n/-)]]
(wrap (la.apply (list.repeat (shift how-much arity) (' [])) (la.var 0)))))
bodyS (gen-body arity outputS)]
@@ -107,7 +107,7 @@
(def: gen-loop
(r.Random [Bit Nat la.Analysis])
(do r.Monad<Random>
- [arity (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
+ [arity (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
recur? r.bit
self-ref? r.bit
#let [selfA (la.var 0)
@@ -116,7 +116,7 @@
(wrap (la.apply (list.repeat arity argA) selfA))
(do @
[plus-or-minus? r.bit
- how-much (|> r.nat (:: @ map (|>> (n/% arity) (n/max +1))))
+ how-much (|> r.nat (:: @ each (|>> (n/% arity) (n/max +1))))
#let [shift (if plus-or-minus? n/+ n/-)]]
(wrap (la.apply (list.repeat (shift how-much arity) (' [])) selfA))))
bodyS (gen-body arity outputS)]
diff --git a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
index 2c4c5f599..c2cf5ace9 100644
--- a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
+++ b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux
@@ -17,7 +17,7 @@
(context: "Procedures"
(<| (times +100)
(do @
- [num-args (|> r.nat (:: @ map (n/% +10)))
+ [num-args (|> r.nat (:: @ each (n/% +10)))
nameA (r.text +5)
argsA (r.list num-args gen-primitive)]
($_ seq
diff --git a/lux-jvm/test/test/luxc/lang/translation/js.lux b/lux-jvm/test/test/luxc/lang/translation/js.lux
index 83108c594..db4d5a205 100644
--- a/lux-jvm/test/test/luxc/lang/translation/js.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/js.lux
@@ -17,7 +17,7 @@
(def: upper-alpha-ascii
(r.Random Nat)
- (|> r.nat (:: r.Functor<Random> map (|>> (n/% +91) (n/max +65)))))
+ (|> r.nat (:: r.Functor<Random> each (|>> (n/% +91) (n/max +65)))))
(def: (test-primitive-identity synthesis)
(-> Synthesis Bit)
@@ -65,7 +65,7 @@
(context: "[JS] Objects."
(<| (times +100)
(do @
- [field (:: @ map code.text (r.text' upper-alpha-ascii +5))
+ [field (:: @ each code.text (r.text' upper-alpha-ascii +5))
value r.int
#let [empty-object (` ("js object"))
object (` ("js object set" (~ field) (~ (code.int value)) (~ empty-object)))
@@ -112,12 +112,12 @@
(context: "[JS] Arrays."
(<| (times +100)
(do @
- [length (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
- idx (|> r.nat (:: @ map (n/% length)))
+ [length (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
+ idx (|> r.nat (:: @ each (n/% length)))
overwrite r.nat
elems (|> (r.set number.Hash<Nat> length r.nat)
- (:: @ map set.to-list))
- #let [arrayS (` ("js array literal" (~+ (list/map code.nat elems))))]]
+ (:: @ each set.to-list))
+ #let [arrayS (` ("js array literal" (~+ (list/each code.nat elems))))]]
($_ seq
(test "Can get the length of an array."
(|> (run-js (` ("js array length" (~ arrayS))))
diff --git a/lux-jvm/test/test/luxc/lang/translation/jvm.lux b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
index 99af8d8c9..5aee41ce5 100644
--- a/lux-jvm/test/test/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
@@ -27,7 +27,7 @@
(context: "Conversions [Part 1]"
(<| (times +100)
(do @
- [int-sample (|> r.int (:: @ map (i/% 128)))
+ [int-sample (|> r.int (:: @ each (i/% 128)))
#let [frac-sample (int-to-frac int-sample)]]
(with-expansions [<2step> (template [<step1> <step2> <tag> <sample> <cast> <test>]
[(test (format <step1> " / " <step2>)
@@ -58,7 +58,7 @@
(context: "Conversions [Part 2]"
(<| (times +100)
(do @
- [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs)))
+ [int-sample (|> r.int (:: @ each (|>> (i/% 128) int/abs)))
#let [frac-sample (int-to-frac int-sample)]]
(`` ($_ seq
(~~ (template [<step1> <step2> <step3> <tag> <sample> <cast> <test>]
@@ -85,7 +85,7 @@
(context: "Conversions [Part 3]"
(<| (times +100)
(do @
- [int-sample (|> r.int (:: @ map (|>> (i/% 128) int/abs)))
+ [int-sample (|> r.int (:: @ each (|>> (i/% 128) int/abs)))
#let [frac-sample (int-to-frac int-sample)]]
(`` ($_ seq
(~~ (template [<step1> <step2> <step3> <step4> <tag> <sample> <cast> <test>]
@@ -110,16 +110,16 @@
(def: gen-nat
(r.Random Nat)
(|> r.nat
- (r/map (n/% +128))
+ (r/each (n/% +128))
(r.filter (|>> (n/= +0) not))))
(def: gen-int
(r.Random Int)
- (|> gen-nat (r/map nat-to-int)))
+ (|> gen-nat (r/each nat-to-int)))
(def: gen-frac
(r.Random Frac)
- (|> gen-int (r/map int-to-frac)))
+ (|> gen-int (r/each int-to-frac)))
(template [<domain> <generator> <tag> <type> <test> <augmentation> <+> <-> <*> </> <%> <pre> <post>]
[(context: (format "Arithmetic [" <domain> "]")
@@ -277,8 +277,8 @@
(context: "Array [Part 1]"
(<| (times +100)
(do @
- [size (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
- idx (|> r.nat (:: @ map (n/% size)))
+ [size (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
+ idx (|> r.nat (:: @ each (n/% size)))
valueZ r.bit
valueB gen-int
valueS gen-int
@@ -325,8 +325,8 @@
(context: "Array [Part 2]"
(<| (times +100)
(do @
- [size (|> r.nat (:: @ map (|>> (n/% +10) (n/max +1))))
- idx (|> r.nat (:: @ map (n/% size)))
+ [size (|> r.nat (:: @ each (|>> (n/% +10) (n/max +1))))
+ idx (|> r.nat (:: @ each (n/% size)))
valueZ r.bit
valueB gen-int
valueS gen-int
@@ -401,10 +401,10 @@
(def: instances
(List [Text (r.Random ls.Synthesis)])
- (let [gen-boolean (|> r.bit (:: r.Functor<Random> map code.bit))
- gen-integer (|> r.int (:: r.Functor<Random> map code.int))
- gen-double (|> r.frac (:: r.Functor<Random> map code.frac))
- gen-string (|> (r.text +5) (:: r.Functor<Random> map code.text))]
+ (let [gen-boolean (|> r.bit (:: r.Functor<Random> each code.bit))
+ gen-integer (|> r.int (:: r.Functor<Random> each code.int))
+ gen-double (|> r.frac (:: r.Functor<Random> each code.frac))
+ gen-string (|> (r.text +5) (:: r.Functor<Random> each code.text))]
(list ["java.lang.Boolean" gen-boolean]
["java.lang.Long" gen-integer]
["java.lang.Double" gen-double]
@@ -419,8 +419,8 @@
(do @
[#let [num-classes (list.size classes)]
#let [num-instances (list.size instances)]
- class-idx (|> r.nat (:: @ map (n/% num-classes)))
- instance-idx (|> r.nat (:: @ map (n/% num-instances)))
+ class-idx (|> r.nat (:: @ each (n/% num-classes)))
+ instance-idx (|> r.nat (:: @ each (n/% num-instances)))
exception-message (r.text +5)
#let [class (maybe.trusted (list.nth class-idx classes))
[instance-class instance-gen] (maybe.trusted (list.nth instance-idx instances))
@@ -512,7 +512,7 @@
(context: "Member [Field]"
(<| (times +100)
(do @
- [sample-short (|> r.int (:: @ map (|>> int/abs (i/% 100))))
+ [sample-short (|> r.int (:: @ each (|>> int/abs (i/% 100))))
sample-string (r.text +5)
other-sample-string (r.text +5)
#let [shortS (` ["short" ("jvm object cast" "java.lang.Short" "short"
@@ -581,7 +581,7 @@
(context: "Member [Method]"
(<| (times +100)
(do @
- [sample (|> r.int (:: @ map (|>> int/abs (i/% 100))))
+ [sample (|> r.int (:: @ each (|>> int/abs (i/% 100))))
#let [object-longS (` ["java.lang.Object" (~ (code.int sample))])
intS (` ["int" ("jvm object cast" "java.lang.Integer" "int"
("jvm convert long-to-int" (~ (code.int sample))))])