Lucassim

Queue

Jul 16th, 2013
485
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. declare
  2.  
  3. fun {Append L V}
  4.    case L of
  5.       nil then [V]
  6.    [] X|Xr then
  7.       X|{Append Xr V}
  8.    end
  9. end
  10.  
  11.  
  12.  
  13.    
  14. class Cola\4
  15.    attr
  16.       L
  17.    meth inic
  18.       L:=nil
  19.    end
  20.  
  21.    meth push(Val)
  22.       L:={Append @L Val}
  23.    end
  24.  
  25.    meth pop(?Val)
  26.       case @L of
  27.      nil then Val=nil
  28.       [] X|Xr then
  29.      Val=X
  30.      L:=Xr
  31.       end
  32.    end
  33.  
  34.  
  35.    meth browse
  36.       {Browse @L}
  37.    end
  38.    
  39.    
  40. end
  41.  
  42. declare C={New Cola inic}
  43. {C push(1)}
  44. {C push(2)}
  45. {C push(3)}
  46. {C browse}
  47.  
  48. local A B in
  49. {C pop(A)}
  50.    {C browse}
  51.    {C pop(B)}
  52. {C browse}
  53.    {Browse A#B}
  54. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×