Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare
- fun {NewStack}
- fun{WrapStack L}
- fun{Push E}
- {WrapStack E|L}
- end
- fun{Pop E}
- case L
- of H|T then
- E=H
- {WrapStack T}
- else error
- end
- end
- in
- stack(push:Push pop:Pop)
- end
- in
- {WrapStack nil}
- end
- S S2 S3 S4 S5
- E1 E2 E3
- S = {NewStack}
- S2 = {{{S.push 4}.push 7}.push 9}
- {Browse S2}
- S3 = {S2.pop E1}
- S4 = {S3.pop E2}
- S5 = {S4.pop E3}
- {Browse E1#E2#E3}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement