Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \insert 'Visualizer.oz'
- \insert 'List.oz'
- \insert 'ApplyMoves.oz'
- \insert 'Find.oz'
- %FewerFind
- declare
- fun {FewerFind Ms Os Ts Ys}
- case Ys
- of nil then nil
- [] Y|Yr then
- if {Member Ms Y} then
- case {SplitTrain Ms Y}
- of Hs#Tr then
- local HsL TrL
- in
- HsL = {Length Hs}
- TrL = {Length Tr}
- trackA(TrL+1)|trackB(HsL)|trackA(~1)|{FewerFind nil Hs Tr Yr}
- end
- end
- elseif {Member Os Y} then
- case {SplitTrain Os Y}
- of Hs#Tr then
- local HsL TrL
- in
- HsL = {Length Hs}
- TrL = {Length Tr}
- trackB(~HsL)|trackA(HsL)|trackB(~1)|{FewerFind nil Tr {Append Hs Ts} Yr}
- end
- end
- elseif {Member Ts Y} then
- case {SplitTrain Ys Y}
- of Hs#Tr then
- local HsL TrL
- in
- HsL = {Length Hs}
- TrL = {Length Tr}
- trackA(~HsL)|trackB(HsL)|trackA(~1)|{FewerFind nil {Append Hs Os} Tr Yr}
- end
- end
- end
- end
- end
- {Browse {FewerFind [a b] nil nil [b a]}}
Add Comment
Please, Sign In to add comment