Post Reply 
EDITLIST in CAS program
05-18-2015, 08:01 PM
Post: #1
EDITLIST in CAS program
I'm trying EDITLIST in a #CAS program and it seems not to edit a list.

The line
EDITLIST(flows);
works well in a Home program, but has no effect in a #CAS/#end program.

Am I wrong?

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
05-20-2015, 05:48 AM
Post: #2
RE: EDITLIST in CAS program
(05-18-2015 08:01 PM)salvomic Wrote:  I'm trying EDITLIST in a #CAS program and it seems not to edit a list.

The line
EDITLIST(flows);
works well in a Home program, but has no effect in a #CAS/#end program.

Am I wrong?

Salvo

It returns the correctly edited list (to the history stack) as its output, but in CAS it fails to automatically store that result back into the named list. So in a CAS program, you'll have to use this apparently redundant syntax: L1:=EDITLIST(L1). At least until that bug is fixed.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
05-20-2015, 07:01 AM
Post: #3
RE: EDITLIST in CAS program
(05-20-2015 05:48 AM)Joe Horn Wrote:  ...
So in a CAS program, you'll have to use this apparently redundant syntax: L1:=EDITLIST(L1). At least until that bug is fixed.

thank you!
I'll try this, then, until the bug will be corrected.

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
10-11-2015, 07:43 AM (This post was last modified: 10-11-2015 08:05 AM by StephenG1CMZ.)
Post: #4
RE: EDITLIST in CAS program
Actually, I wonder whether that should be a bug?
Using L1 := EDITLIST(L1)
Looks like a useful syntax for those times you want to edit a list and keep the original:
L2 := EDITLIST(L1)

If EDITLIST (L1) always changes L1, that last line would make
L2 = L1 = edited
Whereas
L2 = edited L1 =Original
Would be it's obvious meaning without looking up EDITLIST's spec.

So for readability of the source code, I would suggest EDITLIST should not automatically edit the list given as a parameter, though if no destination list is specified it should default to doing so).

A potential downside is that that might be less efficient, but it avoids
L2:=EDITLIST(L1) editing L1 when you might not expect it to.
If doing this is considered too wasteful given that on many occasions you will be editing back to the same list,
I would suggest EDITLIST should not be assignable - the corresponding code then becoming:
EDITLIST (L1); // no L2 makes it clear what is being edited
Or
L2:=L1; //keep original
EDITLIST (L2); // change copy
L2:=EDITLIST (L1) // could give syntax error to avoid confusion


I would also like to suggest EDITLIST should have an optional READONLY parameter (alternatively: a VIEWLIST command) for those times when you want to browse a list without changing it.
See for example how I use it in Version 0.3 of my Z EDITOR (select Searchall then View, and see how awkward the editing can look before my program implements search-and-replace). Having a readonly setting would be much neater.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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