mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Adding underscore macro tests.
This commit is contained in:
parent
1857b80bc8
commit
524edc0660
1 changed files with 20 additions and 0 deletions
|
@ -439,6 +439,26 @@
|
|||
(be-like-begin3 sequence3)
|
||||
(test 5 (sequence3 2 3 4 5))
|
||||
|
||||
;; underscore
|
||||
(define-syntax count-to-2
|
||||
(syntax-rules ()
|
||||
((_) 0)
|
||||
((_ _) 1)
|
||||
((_ _ _) 2)
|
||||
((_ . _) 'many)))
|
||||
(test '(2 0 many)
|
||||
(list (count-to-2 a b) (count-to-2) (count-to-2 a b c d)))
|
||||
|
||||
(define-syntax count-to-2_
|
||||
(syntax-rules (_)
|
||||
((_) 0)
|
||||
((_ _) 1)
|
||||
((_ _ _) 2)
|
||||
((x . y) 'fail)))
|
||||
(test '(2 0 fail fail)
|
||||
(list (count-to-2_ _ _) (count-to-2_)
|
||||
(count-to-2_ a b) (count-to-2_ a b c d)))
|
||||
|
||||
(define-syntax jabberwocky
|
||||
(syntax-rules ()
|
||||
((_ hatter)
|
||||
|
|
Loading…
Add table
Reference in a new issue