MLET


Syntax

 
mlet ( pattern  matching-list &optional binding-list)
    { declaration }*
    { form }*
Description
MLET calls  matches  ( pattern  matching-list ) providing resulting variable bindings for declarations & forms in its progbody.

Nested MLET forms scope variable bindings lexically.
 

Examples
 
> (mlet ('(the ?subj ate the ?obj) '(the mouse ate the cheese))
    (list #?subj #?obj))
==> (MOUSE CHEESE)
 

> (mlet ('(= ?2nd == ?last) '(a b c d e f g))
    (list #?2nd #?last))
==> (B G)
 

> (mlet ('(?det ??act ?det ??obj)
         '(the cat sat on the red mat))
     (list #?act #?obj))
==> ((cat sat on) (red mat))
 

> (mlet ('(?first ==) '(a b c))
     (mlet ('(== ?first ??rest) '(t r a v e l l e r))
        #?rest))
==> (v e l l e r)