zips and maps
Conal Elliott
conal@microsoft.com
Fri, 9 Mar 2001 07:07:55 -0800
Note also that zipMap is the classic S combinatory if you think of lists as
functions over the natural numbers, so there's something especially
compelling about it. Similarly, repeat is K. From zipMap & repeat, you can
easily define map, zip, zipWith, zipWith3, etc.
s = zipWith ($)
k = repeat
mapT f xs = s (k f) xs
zipWithT f as bs = s (mapT f as) bs
zipT = zipWithT (,)
zipWith3T f as bs cs = s (zipWithT f as bs) cs
- Conal
-----Original Message-----
From: Mieszko Lis [mailto:elf@sandburst.com]
Sent: Thursday, March 08, 2001 6:30 PM
To: Eric Allen Wohlstadter
Cc: haskell-cafe@haskell.org
Subject: Re: zips and maps
Eric Allen Wohlstadter wrote:
>
> I find myself very often needing to use this function and was wondering if
> there was already a way to do this using zip,maps, and folds.
Do you mind using zipWith? How about
zipMap = zipWith ($)
..?
-- Mieszko
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe