Page Numbers: Yes X: 310 Y: 10.42" First Page: 1
Margins: Top: 1.0" Bottom: 1.5"
Heading:
3-LISP WORKING GUIDE#13: Patterns
———————————————————————————————————————————
Issue #13:Parameter patterns
Description:Exactly how powerful will the pattern matcher be? Will it spread rails as well as sequences? What about &OPTIONAL and &REST features? What’s an error as opposed to a failure? How does pattern matching fit in with LET expressions?
Status:Unresolved
Last Edited:September 20, 1982 (Jim des Rivières)
———————————————————————————————————————————
1> ((lambda simple x x) . [1 2 3]); this is 3-LISP
=> [1 2 3]
1> ((lambda simple [x] x) . [1])
=> 1
1> ((lambda simple [x] x) . ’[1])
; ’[1] treated like [’1]
=> ’1
The last example, which shows a rail pattern matching a handle, illustrates a handy (nay, essential) feature when defining macros. Unfortunately, it has an ugly side-effect:
1> (type . ’[a]); This isn’t in error!
=> ’atom
1> (type . [’a])
; Treated like preceding expression
=> ’atom