[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SELECT



Date: 14 Dec 1978 0858-EST
Sender: LEWIS at BBN-TENEXD
Subject: SELECT
From: LEWIS at BBN-TENEXD
To: teitelman at MAXC2, masinter at MAXC2
Cc: hartley, yonke
Message-ID: <[BBN-TENEXD]14-Dec-78 08:58:44.LEWIS>

[Below is the documentation for a new system function SELECT.  The
documentation is written assuming it follows the description of SELECTQ
in the manual (Section 5).  Subscripts are enclosed in <> (e.g.,
"e sub i" is written as e<i>).]

=============================================================

select[x;clause<1>;clause<2>;...;clause<n>;default]

        -  SELECT is similiar to SELECTQ except that the selection
           key (s<i>) is evaluated before the EQ test.

           That is, if s<i> is an atom, the value of x is tested to
           see if it is EQ to the value of s<i>.  If so, the
           expressions e<1i> ...  e<ki> are evaluated in sequence,
           and the value of the SELECT is the value of the last
           expression evaluated, i.e., e<ki>.

           If s<i> is a list, the value of x is compared with the
           value of each element of s<i>, and if x is EQ to any one
           of them, then e<1i> to e<ki> are evaluated in turn as
           above.  Note that if is s<i> is (FOO FIE) the test is
                (OR (EQ x FOO) (EQ x FIE)).
           To get the test
                (EQ x (FOO FIE)),
           s<i> should be ((FOO FIE)).

           If clause<i> is not selected in one of the two ways
           described, clause<i>+1 is tested, etc., until all the
           clause's have been tested.  If none is selected, the value
           of the SELECT is the value of default.  default must be
           present.

           SELECT compiles open, and is therefore very fast; however,
           it will not work if the value of x is a large integer or
           floating point number, since SELECT uses EQ for all
           comparisons.

-------