Advertisement
ldevillez

Palindrome

Nov 18th, 2016
2,527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 0.35 KB | None | 0 0
  1. S = {New Sequence init}
  2. for E in Xs do
  3.     {S insertFirst(E)}
  4. end
  5.  
  6. fun {Check}
  7.     local A B C in
  8.         {S isEmpty(A)}
  9.         if A then true
  10.         else
  11.             {S first(B)}
  12.             {S last(C)}
  13.             if B == C then
  14.                 {S removeFirst}
  15.                 {S removeLast}
  16.                 {Check}
  17.             else
  18.             false
  19.             end
  20.         end
  21.     end
  22. end
  23. in
  24.     {Check}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement