[Haskell-beginners] ignature for a list of a set length
ozgurakgun at gmail.com
Tue Sep 28 10:41:38 EDT 2010
On 28 September 2010 15:07, Martin Tomko <martin.tomko at geo.uzh.ch> wrote:
> I want to have a function that acts only on lists of length 3 (I have a
> function that filters a list of lists and returns only those of that
> length). I guess I could change them into tuples (is there a way?)
Well if both the producer and the consumer of this value are your own
functions, you can use something other than a list. You can also implement a
length indexed list, or use such an implementation but it will be overkill
for this task, I think.
The two options are either implementing a wrapper type with three fields, or
using a 3-tuple.
I would use a 3-tuple in both the producer and consumer functions.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners