programmatically determine if argument is list compatible to a given lambda list
- From: jimka <jimka@xxxxxxxxx>
- Date: 28 Apr 2007 12:49:00 -0700
I'd like to write a function which at run-time will determine whether
a given list
of arguments is compatible to a given lambda list.
For example.
(callable-as '(3) '(x))
==> return t because you CAN apply (lambda (x) nil) to '(3)
(callable-as '(3) '(x &rest y))
==> return t because you CAN apply (lambda (x &rest y) nil) to '(3)
(callable-as '(3) '(x y))
==> return nil because you CANNOT apply (lambda (x y) nil) to '(3)
Here is my attempt which fails miserably.
(defun callable-as (arg-list lambda-list)
(unwind-protect (apply `(lambda ,lambda-list
(return-from callable-as t))
arg-list)
(return-from callable-as nil)))
.
- Follow-Ups:
- Re: programmatically determine if argument is list compatible to a given lambda list
- From: Pascal Bourguignon
- Re: programmatically determine if argument is list compatible to a given lambda list
- From: Pascal Costanza
- Re: programmatically determine if argument is list compatible to a given lambda list
- Prev by Date: Re: A emacs group in Second Life
- Next by Date: Re: tracing a function without knowing its name
- Previous by thread: Re: A emacs group in Second Life
- Next by thread: Re: programmatically determine if argument is list compatible to a given lambda list
- Index(es):