Raise an exception upon VM stack overflows (fixes bug #29574).
[bpt/guile.git] / testsuite / t-match.scm
1 ;;; Pattern matching with `(ice-9 match)'.
2 ;;;
3
4 (use-modules (ice-9 match)
5 (srfi srfi-9)) ;; record type (FIXME: See `t-records.scm')
6
7 (define-record-type <stuff>
8 (%make-stuff chbouib)
9 stuff?
10 (chbouib stuff:chbouib stuff:set-chbouib!))
11
12 (define (matches? obj)
13 ; (format #t "matches? ~a~%" obj)
14 (match obj
15 (($ stuff) #t)
16 ; (blurps #t)
17 ("hello" #t)
18 (else #f)))
19
20 \f
21 ;(format #t "go!~%")
22 (and (matches? (%make-stuff 12))
23 (matches? (%make-stuff 7))
24 (matches? "hello")
25 ; (matches? 'blurps)
26 (not (matches? 66)))