Dec. 2, 2018
3:03 p.m.
On Sun, 2 Dec 2018 at 17:49, Roelof Wobben <r.wobben@home.nl> wrote:
Hello,
I have a collection that looks like this :
sampleData1 "comment stating purpose of message"
^ #( -8 +7)
I want to add those numbers up but the code chokes at the +
To get some insight, do.... #( -8 +7) inspect You will notice three elements when I think you expected two. So perhaps you need... x := #( -8 +7) reject: [:y | y = #+]. and then #inject:into: "x" cheers -ben
so I did this :
FrequencyFinderData new class sampleData1 inject: 0 into: [:sum :each | (each ~= $+) ifTrue: [sum + each asInteger] ]
so when the each is not a + it must count it but still the code chokes at the +
Where do I think wrong ?
Roelof