[Haskell-cafe] Map in Terms of Fold in terms of Map

Neil Mitchell ndmitchell at gmail.com
Mon Mar 16 12:31:58 EDT 2009


Hi Mark,

What's the definition of foldr in terms of map? As far as I was aware,
its not possible.

And as it happens, map is (or is sometimes) defined in term of foldr
:-) While you can use mutual recursion, you can't define a in terms of
b and b in terms of a unless one of them actually does something at
the end - so it does depend exactly what the definitions are.

Thanks

Neil

2009/3/16 Mark Spezzano <mark.spezzano at chariot.net.au>:
> Hi,
>
>
>
> I’ve noticed that it’s possible to define map as foldr and foldr as a map.
> Would this be sensible to define both in terms of each other in the Prelude?
>  i.e mutually recursive?
>
>
>
> Cheers,
>
>
>
> Mark
>
>
>
> No virus found in this outgoing message.
> Checked by AVG.
> Version: 7.5.557 / Virus Database: 270.11.15/2003 - Release Date: 15/03/2009
> 2:07 PM
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list