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
PICKZ and POKEZ would be (preferably native) wrappers around the PICK and POKE actions that would add 1 to their index argument before passing it along. This would provide 0-based indexing for all series.
These functions would be limited to datatypes that take the PICK and POKE actions with numeric indexes only. The map! type can take numeric keys, but support for map! in PICKZ and POKEZ seems silly.
"PICKZ and POKEZ would be (preferably native) wrappers around the PICK and POKE actions that would add 1 to their index argument before passing it along. This would provide 0-based indexing for all series." - this looks simple, but it is rather problematic, in fact:
PICK and POKE accept a nonnative (1-based) index value transforming it to its native (0-based index value for the native C code) counterpart. This transformation is not free, my tests revealed that the overflow that can occur during the transformation due to limited range, and some other issues that can occur due to non-arithmetic indexing are not handled properly. Adding another index transformation on top of the mess is yet another source of possible bugs.
Submitted by: BrianH
PICKZ and POKEZ would be (preferably native) wrappers around the PICK and POKE actions that would add 1 to their index argument before passing it along. This would provide 0-based indexing for all series.
These functions would be limited to datatypes that take the PICK and POKE actions with numeric indexes only. The map! type can take numeric keys, but support for map! in PICKZ and POKEZ seems silly.
The names come from the Rebcode operations.
Imported from: CureCode [ Version: alpha 33 Type: Wish Platform: All Category: n/a Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#613
Comments:
Submitted by: BrianH
If these are native it could let us make vector! 1-based without much overhead for 0-based use.
Submitted by: abolka
Strong +1 for adding these.
Please also add a "0-based" INDEX? dual: I'd suggest INDEXZ?.
"PICKZ and POKEZ would be (preferably native) wrappers around the PICK and POKE actions that would add 1 to their index argument before passing it along. This would provide 0-based indexing for all series." - this looks simple, but it is rather problematic, in fact:
PICK and POKE accept a nonnative (1-based) index value transforming it to its native (0-based index value for the native C code) counterpart. This transformation is not free, my tests revealed that the overflow that can occur during the transformation due to limited range, and some other issues that can occur due to non-arithmetic indexing are not handled properly. Adding another index transformation on top of the mess is yet another source of possible bugs.
The text was updated successfully, but these errors were encountered: