It's bug in the collect: implementation used in String. I've opened https://pharo.fogbugz.com/f/cases/22652/collect-over-Strings-is-broken On Fri, Nov 9, 2018 at 2:17 PM Roelof Wobben <r.wobben@home.nl> wrote:
hmm.
When I try this on P7
|input stepChanges floor| input := '((('. floor := 0. stepChanges := input collect: [ :c | floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]). floor ].
stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input yo' ].
then I see this error message : Improper store to indexable object.
Roelof
Op 9-11-2018 om 17:39 schreef Roelof Wobben:
stepChanges := input collect: [ :c | floor := floor + (c = '(' ifTrue: [ 1 ] ifFalse: [ -1 ]). floor ].
stepChanges detectIndex: [ :each | each = -1 ] ifNone: [ 'invalid input yo' ].