Author Topic: Strange behavior with the "AND" statement  (Read 995 times)

0 Members and 1 Guest are viewing this topic.

Giuseppe Beatrice

  • Newt
  • Posts: 43
Strange behavior with the "AND" statement
« on: May 24, 2018, 03:47:59 AM »
I noticed a strange behavior with the "AND" statement.
The construction (cond ((and (setq lst1 (cdr lst)) (= (nth 1 lst1) 3)) ...)
causes an error if lst1 = nil
I knew that the "and" statement does not perform subsequent evaluations of the first nil value it finds.
Is there anything wrong with the construction of the command?

Giuseppe Beatrice

  • Newt
  • Posts: 43
Re: Strange behavior with the "AND" statement
« Reply #1 on: May 24, 2018, 03:57:53 AM »
Please forgive me.
I had made a mistake writing the statement as (cond (and ...))
The error errs in the absence of the initial double parenthesis after "cond".
Sorry again