Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun {NFullAdder S1 S2}
- local
- fun{Reverse L Acc}
- case L of H|T then
- if Acc==nil then {Reverse T H|nil}
- else {Reverse T H|Acc}
- end
- else Acc
- end
- end
- fun{Listo L1 L2 Prev LSol}
- local
- X
- Y
- in
- case L1#L2 of (I|T)#(J|V) then
- {FullAdder I J Prev X Y}
- {Listo T V X Y|LSol}
- else LSol#Prev
- end
- end
- end
- fun{NListo L1 L2}
- case L1#L2 of (H|T)#(I|V) then
- {Listo {Reverse H nil} {Reverse I nil} 0 nil}|{NListo T V}
- else nil
- end
- end
- in
- {NListo S1 S2}
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement