Post Reply 
lib for developers : libList
10-02-2017, 09:02 PM (This post was last modified: 10-05-2017 07:39 AM by StephenG1CMZ.)
Post: #5
RE: lib for developers : libList
L_INS({1,2,3},0,99) = {1,2,3,99} ?? (From your example)

I am unsure how an index of 0 should be parsed in this case.
When a value is read, 0 refers to the last value, and when it is written, the new value about to be added.

Does this mean it should be inserted before the value yet to be written (i.e. appended at the end)?
Or does it mean that it should be inserted before {1,2,3}(0) i.e. 3, giving {1,2,99,3}?

Given that {1,2,3,99} is trivial
{1,2,3}(0):=99
Perhaps {1,2,99,3} is more useful?
Of course, it should also be offset by 1 from your -1 position.

For comparison:
In Java and Python, lists are indexed from 0, so "insert before position 0" would be {99,1,2,3}
Although (0) is a useful syntax in PPL, here it is less obvious to me what it should refer to.

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 


Messages In This Thread
lib for developers : libList - primer - 10-08-2016, 09:37 PM
RE: lib for developers : libList - primer - 10-16-2016, 09:46 AM
RE: lib for developers : libList - primer - 09-17-2017, 05:10 PM
RE: lib for developers : libList - StephenG1CMZ - 10-02-2017 09:02 PM



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