Dylan Design Notes

#34: Select Ordering	(Clarification)

Version 1, January 1994
Copyright (c) 1993-1994, Apple Computer

This design note specifies the order of evaluation for the select 
statement.

-------------------------------------------------------------------

Specify that select clauses are tested in order, until one is found which 
produces a match, in which case the following clauses are not tested.  
Since testing stops when the first match is found, it is irrelevant 
whether the test function would also have returned true if called on 
later match-list elements of the same clause or on match-list elements of 
later clauses.

The match-object expressions in the clauses are evaluated in order.  Once 
a match is found, the following match-object expressions, in this and 
subsequent clauses, are not evaluated at all.

-------------------------------------------------------------------

Example:

select (x instance?)
  <integer> => "It's an integer";
  <number> => "Fractional number";
  otherwise  "Not a number!"
end select


