stk/Lib/match.stk

47 lines
1.5 KiB
Plaintext

;;;;
;;;; m a t c h . s t k -- The bigloo match-case and match-lambda
;;;;
;;;; Copyright © 1997-1999 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;; Permission to use, copy, modify, distribute,and license this
;;;; software and its documentation for any purpose is hereby granted,
;;;; provided that existing copyright notices are retained in all
;;;; copies and that this notice is included verbatim in any
;;;; distributions. No written agreement, license, or royalty fee is
;;;; required for any of the authorized uses.
;;;; 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: 3-Sep-1999 19:53 (eg)
;;;;
;;;; 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")