Guest User

Untitled

a guest
Mar 10th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 1.32 KB | None | 0 0
  1. declare
  2. fun {SimpleJack Source Temp FinalList CurrState}
  3.    case Source
  4.    of nil then
  5.       local A InOrder in
  6.      {String.toAtom Temp A}
  7.      {List.reverse A InOrder}
  8.      InOrder|FinalList
  9.       end
  10.    [] H|T then
  11.       case CurrState
  12.       of 0 then %not sure what we're dealing with...need to determine
  13.      local B in
  14.         {Char.isDigit H B}
  15.         if B then
  16.            {SimpleJack Source Temp FinalList 1}
  17.         else
  18.            {SimpleJack Source Temp FinalList 2}
  19.         end
  20.      end
  21.       [] 1 then %dealing with numbers
  22.      local B in
  23.         {Char.isDigit H B}
  24.         if B then
  25.            {SimpleJack T H|Temp FinalList 1}
  26.         else %state change. take the temp list, atomize it and add to Final List
  27.            local A InOrder in
  28.           {String.toAtom Temp A}
  29.           {List.reverse A InOrder}
  30.           {SimpleJack Source nil InOrder|FinalList 2}
  31.           end
  32.         end
  33.      end
  34.       [] 2 then %dealing with letters
  35.      local B in
  36.         {Char.isDigit H B}
  37.         if B then %state change.
  38.            local A InOrder in
  39.           {String.toAtom Temp A}
  40.           {List.reverse A InOrder}
  41.           {SimpleJack Source nil InOrder|FinalList 1}
  42.            end
  43.         else
  44.            {SimpleJack T H|Temp FinalList 2}
  45.         end
  46.      end
  47.       end
  48.    end
  49. end
  50.  
  51. local FinalListOfTokens in
  52.    FinalListOfTokens = {SimpleJack "abcd1234fdsa5438" nil nil 0}
  53.    {Browse FinalListOfTokens}
  54. end
Add Comment
Please, Sign In to add comment