diff options
Diffstat (limited to 'match.csc')
| -rw-r--r-- | match.csc | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -42,15 +42,16 @@ (define-syntax match (syntax-rules (when) ((match x (pattern (when condition) result result* ...)) - (if (and (matches? x pattern) - condition) - (bind-pattern x pattern result result* ...))) + (if (matches? x pattern) + (bind-pattern x pattern + (if condition + (begin result result* ...))))) ((match x (pattern result1 result2 ...)) (if (matches? x pattern) (bind-pattern x pattern result1 result2 ...))) ((match x (pattern (when condition) result result* ...) clause clause* ...) (if (and (matches? x pattern) - condition) + (bind-pattern x pattern condition)) (bind-pattern x pattern result result* ...) (match x clause clause* ...))) ((match x (pattern result1 result2 ...) clause1 clause2 ...) |
