I won't try to explain functional dependencies, because I don't
understand them all that well, there is documentation, and others on
this list could explain them much better than I can.
Here is an example of how to implement a polymorphic zip (used together
with the ZipFunctor I defined earlier):
Sun, 8 Apr 2001 12:38:27 -0400, Dylan Thurston <[EMAIL PROTECTED]> pisze:
> > class Map c' a' c a | c' -> a', c -> a, c' a -> c, c a' -> c' where
> > map :: (a' -> a) -> c' -> c
> > ...
> > -- zipWith is similar to map, only more complicated:
> > class ZipWith c1 a1 c2 a2 c a
Matt Harden <[EMAIL PROTECTED]> writes:
>
>zip :: ZipFunctor f => f a -> f b -> f (a,b)
>zip = zipWith (,)
>zip3 :: ZipFunctor f => f a -> f b -> f c -> f (a,b,c)
>zip3 = zipWith3 (,,)
>
> One can easily create ZipFunctor instances for trees and other data
> structures. I can
On Sun, Apr 08, 2001 at 11:34:45AM +, Marcin 'Qrczak' Kowalczyk wrote:
> ...
> I found a way to express map and zipWith, but it's quite ugly. I would
> be happy to have a better way.
>
> class Map c' a' c a | c' -> a', c -> a, c' a -> c, c a' -> c' where
> map :: (a' -> a) -> c' -
Sat, 07 Apr 2001 20:46:00 -0500, Matt Harden <[EMAIL PROTECTED]> pisze:
>class (Functor f) => ZipFunctor f where
> -- "zap" stands for "zip apply"
> -- it applies a set of functions to a set
> -- of arguments, producing a set of results
> zap :: f (a->b) -> f a -> f b
On Sat, Apr 07, 2001 at 08:46:00PM -0500, Matt Harden wrote:
> In a lazy language like Haskell, a list is essentially the same as a
> lazy stream
Sorry. I've been using Haskell a few months now, and I really did
know that, but got so confused going round in circles with a similar
problem I'm wor
In a lazy language like Haskell, a list is essentially the same as a
lazy stream, though I'm not well versed in the parallel stuff...
Anyway, it can be quite desirable to be able to "zip" together data
structures other than lists; trees or arrays for example. The standard
prelude and library doe
Is there a class that both lists and lazy streams could implement, so
that zip et al could be more general? The distinction between 2 and 3
below seems a bit arbitrary. Something like fmap/Functor? (If there
is, I guess it could apply to 1 too?; if not, why not - is it
impractical (efficiency?
Tom Pledger wrote:
>
> Toby Watson writes:
> | Intuitively the following scenarios seem to be related, can anyone
> | point my in the direction of formal work on this, or give me the
> | formal terms I need to search around?
> |
> | 1. Adding two integers together: Int -> Int -> Int
> |
> |
On Fri, 6 Apr 2001, Tom Pledger wrote:
> If you're adding every element of the first list to every element of
> the second list, it's sometimes called diagonalisation.
I do not know where this definition came from but it
does not make sense to me. It is zipping that looks
Toby Watson writes:
| Intuitively the following scenarios seem to be related, can anyone
| point my in the direction of formal work on this, or give me the
| formal terms I need to search around?
|
| 1. Adding two integers together: Int -> Int -> Int
|
| 2. Adding two lists of Integers to
Intuitively the following scenarios seem to be related, can anyone point my
in the direction of formal work on this, or give me the formal terms I need
to search around?
1. Adding two integers together: Int -> Int -> Int
2. Adding two lists of Integers together: [Int] -> [Int] -> [Int]
3. Addin
12 matches
Mail list logo