On Fri, Jan 24, 2003 at 03:07:48PM +0100, Thomas Johnsson wrote: > > > > > Yes I am. But the + should be in CPS form anyways to be perfectly > > correct, so: natural n c = (+) n 1 (\m -> c n : (natural m)) > > > > I think Jerzy (in his usual polite manner :-) refers to the every group has it's moshez (don't ask :) > cons operator, the :, which in a strongly typed language > the right argument, the tail, is required to be a list. > The function is declared as natural n c = ..., > so (natural m) must be a funcion.
Well, let's pretend I made my own datatype then that supports the right type class interfaces, and has a function as a tail :) But also, this brings me to another idea! Data structures should be built from lambdas and CPS! For example, a list of integers: 1 : 2 : 3 list = \c -> c 1 (\c -> c 2 nil) now: natural n c = c n (natural n+1) full blown CPS: natural n c = (+) n 1 (\m -> c n (natural m)) so, here (nautral m) _is_ a list just like the above list! > Might I guess that you come from the lisp / scheme world? No. :) > > Regards, > -- Thomas > > _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell