How can I define a function that is accepting all the tuples(1 to 22) as argument, I have something as follows in mind:
def foo (v=Tuple) =...
foo((1,2))
foo((1,2,3))
EDIT:
To answer the comment: I am actually trying to create a Tensor class which is a set of values and a set of indices. The indices can be covariant and/or contravariant (cf Wikipedia1 and Wikipedia2). I wanted to have a special syntax like Tensor((1,2),(3,4),values)
which would create a tensor with values
, two covariant indices having length (2,3)
and two contravariant indices with length (3,4)
. So using this syntax I could also write Tensor((1,2,3),3,values)
(with an implicit Int=>Tuple1).
I agree that Tuple
s are not suitable for this, better to use List
s. However the syntax is not so nice then...