Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 0.82 KB | None | 0 0
  1. declare
  2. fun {Incorpore L1 L2}
  3.    case L1
  4.    of A|B then
  5.       case L2 of H|T then
  6.      if H == A then {Incorpore B T}
  7.      else {Incorpore L1 T} end
  8.       else false end
  9.    else true end
  10. end
  11. fun {Apex LL}
  12.    fun {Avant X L}
  13.       fun {Apres B C}
  14.      case C of H|T then
  15.         if {Incorpore B H} then {Apres H T}
  16.         else false end
  17.      else true end
  18.       end
  19.    in
  20.       case L of H|T then
  21.      if {Incorpore H X} then
  22.         if {Apres H T} then H|{Avant H T}
  23.         else {Avant H T} end
  24.      else nil end
  25.       else nil end
  26.    end
  27. in
  28.    case LL of H|T then
  29.       case {Avant H T}
  30.       of A|nil then true
  31.       else false end
  32.    else false end
  33. end
  34. {Browse {Incorpore [2 5 4] [3 2 8 2 6 5 3 4]}}
  35. {Browse {Incorpore [1 2] [2 1]}}
  36. {Browse {Apex [[3 5 2 4] [3 2 4] [5 3 4 2 6 3]]}}
  37. {Browse {Apex [[3 5 2 4] [3 2 4] [5 3 4 2 6 4]]}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement