mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
* testsuite: Move to... * test-suite/vm: ... here. * Makefile.am (SUBDIRS): Remove `testsuite'. * configure.ac: Output `test-suite/vm/Makefile' instead of `testsuite/Makefile'. * test-suite/Makefile.am (SUBDIRS): Add `vm'.
26 lines
558 B
Scheme
26 lines
558 B
Scheme
;;; 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)))
|