Re: possibly silly question re quoting of function arguments...
- From: Peter Seibel <peter@xxxxxxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 15:30:22 GMT
"birlinn@xxxxxxxxx" <birlinn@xxxxxxxxx> writes:
Hi,
i want a predicate function that tells me whether a given list is of x
or y (e.g. myvar-x1 or myvar-y1) without having to quote the argument i
pass to the function...
you misread my post (my fault for the way i wrote it probably!):
----
(defun dest-is-xvar-p (list)
(eql list myvar-x1))
such that:
(dest-is-xvar-p myvar-x1)
returns true.
----
with the above, dest-is-xvar-p returns true for any empty list...
That's because there's only one empty list and because functions just
get values; they don't know where those values came from. So when you
say:
(dest-is-xvar-p myvar-x1)
and the current value of myvar-x1 is NIL it's exactly the same as if you said:
(dest-is-xvar-p NIL)
Basically you can't do what you think you want to do. The good news is
that when you step back and explain what you're really trying to do
(i.e. why do you think you need to do this) someone here will be able
to tell you the Lispy way to do *that*.
-Peter
--
Peter Seibel * peter@xxxxxxxxxxxxxxx
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp * http://www.gigamonkeys.com/book/
.
- Follow-Ups:
- Re: possibly silly question re quoting of function arguments...
- From: Takehiko Abe
- Re: possibly silly question re quoting of function arguments...
- From: birlinn@xxxxxxxxx
- Re: possibly silly question re quoting of function arguments...
- References:
- possibly silly question re quoting of function arguments...
- From: birlinn@xxxxxxxxx
- Re: possibly silly question re quoting of function arguments...
- From: Peter Seibel
- Re: possibly silly question re quoting of function arguments...
- From: birlinn@xxxxxxxxx
- possibly silly question re quoting of function arguments...
- Prev by Date: Re: Decreasing the "standard deviation" of lisp
- Next by Date: Re: Decreasing the "standard deviation" of lisp
- Previous by thread: Re: possibly silly question re quoting of function arguments...
- Next by thread: Re: possibly silly question re quoting of function arguments...
- Index(es):
Relevant Pages
|
|