Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (match/debug 'two
- ['one 1]
- ['two 2])
- Case 2 <-- Printed
- 2 <-- Returned value
- (match 'two
- ['one (displayln "Case 1") 1]
- ['two (displayln "Case 2") 2])
- (define-syntax-rule (match-debug id [pattern value] ...)
- (let ([index 0])
- (match id
- [(begin
- (set! index (add1 index))
- pattern)
- (printf "Case ~an" index)
- value] ...)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement