1:- module(cleaning, [clean/2, unwrap/2, return/3, unwrap_r/2, op(150, xfx, ...)]).    2
    3clean(atomic(A), Res)
    4 => Res = atomic(A).
    5
    6clean(L...U, Res)
    7 => Res = L...U.
    8
    9clean([], Res)
   10 => Res = [].
   11 
   12clean(Expr, Expr1),
   13    compound(Expr)
   14 => mapargs(clean, Expr, Expr1).
   15
   16clean(A, Res),
   17    atomic(A)
   18 => Res = atomic(A).
   19
   20unwrap(atomic(A), Res)
   21 => Res = A.
   22
   23unwrap(A...A, Res)
   24 => Res = A.
   25
   26unwrap(A, Res),
   27    compound(A)
   28 => mapargs(unwrap, A, Res).
   29
   30unwrap(A, Res)
   31 => Res = A.
   32
   33unwrap_r(A, Res)
   34 => unwrap_r_(A, Res).
   35
   36unwrap_r_(atomic(A), Res)
   37 => Res = A.
   38
   39unwrap_r_(A, _Res),
   40    A = _..._
   41 => fail.
   42
   43unwrap_r_(A, Res),
   44    compound(A)
   45 => mapargs(unwrap_r_, A, Res).
   46
   47return(L, U, Res),
   48    L = U
   49 => clean(L, Res).
   50
   51return(L, U, Res),
   52   atomic(L),
   53   atomic(U)
   54 => Res = L...U