Programming puzzles: processing lists!
|
04-25-2017, 03:01 AM
Post: #34
|
|||
|
|||
RE: Programming puzzles: processing lists!
(04-25-2017 01:11 AM)Claudio L. Wrote: The commands are quite different: Yes, but my point was that DOLIST, DOSUBS, and MAP all appear to work similarly in the special case where you are working with one list, one element at a time (ie. n=1). If there's a need to utilize the loop index for that type of scenario, that seemingly limits the choice to DOSUBS. But if that need doesn't exist, any of the three could be used. I just ran a couple quick trials of a simple test of all three of these commands with the same subprogram: Code: D01 A typical run gave these results on my 50g (approx. mode): MAP: 1.0255 DOLIST: 0.4794 DOSUBS: 0.4556 As John indicated, MAP appears to be much slower. With this (albeit simple) test, MAP took over twice as long to produce the same results as the other two. Interestingly, DOSUBS seemed to have a very slight edge over DOLIST. But the difference was very minor and may not even be consistent over multiple runs. That being the case, I have to wonder if the only time you'd really want to use MAP is when you need the recursive processing of lists that include other lists. Any other scenario for MAP would seemingly perform better with either of the other two commands. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)