>is there a way I can check if a word has 2 the same chars after each other
Use #pairsCollect:
'hello' pairsCollect: [:a :b | a = b ]
There is also a #pairsDo:
'hello' pairsCollect: [:a :b | Transcript show: a asString; show: b asString ]
Have fun
T. (aka astares)
Thanks,
next on my learning lists. Look for methods in both classes that
can help me.
Roelof
Op 10-12-2018 om 23:30 schreef Richard O'Keefe:
Having imagined
collection count: [:each |
Having imagined collection count: [:each | ...]
DO NOT IMPLEMENT IT!
Check to see if it already exists.
Hint: it DOES exists and has done since before Pharo.
So 'pangrams are fun but this isn''t one' count: [:each | each isVowel]
already answers 10.
Something that may help you a lot is to visit
There are manuy words I think some 1000
.
Aoc uses a lot of data for a challenge.
I have to think well how to implent that new function
im thinking now about select and size after that.
Regards,
Roelof
On Mon, Dec 10, 2018 at 8:52 AM Roelof Wobben wrote:
> Hello,
>
> is there a way I can check if a word has 2 the same chars after each other
> I was hoping that '#groupby could help me but that one sorts
> so abba the aa is found
> or do I have to use a stream for that
>
> could I then also use
Hello,
is there a way I can check if a word has 2 the same chars after
each other
I was hoping that '#groupby could help me but that one
sorts
so abba
the aa is