From 19c589edc2c1dd77550e26d4f5cf78ec772da337 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 31 Oct 2017 22:26:13 -0400 Subject: - Migrated the format of analysis nodes from a custom data-type, to just Code nodes. --- new-luxc/source/luxc/synthesizer/variable.lux | 44 +++++++++++++-------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'new-luxc/source/luxc/synthesizer/variable.lux') 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] - [text "T/" Eq] - [number] - (coll [list "L/" Functor Fold Monoid] + (lux (data [number] + (coll [list "list/" Fold Monoid] ["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)) (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 -- cgit v1.2.3