Thanks,
I will look further then how to make the tests green
Roelof
Op 21-9-2020 om 08:24 schreef jtuc...@objektfabrik.de:
Roelof,
I guess your are taking about what you see in the inspector... There
is nothing to worry about.
Try inspecting wordBag asOrderedCollection and see if there are still
nils. Or ask the Bad for occurencesOf: nil.
It is completely normal to see nils in an Inspector on a Set or Bag.
Has to do with internals of Set's and Bag's. These nils are there, but
not for you ;-)
Joachim
Am 21.09.20 um 08:16 schrieb Roelof Wobben via Pharo-users:
Hello,
I have to make a word count from a sentence so I did this :
countWordsSentence: aString
| splitted result |
splitted := aString splitOn: [ :each | ', ' includes: each ].
result := splitted
inject: Bag new
into: [ :wordBag :word |
wordBag
add: word;
yourself ].
^ result valuesAndCounts
but now I see that the Bag is containing nills.
I tried to delete them by doing this : cleaned := result reject:
[:each | each isNil]
but to my surprise the nills are still there,
Why is that happening and what is the best way to delete them ?
Roelof