stk/Lib/match.stk

46 lines
1.5 KiB
Plaintext

;;;;
;;;; m a t c h . s t k -- The bigloo match-case and match-lambda
;;;;
;;;; Copyright © 1997-1998 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;; Permission to use, copy, and/or distribute this software and its
;;;; documentation for any purpose and without fee is hereby granted, provided
;;;; that both the above copyright notice and this permission notice appear in
;;;; all copies and derived works. Fees for distribution or use of this
;;;; software or derived works may only be charged with express written
;;;; permission of the copyright holder.
;;;; This software is provided ``as is'' without express or implied warranty.
;;;;
;;;; Author: Erick Gallesio [eg@kaolin.unice.fr]
;;;; Creation date: 28-Oct-1997 20:47
;;;; Last file update: 30-Apr-1998 15:27
;;;;
;;;; This file implements code for loading the MATCH-CASE and MATCH-LAMBDA
;;;; of the Bigloo system. Bigloo files are unmodified and could be probably
;;;; adapted for STk (in particular, the code can deal with structures, and
;;;; a useful adaptation could be to manage objects instead).
(require "bigloo")
;;;;
;;;; WARNING: Order is important
;;;;
(load "Match/s2cfun.scm")
(load "Match/normalize")
(load "Match/descr.scm")
(load "Match/compiler.scm")
(load "Match/mexpand.scm")
(with-module STk
(import __match_expand)
(define-macro (match-lambda . clauses)
(expand-match-lambda (cons '() clauses)))
(define-macro (match-case expr . clauses)
`((match-lambda ,@clauses) ,expr)))
(provide "match")