aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/synthesizer/variable.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/synthesizer/variable.lux')
-rw-r--r--new-luxc/source/luxc/synthesizer/variable.lux44
1 files changed, 21 insertions, 23 deletions
diff --git a/new-luxc/source/luxc/synthesizer/variable.lux b/new-luxc/source/luxc/synthesizer/variable.lux
index 01ad101fa..3ce9f2678 100644
--- a/new-luxc/source/luxc/synthesizer/variable.lux
+++ b/new-luxc/source/luxc/synthesizer/variable.lux
@@ -1,22 +1,20 @@
(;module:
lux
- (lux (data [bool "B/" Eq<Bool>]
- [text "T/" Eq<Text>]
- [number]
- (coll [list "L/" Functor<List> Fold<List> Monoid<List>]
+ (lux (data [number]
+ (coll [list "list/" Fold<List> Monoid<List>]
["s" set])))
(luxc (lang ["la" analysis]
- ["ls" synthesis])
- (synthesizer ["&;" function])))
+ ["ls" synthesis]
+ [";L" variable #+ Variable])))
(def: (bound-vars path)
- (-> ls;Path (List ls;Variable))
+ (-> ls;Path (List Variable))
(case path
(#ls;BindP register)
(list (nat-to-int register))
(^or (#ls;SeqP pre post) (#ls;AltP pre post))
- (L/compose (bound-vars pre) (bound-vars post))
+ (list/compose (bound-vars pre) (bound-vars post))
_
(list)))
@@ -31,24 +29,24 @@
(path-bodies post)
(#ls;AltP pre post)
- (L/compose (path-bodies pre) (path-bodies post))
+ (list/compose (path-bodies pre) (path-bodies post))
_
(list)))
(def: (non-arg? arity var)
- (-> ls;Arity ls;Variable Bool)
- (and (&function;local? var)
+ (-> ls;Arity Variable Bool)
+ (and (variableL;local? var)
(n.> arity (int-to-nat var))))
-(type: Tracker (s;Set ls;Variable))
+(type: Tracker (s;Set Variable))
(def: init-tracker Tracker (s;new number;Hash<Int>))
(def: (unused-vars current-arity bound exprS)
- (-> ls;Arity (List ls;Variable) ls;Synthesis (List ls;Variable))
+ (-> ls;Arity (List Variable) ls;Synthesis (List Variable))
(let [tracker (loop [exprS exprS
- tracker (L/fold s;add init-tracker bound)]
+ tracker (list/fold s;add init-tracker bound)]
(case exprS
(#ls;Variable var)
(if (non-arg? current-arity var)
@@ -59,14 +57,14 @@
(recur memberS tracker)
(#ls;Tuple membersS)
- (L/fold recur tracker membersS)
+ (list/fold recur tracker membersS)
(#ls;Call funcS argsS)
- (L/fold recur (recur funcS tracker) argsS)
+ (list/fold recur (recur funcS tracker) argsS)
(^or (#ls;Recur argsS)
(#ls;Procedure name argsS))
- (L/fold recur tracker argsS)
+ (list/fold recur tracker argsS)
(#ls;Let offset inputS outputS)
(|> tracker (recur inputS) (recur outputS))
@@ -75,16 +73,16 @@
(|> tracker (recur testS) (recur thenS) (recur elseS))
(#ls;Loop offset initsS bodyS)
- (recur bodyS (L/fold recur tracker initsS))
+ (recur bodyS (list/fold recur tracker initsS))
(#ls;Case inputS outputPS)
- (let [tracker' (L/fold s;add
- (recur inputS tracker)
- (bound-vars outputPS))]
- (L/fold recur tracker' (path-bodies outputPS)))
+ (let [tracker' (list/fold s;add
+ (recur inputS tracker)
+ (bound-vars outputPS))]
+ (list/fold recur tracker' (path-bodies outputPS)))
(#ls;Function arity env bodyS)
- (L/fold s;remove tracker env)
+ (list/fold s;remove tracker env)
_
tracker