diff options
Diffstat (limited to 'testsuite/t-match.scm')
-rw-r--r-- | testsuite/t-match.scm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/t-match.scm b/testsuite/t-match.scm new file mode 100644 index 000000000..4b85f30d3 --- /dev/null +++ b/testsuite/t-match.scm @@ -0,0 +1,26 @@ +;;; Pattern matching with `(ice-9 match)'. +;;; + +(use-modules (ice-9 match) + (srfi srfi-9)) ;; record type (FIXME: See `t-records.scm') + +(define-record-type <stuff> + (%make-stuff chbouib) + stuff? + (chbouib stuff:chbouib stuff:set-chbouib!)) + +(define (matches? obj) +; (format #t "matches? ~a~%" obj) + (match obj + (($ stuff) => #t) +; (blurps #t) + ("hello" #t) + (else #f))) + + +;(format #t "go!~%") +(and (matches? (%make-stuff 12)) + (matches? (%make-stuff 7)) + (matches? "hello") +; (matches? 'blurps) + (not (matches? 66))) |