help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cl-dolist, dolist, cl-return,


From: Pascal J. Bourguignon
Subject: Re: cl-dolist, dolist, cl-return,
Date: Wed, 08 Jul 2015 05:25:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> 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?

emacs lisp is too limited, it lack Common Lisp packages or any other way
of namespace.  Therefore people have to use prefixes instead of package
names.


> 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
>
> ?

  (loop for item in list
        until (some-condition-p item))

        
> 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?

Once.


> Also: why isn't there a "neq"?

(defun neq (x y) (not (eq x y))
; now there is.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

[Prev in Thread] Current Thread [Next in Thread]