1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
guile/testsuite/t-match.scm
Andy Wingo 0658041d11 fix use-syntax / use-modules confusion -- fixes testsuites
* testsuite/t-match.scm:
* testsuite/t-records.scm: While the attempt to redefine use-syntax as
  being "use during compilation" was cute, it does not reflect the
  historical usage of use-syntax, nor does it correspond to existing code
  that includes other modules and uses them during compilation.

  So use-syntax has been replaced with use-modules. The test suites now
  pass. In the future, compilation phases should be done on whole
  modules, I think; r5rs-style computation does not have phases.
2008-05-14 14:54:52 +02:00

26 lines
561 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)))