Author Topic: about foreach  (Read 3683 times)

0 Members and 1 Guest are viewing this topic.

d2010

  • Bull Frog
  • Posts: 326
Re: about foreach
« Reply #15 on: April 24, 2022, 02:33:07 PM »
I was just trying to show empirical data. I also prefer to use foreach for the reason you stated and the simplicity. never really liked processing selection sets with a counter

You are wrong, the function the "(ssname ss i)" inside C++Arx is very,very fast selection of entities, bettter nth. But in VLISP?
Otherwise the function "(ssnamex SS)" return a+ List, soo, the
(ssnamex SS) is more slowest that  (ssname.i)
 :idea:
Code - Auto/Visual Lisp: [Select]
  1. (setq i 0)
  2. (if (setq ss (ssget))
  3.   (repeat (sslength ss)
  4.     (setq ent (ssname ss i))
  5.     ... do stuff
  6.     (setq i (1+ i))
  7.   )
  8. )
« Last Edit: April 24, 2022, 02:39:58 PM by d2010 »

mhupp

  • Bull Frog
  • Posts: 250
Re: about foreach
« Reply #16 on: April 24, 2022, 04:06:58 PM »
You are wrong, the function the "(ssname ss i)" inside C++Arx is very,very fast selection of entities

That's not what i am saying I understand (ssname ss i) is faster, but prefer foreach.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2140
  • class keyThumper<T>:ILazy<T>
Re: about foreach
« Reply #17 on: April 24, 2022, 05:50:19 PM »
< .. >
Over time, I've learned that it's better to spend time writing directly understandable code than to chase hundredths of a millisecond.

Yes ! I agree.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2140
  • class keyThumper<T>:ILazy<T>
Re: about foreach
« Reply #18 on: April 24, 2022, 06:00:00 PM »
Slightly off topic, but . . .

If you can learn from aphorisms ,

From 'The Zen of Python'

Quote
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

I'm also partial to the 'Principle of least astonishment'
« Last Edit: April 24, 2022, 06:06:04 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

d2010

  • Bull Frog
  • Posts: 326
Re: about foreach
« Reply #19 on: April 28, 2022, 01:11:46 AM »
I agree with, kdub. Another great post, baitang36!
thank you

Maybe . the directive "DefMacro", exists inside .Fas?
How to use "DefMacro" inside .Vlx?

kirby

  • Newt
  • Posts: 132
Re: about foreach
« Reply #20 on: April 28, 2022, 11:00:18 AM »
Thanks to all the great minds who weighed in on this.