[haskell] getting to elements in an n-tuple

  • From: PR Stanley <prstanley@xxxxxxxxxxxx>
  • To: haskell@xxxxxxxxxxxxx
  • Date: Mon, 23 Jun 2008 21:26:39 +0100

Hi folks
I thought I'd get things started with this question :
Is it possible to get to elements in an n-tuple using recursion? I know that the fst function is something like
f (x, _) = x
and the snd function, something like
snd (_, x) = x
Well, feel free to correct me if they're different. Anyway, I can't think of a recursive pattern such as the one probably used in (!!) which would also work for an n-tuple. Okay, with tuples you must know the exact size when specifying the type(s) of the elements, something that is not necessary with lists but does that fact alone make it impossible to apply recursion in the case of the n-tuples?
Thanks, Paul


Other related posts:

  • » [haskell] getting to elements in an n-tuple