and vs. and (newbie question)



I had a hard time searching for this on the newsgroups since and is not
considered a keyword. I am trying to learn LISP and I came across a very
confusing issue (for me anyway).

There is an example in "Common Lisp" by David Touretzky that I just dont
get.

In Chapter 4 Advanced Topic he talks about Boolean functions. The
example is:

(defun logical-and (x y) (and x y t))

and then shows:

(logical-and 'tweet 'woof) -> t

and

(and 'tweet 'woof) -> woof

I completely understand that that last to evaluate as non-nil is
returned and in the first case the "t" is evaluated last and in the
second 'woof is evaluated last.

But then he goes on to show:

(and (numberp 'fred) (oddp 'fred)) -> nil

but

(logical-and (numberp 'fred) (oddp 'fred)) -> generates an error from
oddp. And sure enough it does.

Why is the and in logical-and any different than the and not in logical
and? I.e. why does (oddp 'fred) evaluate when (numberp 'fred) has
already evaluated to nil?

k
.



Relevant Pages

  • Future of Lisp
    ... Some of you may have watched Herb Sutter's 1 hour + lecture on the ... which are all already in lisp. ... Automatic type inference via an "auto" keyword (we have dynamic and ...
    (comp.lang.lisp)
  • Re: performance challenge
    ... Peter> What newsgroups is this discussion occuring in? ... search for "Lisp" postings by me in the last week. ... implicit none ... xsum = sum) ...
    (comp.lang.lisp)
  • Re: Extol virtues of Lisp, but then use Python?
    ... arrogant pricks in the Lisp community who think that Lisp is God's gift ... Arrogant pricks who master their craft are much better than helpful ... Why post it to other newsgroups? ...
    (comp.lang.scheme)
  • Re: Why dont people like lisp?
    ... here's a Common Lisp version. ... > functions use keyword arguments. ... My Python code reports a line number for this. ...
    (comp.lang.python)
  • Re: Why dont people like lisp?
    ... here's a Common Lisp version. ... > functions use keyword arguments. ... My Python code reports a line number for this. ...
    (comp.lang.lisp)