I know,

that output is given by the AdventOfCode 2018 challenge.

Roelof


Op 2-12-2018 om 20:36 schreef Richard O'Keefe:
Thinking about this functionally, you want
   to sum
   the array elements that are not + .
So,
   (array select: [:each | each ~~ #+]) sum
The *best* approach is not to put the + symbols
into the array in the first place.

On Sun, 2 Dec 2018 at 23:46, Roelof Wobben <r.wob...@home.nl> wrote:
Op 2-12-2018 om 11:15 schreef Hilaire:
> #(+1 -8) inject: 0 into: [:sum :each | each ~= #+ ifTrue: [sum +  each]
> ifFalse: [sum]] .

Thanks,

Now to stretch my mind I will try to make one with double-dispatch.

Roelof



Reply via email to