RE: foldr in terms of map

2003-07-03 Thread Glynn Clements
Hal Daume wrote: > > Yeah, but given that sequence_ is essentially the direct monadic > > translation of fold: > > that might be considered cheating (i.e. we can implement fold using > > only map and fold, although the fold can be "disguised"). > > > > As mentioned above, sequence_ etc are essen

RE: foldr in terms of map

2003-07-01 Thread Hal Daume
Hi, quick reply :)...i've reordered some of what you've said (i hope you don't mind!) > However the monad is defined, sequence_ has to process the entire list > before anything can be determined about the result. The entire result > of (>>) depends upon both arguments, whereas you can deduce the h

Re: foldr in terms of map

2003-07-01 Thread Glynn Clements
Hal Daume wrote: > > map f = foldr ((:) . f) [] > > as I understand it, this is essentially because foldr encapsulates all > primitive recursive functions and since map is primitive recursive, we > can implement it in terms of a fold. > > one thing that is interesting to note is that if we are