Re: Question about loop



(message (Hello 'Jeff)
(you :wrote :on '(Wed, 30 May 2007 22:45:37 -0700))
(

JB> Does the Common Lisp spec say anything about whether the following is
JB> well defined given that the elements of "list" are unique:

JB> (loop for x in list
JB> when (p x)
JB> do (setq list (delete x list)))

i suspect it won't work right, but it's very confusing and very inefficient
anyway.

what's about one of this:

(delete-if #'p list)

(loop for x in lisp unless (p x) collect x)

(mapcan (lambda (x) (unless (p x) (list x))) list)

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"I am everything you want and I am everything you need")


.



Relevant Pages

  • Re: [PATCH 2.6.23] SysRq: print hotkey info while pressing undef key, try 2
    ... embedded which is very inefficient, it is intended to skip some hot ... You're optimizing code that hopefully never gets executed, ... To remove a bad loop is just a plus fix. ...
    (Linux-Kernel)
  • Re: For loop and strlen
    ... because this is rather inefficient. ... optimizing compiler might generate code which calls strlen ... Oh, yea, optimation may occure by unrolling the whole loop. ... Visit http://www.ecomstation.de the home of german eComStation ...
    (comp.lang.c)
  • Re: Closures Explained
    ... the first didn't show up for some reason] ... Inefficient. ... Are you suggesting that calling getElementsByTagName() in a loop is more ...
    (comp.lang.javascript)
  • Re: Unique values along rows
    ... Currently I am using a while loop which is completely inefficient for large amount of DATA. ... An Nx1 vector is generated but I have no information as to where each row starts and finishes inside this vector. ... Each row has different number of unique elements. ...
    (comp.soft-sys.matlab)