1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00
guile/test-suite/vm/t-match.scm
Ludovic Courtès aa592f96b0 Rename the testsuite' directory to test-suite/vm'.
* 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'.
2010-05-26 23:41:24 +02:00

26 lines
558 B
Scheme
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; 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)))