Sat, 20 Oct 2001 10:58:02 +0800 (GMT-8), Saswat Anand <[EMAIL PROTECTED]> pisze:

>   I am wondering why this function should not work with input [x,y]
> (list with two elements) too, since third element is not referenced.

What a pattern matches is independent from which of the variables
it binds are used.

The pattern [a,b,c], or equivalently a::b::c::[], matches lists of
length 3. You can write a::b::_ to match all lists of length 2 or more.

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to