
28 Sep
2010
28 Sep
'10
10:41 a.m.
Hi,
On 28 September 2010 15:07, Martin Tomko
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. Best, Ozgur