ldevillez

Collection

Nov 18th, 2016
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 0.38 KB | None | 0 0
  1.     attr a1
  2.     meth init a1 := nil end
  3.     meth put(X) a1:= X|@a1 end
  4.     meth get($) local X in X = @a1.1 a1:= (@a1.2) X end end
  5.     meth isEmpty($) if @a1 == nil then true else false end end
  6.     meth union(C)
  7.        local Y in
  8.       {C isEmpty(Y)}
  9.       if Y == false then
  10.          local X in
  11.         {C get(X)}
  12.         {self put(X)}
  13.         {self union(C)}
  14.          end
  15.       end
  16.        end
  17.     end
Add Comment
Please, Sign In to add comment