[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Another pcase-lambda
From: |
Mark Oteiza |
Subject: |
Another pcase-lambda |
Date: |
Mon, 18 Sep 2017 20:56:37 -0400 |
User-agent: |
Mutt/1.9.0 (2017-09-02) |
Hi,
I wrote the following, as I wanted more out of pcase-lambda. However,
pcase-lambda already exists so I don't know what to call it. It does
somewhat emulate SRFI-16's case-lambda.
(defmacro case-lambda (&rest spec)
"Return an arbitrary arity function."
(declare (indent 0) (debug (&rest (pcase-QPAT body))))
(let ((args (make-symbol "args")))
`(lambda (&rest ,args)
(pcase-exhaustive ,args ,@spec))))
(case-lambda
(`() t)
(`(,x) (cons x 1))
(`(,x ,y) (list :x x :y y))
(`(,x ,y . ,z) (vconcat (cons x (cons y z)))))
- Another pcase-lambda,
Mark Oteiza <=
- Re: Another pcase-lambda, Michael Heerdegen, 2017/09/21
- Re: Another pcase-lambda, Mark Oteiza, 2017/09/22
- Re: Another pcase-lambda, Clément Pit-Claudel, 2017/09/22
- Re: Another pcase-lambda, Michael Heerdegen, 2017/09/23
- Re: Another pcase-lambda, Stefan Monnier, 2017/09/23
- Re: Another pcase-lambda, Michael Heerdegen, 2017/09/23
- Re: Another pcase-lambda, Ted Zlatanov, 2017/09/28