A small doubt

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
20 Oct 2001 06:07:43 GMT


Sat, 20 Oct 2001 10:58:02 +0800 (GMT-8), Saswat Anand <saswatan@comp.nus.edu.sg> 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 * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK