HP Forums

Full Version: DOLIST/DOSUBS Equivalent?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The 50G has useful list-processing commands like DOSUBS and DOLIST.

It doesn't appear these (or something similar) exist in the Prime (see Chapter 25 of the Prime manual). Of course, some tasks (like computing moving averages for n elements of a list) can be achieved with seq (although that is a CAS command, but can be used in Home programs with CAS("seq( . . . )). And the users can always program their own specific application of list processing. But the beauty about DOLIST, for example, was that it could take operators and/or programs as arguments and was universal.
Take a look at EXECON. It is actually more capable...
Thanks! Will do - - for some reason, EXECON escaped me (it is listed under "other" in chapter 28 of the user's guide) - - I should have looked there as well.
The second example for the EXECON help returns an error. What is going on there?

EXECON("&2-&1",{1,4,3,5}) -> Error. Syntax error.

I found that if one manually erases the "-" and replaces it with "-" it runs. Strange.

Otherwise, no problems.
First guess without looking at it I'd say someone replaced the minus with a negative... I'll mark it down for review. Thanks!
Someone wanted a Simpson/Trapezoid numerical integral in another thread which should easily be doable using lists and their operations provided. My first attempt to get a locally defined function operating on a list simply was g(l), with the list stored in l, the function in g. This worked with the message I should use ".^" instead of ^ because of some matrix-operations awaited by the CAS, I chose "ok" and it provided the correct result, but the message is annoying so I opted for EXECON("g(&1)",l) which worked without any error.
But then I tried another function and still got the same result which finally brought me to the result: EXECON does not work with locally declared functions, at least in a cas-program, it uses the global one instead, is that a feature or a bug?

It is an unfortunate side effect...

CAS/Numerical jumps do not carry on local context, so, when using EXECON in CAS, you do loose the local vars/programs.

Thank you, Cyrille,
I had read that, but totally forgot about it.
Reference URL's