"arafiedah" <·········@hotmail.com> writes:
> [...]
> (defun problemspare1 ()
> (cond
> ((or (an(eq n1 1)
> (eq n2 1)))
> (setf m-s 1 (setf m-s1 '(Maybe there is problem at SPARE NO.1))))
^^^
Should there have been a right parenthesis after the 1? I.e.
(SETF M-S 1) (SETF M-S1 ...) ...
> (t (setf m-s 0 (setf m-s1 '(There is nothing problem at SPARE NO 1)))))
^^^
Should there have been a right parenthesis after the 0, similarly to
the previous one?
(Sorry I'm only addressing the immediate problem at hand...)
---Vassil.
--
Vassil Nikolov <········@poboxes.com>
Hollerith's Law of Docstrings: Everything can be summarized in 72 bytes.
"arafiedah" <·········@hotmail.com> writes:
> this is the coding
> (defun func-firstnodeproblem(x)
> (setf firstnodeproblem (list x)
> (cond ((intersection firstnodeproblem '(a b))
> (setf node1 (nth 2 (assoc x fact1)))
> (setf n1 (nth 1 (assoc x fact1))))
> (t)))
Looks like you're missing a close paren on the line that starts with
"setf" above. You're life will be much easier if you use an editor
that knows how to indent s-expressions; the problem would presumably
leaps out at you when your editor indented that function like:
(defun func-firstnodeproblem(x)
(setf firstnodeproblem (list x)
(cond ((intersection firstnodeproblem '(a b))
(setf node1 (nth 2 (assoc x fact1)))
(setf n1 (nth 1 (assoc x fact1))))
(t))))
Instead of what you want:
(defun func-firstnodeproblem(x)
(setf firstnodeproblem (list x))
(cond ((intersection firstnodeproblem '(a b))
(setf node1 (nth 2 (assoc x fact1)))
(setf n1 (nth 1 (assoc x fact1))))
(t)))
-Peter
--
Peter Seibel ·····@javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
+ Peter Seibel <·····@javamonkey.com>:
| [Your] life will be much easier if you use an editor
| that knows how to indent s-expressions;
This point just cannot be emphasized enough. Not only that, one needs
to use the feature. All in all, I find that good editing habits
eliminate a lot of silly parantheses matching mistakes and let me
easily diagnose the ones that somehow slip through.
For instance, my life with Lisp became much improved once I learned
never to type any parentheses at all. With emacs, I use
meta-left-parenthesis, which inserts a matched pair with the cursor in
between. I do this even if I find that a sequence of forms should
have had another form wrapped around them: I first type in the
surrounding form, say, (let ((foo (bar)))), using the above technique,
then move beyond the end of the new form, set a mark, use M-C-f over
the forms that should have been inside my new form (note that this
guarantees that you inlcude complete subforms with no risk of
miscounting parentheses at the end), cut with C-w, move back inside
the new form, and yank it back with C-y. Finally, up a few levels and
reindent (using M-C-q).
All this is much harder to describe (and read about) than to do. Once
you're in the habit, paren matching bugs just cease to be an issue.
I wonder if books aimed at Lisp beginners shouldn't spend a chapter on
good Lisp editing techniques.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow
From: Matthew Danish
Subject: Re: ERROR :odd number of subform to setf
Date:
Message-ID: <87isa77ezr.fsf@mapcar.org>
You might find it easier to supply the universal argument to M-(. For
example, M-1 M-( will wrap the next form in parentheses. M-2 M-( will
wrap the next 2 forms in parentheses, etc...
(foo)
^ point
hit M-1 M-( and the result is:
((foo))
^ point
--
;;;; Matthew Danish -- user: mrd domain: cmu.edu
;;;; OpenPGP public key: C24B6010 on keyring.debian.org
+ Matthew Danish <··········@cmu.edu>:
| You might find it easier to supply the universal argument to M-(.
Hmm, indeed. Unless, of course, the number of forms I wish to wrap is
too great to count easily. So what I would like even better, is this:
If transient mark mode is on and the mark is active, wrap the region.
Possibly with a sanity check to make sure that no form is partially
included by this.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow