Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 0.85 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}
  8.      end
  9.       else false
  10.       end
  11.    else true
  12.    end
  13. end
  14. fun {Apex LL}
  15.    fun {Avant X L}
  16.       fun {Apres B C}
  17.      case C of H|T then
  18.         if {Incorpore B H} then {Apres H T}
  19.         else false
  20.         end
  21.      else true
  22.      end
  23.       end
  24.    in
  25.       case L of H|T then
  26.      if {Incorpore H X} then
  27.         if {Apres H T} then H|{Avant H T}
  28.         else {Avant H T} end
  29.      else nil end
  30.       else nil end
  31.    end
  32. in
  33.    case LL of H|T then
  34.       case {Avant H T}
  35.       of A|nil then true
  36.       else false end
  37.    else false
  38.    end
  39. end
  40. {Browse {Incorpore [2 5 4] [3 2 8 2 6 5 3 4]}}
  41. {Browse {Incorpore [1 2] [2 1]}}
  42. {Browse {Apex [[3 5 2 4] [3 2 4] [5 3 4 2 6 3]]}}
  43. {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