Name

case

Usage

macro

Syntax

(case key-form clause*)

Description

clause := '(' test-form form* ')'
test-form := form | '(' form* ')'

Each test-form is a list that starts with an evaluated non-list item or a list of evaluated items. A clause matches the key-form if the key-form is equal or = to one of the items. The value of the clause is the value of the implicit do block consisting of the rest of the clauses. The non-list items true and otherwise indicate that the clause matches anything.

user 1 > (let s 'aap)
it: aap
user 2 > (case s
             (('teun 'mies)
                  (print-line 1))
             ('aap
                  (print-line 2))
             (otherwise
                  (print-line 3)))
2
it: null