Commit 68ad3a25 by Francois-Rene Rideau

Use EQUAL instead of EQL by default. Makes more sense wrt CL quoting syntax.

parent 38c9768f
;;; -*- Mode: Lisp ; Base: 10 ; Syntax: ANSI-Common-Lisp -*-
;;; Lisp2-style Erlang/ML-like Extensible Pattern-Matcher for Common LISP
;;; Copyright (c) 2002-2009 Fahree Reedaw <fare@tunes.org>
;;; Copyright (c) 2002-2011 Fahree Reedaw <fare@tunes.org>
#+xcvb (module (:depends-on ("packages")))
#| "
......@@ -270,10 +270,13 @@ or otherwise the IFFAILS form in the calling lexical environment."
(defun eql-matcher (val)
"matcher for a given value"
`#'(lambda (,*form) (m%when (eql ,*form ',val))))
(defun equal-matcher (val)
"matcher for a given value"
`#'(lambda (,*form) (m%when (equal ,*form ',val))))
(defun pattern-matcher (clause)
(cond
((literalp clause)
(eql-matcher clause))
(equal-matcher clause))
((symbolp clause)
(aif (symbol-matcher clause)
(values it nil)
......@@ -370,11 +373,11 @@ or otherwise the IFFAILS form in the calling lexical environment."
(define-symbol-matcher _ `#'m%success) ; matches everything
(define-symbol-matcher * `#'m%success) ; matches everything
(define-macro-matcher quote #'eql-matcher)
(define-macro-matcher quote #'equal-matcher)
(define-macro-matcher value
#'(lambda (sexp)
`#'(lambda (,*form) (m%when (eql ,*form ,sexp)))))
`#'(lambda (,*form) (m%when (equal ,*form ,sexp)))))
(define-macro-matcher of-type
#'(lambda (type)
`#'(lambda (,*form) (m%when (typep ,*form ',type)))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment