Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare
- fun{Modes L}
- local fun{Flatten L}
- case L
- of nil then nil
- [] nil|T then {Flatten T}
- [] (H1|T1)|T then {Flatten H1|T1|T}
- [] X|T then X | {Flatten T}
- [] X then X
- end
- end
- fun{AddPlus L M}
- if L.2 == nil then {Flatten M|L.1|nil}
- elseif L.1>L.2.1 then {AddMoins L.2 M|L.1}
- else {AddPlus L.2 M}
- end
- end
- fun{AddMoins L M}
- if L.2==nil then {Flatten M|L.1|nil}
- elseif L.1<L.2.1 then {AddPlus L.2 M}
- else {AddMoins L.2 M}
- end
- end
- M
- Fct
- in
- fun{Fct L M}
- {Flatten {AddPlus L M}}
- end
- {Fct L nil}
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement