[erlang-questions] newbie: how to ignore the rest in a variable length tuple?

Paul Fisher pfisher@REDACTED
Sat Mar 1 02:03:36 CET 2008


On Fri, 2008-02-29 at 16:53 -0800, Lev Walkin wrote:
> Paul Fisher wrote:
> > c1( {x, B, C, D} ) -> ok;
> > c1( Y ) when is_tuple(Y), element(1, Y) =:= y -> ok.
> > 
> > if you want to restrict Y to 4 or 5 elements only, then add:
> > 
> >  length(Y) >= 4, length(Y) =< 5
> > 
> > to the list of guards.
> 
> 
> tuple_size, perhaps

Of course, thanks for catching that.


-- 
paul





More information about the erlang-questions mailing list