[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cl-dolist, dolist, cl-return,
From: |
Emanuel Berg |
Subject: |
cl-dolist, dolist, cl-return, |
Date: |
Wed, 08 Jul 2015 02:14:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
I just wrote the below code.
`cl-return' works for `cl-dolist', but not for
`dolist' because it hasn't an "implicit nil block ...
established around the loop". And there is no
`return'! I think this "cl-" stuff is confusing.
Anyone cares to explain?
By the way, I know there are one zillion loops
in Lisp. What is the conventional way to
1. iterate a list
2. until some condition is met for some element
3. then break, to speak in C
?
And: With [cl-]dolist, if the list is an expression
and not an atom, does that get evaluated once, or does
it happen every iteration like, say, a string length
test would, again in C?
Also: why isn't there a "neq"?
Keep it up!
;; whole file: http://user.it.uu.se/~embe8573/conf/emacs-init/erc-my.el
(defun neq (a b)
(not (eq a b) ))
(defun erc-kill-buffer-stay ()
"Close the current ERC buffer (e.g., to leave a channel)
but stay in ERC if possible."
(interactive)
(cl-dolist (b (erc-buffer-list))
(when (neq (current-buffer) b)
(erc-cmd-LEAVE "")
(switch-to-buffer b)
(cl-return) )))
--
underground experts united
http://user.it.uu.se/~embe8573
- cl-dolist, dolist, cl-return,,
Emanuel Berg <=
- Re: cl-dolist, dolist, cl-return,, John Mastro, 2015/07/07
- Re: cl-dolist, dolist, cl-return,, Stefan Monnier, 2015/07/07
- Re: cl-dolist, dolist, cl-return,, Emanuel Berg, 2015/07/08
- Re: cl-dolist, dolist, cl-return,, Stefan Monnier, 2015/07/08
- Re: cl-dolist, dolist, cl-return,, Emanuel Berg, 2015/07/08
- Re: cl-dolist, dolist, cl-return,, John Mastro, 2015/07/08
- Re: cl-dolist, dolist, cl-return,, Emanuel Berg, 2015/07/09
- Message not available
- Re: cl-dolist, dolist, cl-return,, Barry Margolin, 2015/07/10
- Re: cl-dolist, dolist, cl-return,, Emanuel Berg, 2015/07/11
- Re: cl-dolist, dolist, cl-return,, Stefan Monnier, 2015/07/10