Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PICK and POKE of strings have off-by-one error with indexes < 1. #608

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Closed

PICK and POKE of strings have off-by-one error with indexes < 1. #608

Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Labels
CC.resolved Issue with CureCode status built, tested or complete Status.important Test.written Type.bug

Comments

@Siskin-Bot
Copy link
Collaborator

Siskin-Bot commented Feb 15, 2020

Submitted by: BrianH

PICK and POKE of string types skip the 0 index, and negative indexes are shifted accordingly. PICK and POKE of block types work correctly.

; PICK of blocks

>> b: skip [a b c] 2
== [c]
>> pick b 2
== none
>> pick b 1
== c
>> pick b 0
== b
>> pick b -1
== a

; PICK of strings

>> b: skip "abc" 2
== "c"
>> pick b 2
== none
>> pick b 1
== #"c"
>> pick b 0
== none  ; should be #"b"
>> pick b -1
== #"b"  ; should be #"a"

Imported from: CureCode [ Version: alpha 33 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 55 ]
Imported from: metaeducation#608

Comments:

Rebolbot commented on Feb 9, 2009:

Submitted by: BrianH

Note that this bug exists in R2, for blocks as well. This needs to be fixed - it's like picking and poking in Roman numerals.


Rebolbot commented on May 28, 2009:

Submitted by: Carl

See also #857


Rebolbot commented on May 28, 2009:

Submitted by: BrianH

See also #609 - the same bug for AT.


Rebolbot mentioned this issue on Jan 12, 2016:
Make VECTOR! of same index-base as other series
String Pick incompatible with block Pick


Rebolbot added Type.bug and Status.important on Jan 12, 2016


Oldes added a commit to Oldes/Rebol3 that referenced this issue on Jun 13, 2018:
FEAT/FIX: Picking the right PICK


Oldes mentioned this pullrequest on Jun 13, 2018:
FEAT/FIX: Picking the right PICK


Hostilefork added a commit to metaeducation/ren-c that referenced this issue on Jun 14, 2018:
Restore Rebol2-era PICKing/PATHing of negative/zero indices


Hostilefork mentioned this pullrequest on Jun 14, 2018:
Restore Rebol2-era PICKing/PATHing of negative/zero indices


@Siskin-Bot Siskin-Bot added the CC.resolved Issue with CureCode status built, tested or complete label May 22, 2020
@Oldes Oldes closed this as completed Aug 19, 2020
Oldes added a commit to Oldes/Rebol3 that referenced this issue Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CC.resolved Issue with CureCode status built, tested or complete Status.important Test.written Type.bug
Projects
None yet
Development

No branches or pull requests

2 participants