Just realized that String>>#asNumber works differently in Pharo and in Squeak.


'+3' asNumber "Works in Squeak, not in Pharo"

BUT


'+3' asInteger "Works in both Squeak and Pharo"



-----------------
Beno��t St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero".  (A. Einstein)


On Sunday, December 2, 2018, 11:06:56 a.m. EST, phil@highoctane.be <phil@highoctane.be> wrote:


I am not using a file, but copy/paste my puzzleInput into a puzzleInput method.

Then I use lines from there.

e.g. shifts

    ^ self puzzleInput lines collect: [ :each | ((each beginsWith: '+') ifTrue: [ each allButFirst ] ifFalse: [ each  ]) asNumber ]

Because the challenge is personalized and it is annoying to have to commit a supplementary file in the github repository.


Phil

On Sun, Dec 2, 2018 at 3:27 PM Benoit St-Jean via Pharo-users <pharo-users@lists.pharo.org> wrote:
Exactly!

It's easier to manipulate that OrderedCollection that to open/reopen the file.  It'll be VERY handy for problem #2 where you will need to iterate multiple times on the data!  ;)

-----------------
Beno��t St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero".  (A. Einstein)


On Sunday, December 2, 2018, 7:15:06 a.m. EST, Roelof Wobben <r.wobben@home.nl> wrote:


Op 2-12-2018 om 12:19 schreef Benoit St-Jean via Pharo-users:


oke, and if I understand your code files is then the variable that holds

the file.

Roelof