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



Op 10-12-2018 om 18:04 schreef Richard Sargent:


On Mon, Dec 10, 2018 at 8:52 AM Roelof Wobben <r.wob...@home.nl> 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 that stream to check if a word contains 3 vowels ?

I'll start with this question first, since it is the easiest to discuss. The brute-force approach would be to use #select: against the word to extract all the vowels. But a better approach, would be to imagine what you need and delegate it. So, we already have #select:, #reject, #detect:, and #collect: as patterns. Imagine a new method called #count:, and implement that. (For the purpose of the assignment, implementing #count: is probably overkill, unless you have many, many words to check.)


Now, back to the first question. You want to iterate through the word "pairwise", where you examine each successive pair of letters.
So, you want to iterate from 1 through n-1 and check whether the letter at the index is the same as the letter at the index + 1.
That should be enough to get you going.


I ask also on the discord app but no answer for a long time


Regards,

Roelof


Reply via email to