More of curiosity question at the moment as I attempt to translate SICP, but does Oz have he ability to compose functions in the manner of composition operator? Taking a simple ML example:

     val car = hd
     val cdr = tl
     val cadr = car o cdr

And extrapolating that idea to my pseudo Oz code, I'd have something along the lines of:

     fun {CAR L} L.1 end
     fun {CDR L} L.2 end
     fun {CADR L} CAR o CDR end

To relate the question to CTM, the book gives a Haskell example in section 4.7.2 that has an expression within the sqrt function:

   dropWhile (not . gooEnough)

where the dot operator in Haskell does effectively the same that the o operator does above.

Thanks,
Chris Rathman


_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to