About TSS The following Oz code is derived from the examples provided in the book:
      "The Seasoned Schemer" by Daniel P. Friedman and Matthias Felleisen.
      http://www.ccs.neu.edu/home/matthias/BTSS/

TSS Chapter #19 Examples in Oz

% Defined in previous chapters
fun {IsZero X} X == 0 end
fun {Add1 N} N + 1 end
fun {Sub1 N} N - 1 end

fun {Cons Car Cdr}
   X = {NewCell Car}
   Y = {NewCell Cdr}
in
   fun {$ Selector}
      {Selector X Y}
   end
end
fun {Car C}
   {C fun {$ A D} @A end}
end
fun {Cdr C}
   {C fun {$ A D} @D end}
end


%%%%%%%%%%%%%%%%%%% The Little Schemer - Chapter - 19 %%%%%%%%%%%%%%%%%%%%%%

% 19.3
fun {Deep M}
   if M == 0
      then pizza
      else {Deep {Sub1 M}}|nil
   end
end

% 19.2
{Browse 2#{Deep 6}}

% 19.11
fun {SixLayers P}
   {Cons
      {Cons
         {Cons
            {Cons
               {Cons
                  {Cons P nil}
                  nil}
               nil}
            nil}
         nil}
      nil}
end

% 19.13
fun {FourLayers P}
   {Cons
      {Cons
         {Cons
            {Cons P nil}
            nil}
         nil}
      nil}
end

Chris Rathman / Chris.Rathman@tx.rr.com