[Haskell-cafe] Bifold: a simultaneous foldr and foldl

Larry Evans cppljevans at suddenlink.net
Fri Dec 3 22:41:56 CET 2010


On 12/01/10 21:35, Larry Evans wrote:
> On 11/30/10 13:43, Noah Easterly wrote:
[snip]
>> Thanks, Larry, this is some interesting stuff.
>>
>> I'm not sure yet whether Q is equivalent - it may be, but I haven't been
>> able to thoroughly grok it yet.
>>
[snip]
> 
> Hi Noah,
> 
> The attached is my attempt at reproducing your code and also
> contains an alternative attempt at emulating the code in
> section 12.5 of:
> 
>   http://www.thocp.net/biographies/papers/backus_turingaward_lecture.pdf
> 
The attached code is a revision of my previous if_recur attempt
at emulated the section 12.5 code.  This revision added the i
function from the seciton 12.5 (instead of delegating that
task to the h function).  The 2nd attachment shows the output.
It shows that by modifying the args to if_recur, you can
reproduce the output from foldl or foldr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IfRecur.hs
Type: text/x-haskell
Size: 3161 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101203/1b567cfe/attachment.hs>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: if_recur.palin_foldl_foldr.run
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101203/1b567cfe/attachment.txt>


More information about the Haskell-Cafe mailing list