AAVSO / VStar

VStar is a visualisation and analysis tool for variable star data brought to you by AAVSO
https://www.aavso.org/vstar
GNU Affero General Public License v3.0
9 stars 3 forks source link

Add list subscripting to VeLa #201

Open dbenn opened 3 years ago

dbenn commented 3 years ago

Right now, to access the Nth list element in VeLa, the nth function must be used. This requires invocation of an intrinsic function, so is inefficient, and is not very friendly syntax.

For example, inefficiency here is not good for models written in VeLa as the VeLa model creator allows.

A subscripted list "object" should be an l-value and an r-value.

Given:

aList <- []
aList <- append(aList 2)

instead of the following:

nth(aList 0)

it should be possible to say:

aList[0]

It should also be possible to modify a list like this:

aList <- [1 2 3 4]
aList[0] <- 42  # change 2 to 42
dbenn commented 1 year ago

Start with the l-value implementation, then r-value. Test speed improvement of nth vs subscripting.

dbenn commented 1 year ago

If we add an object model in future, lists could be objects with methods like append.