1 ;;; -*- mode: scheme; coding: utf-8; -*-
3 ;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
5 ;;; This library is free software; you can redistribute it and/or
6 ;;; modify it under the terms of the GNU Lesser General Public
7 ;;; License as published by the Free Software Foundation; either
8 ;;; version 3 of the License, or (at your option) any later version.
10 ;;; This library is distributed in the hope that it will be useful,
11 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;; Lesser General Public License for more details.
15 ;;; You should have received a copy of the GNU Lesser General Public
16 ;;; License along with this library; if not, write to the Free Software
17 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 (define-module (ice-9 match)
28 ;; Error procedure for run-time "no matching pattern" errors.
29 (throw 'match-error "match" msg))
31 ;; Support for record matching.
33 (define-syntax slot-ref
38 (define-syntax slot-set!
41 (struct-set! rec n value))))
47 (eq? (struct-vtable rec) rtd)))))
49 ;; Compared to Andrew K. Wright's `match', this one lacks `match-define',
50 ;; `match:error-control', `match:set-error-control', `match:error',
51 ;; `match:set-error', and all structure-related procedures. Also,
52 ;; `match' doesn't support clauses of the form `(pat => exp)'.
54 ;; Unmodified public domain code by Alex Shinn retrieved from
55 ;; the Chibi-Scheme repository, commit 1206:acd808700e91.
57 ;; Note: Make sure to update `match.test.upstream' when updating this
59 (include-from-path "ice-9/match.upstream.scm")