Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare
- fun {Append L V}
- case L of
- nil then [V]
- [] X|Xr then
- X|{Append Xr V}
- end
- end
- class Cola\4
- attr
- L
- meth inic
- L:=nil
- end
- meth push(Val)
- L:={Append @L Val}
- end
- meth pop(?Val)
- case @L of
- nil then Val=nil
- [] X|Xr then
- Val=X
- L:=Xr
- end
- end
- meth browse
- {Browse @L}
- end
- end
- declare C={New Cola inic}
- {C push(1)}
- {C push(2)}
- {C push(3)}
- {C browse}
- local A B in
- {C pop(A)}
- {C browse}
- {C pop(B)}
- {C browse}
- {Browse A#B}
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement