Post Reply 
DOLIST/DOSUBS Equivalent?
07-06-2015, 05:28 PM
Post: #1
DOLIST/DOSUBS Equivalent?
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.
Find all posts by this user
Quote this message in a reply
07-06-2015, 06:29 PM (This post was last modified: 07-06-2015 06:30 PM by Tim Wessman.)
Post: #2
RE: DOLIST/DOSUBS Equivalent?
Take a look at EXECON. It is actually more capable...

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
07-06-2015, 11:47 PM
Post: #3
RE: DOLIST/DOSUBS Equivalent?
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.
Find all posts by this user
Quote this message in a reply
07-07-2015, 12:38 AM
Post: #4
RE: DOLIST/DOSUBS Equivalent?
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.
Find all posts by this user
Quote this message in a reply
07-07-2015, 01:55 PM
Post: #5
RE: DOLIST/DOSUBS Equivalent?
First guess without looking at it I'd say someone replaced the minus with a negative... I'll mark it down for review. Thanks!

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
07-07-2015, 06:12 PM
Post: #6
RE: DOLIST/DOSUBS Equivalent?
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?
Arno
Find all posts by this user
Quote this message in a reply
07-08-2015, 04:58 AM
Post: #7
RE: DOLIST/DOSUBS Equivalent?
Hello,

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.

Cyrille
Find all posts by this user
Quote this message in a reply
07-08-2015, 07:34 AM
Post: #8
RE: DOLIST/DOSUBS Equivalent?
Thank you, Cyrille,
I had read that, but totally forgot about it.
Arno
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)