You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a.at and str.at is rather annoying in a lot of situations, especially for something that is so common. A syntax for indexing would be useful, although the existing functions should probably be left in for easier use in the chains. If the syntax can support slicing, that would also be useful.
Unfortunately, due to the way the parse works, using [] for indexing is not really possible. Possible alternatives:
array[@i]. Possible, but a bit unwieldy. Definitely better than using the std functions, though.
array.i. Ambigous, but it should be possible. Doesn't really work for slicing, though.
array.[i]. Possible, but only by making .[ a single token. Probably the cleanest, though.
The text was updated successfully, but these errors were encountered:
Alternative: Put an at function directly in std which can access indices of both strings and arrays. Not having to import it would be a bit easier, although it's potentially still a bit awkward. Might also want to put slice and len functions that would work on both strings and arrays.
DeedleFake
changed the title
Add Syntactical Support for Array/String Indexing
wdte: add syntactical support for array and string indexing
Nov 28, 2018
Using
a.at
andstr.at
is rather annoying in a lot of situations, especially for something that is so common. A syntax for indexing would be useful, although the existing functions should probably be left in for easier use in the chains. If the syntax can support slicing, that would also be useful.Unfortunately, due to the way the parse works, using
[]
for indexing is not really possible. Possible alternatives:array[@i]
. Possible, but a bit unwieldy. Definitely better than using thestd
functions, though.array.i
. Ambigous, but it should be possible. Doesn't really work for slicing, though.array.[i]
. Possible, but only by making.[
a single token. Probably the cleanest, though.The text was updated successfully, but these errors were encountered: