really silly question

Helge Horch Helge.Horch at munich.netsurf.de
Fri Aug 31 03:47:44 UTC 2001


At 03:36 31.08.2001 +0100, you wrote:
>Given two arrays of the same size filled with numbers, can someone give
>me a code snippet that will show me how to add the numbers at the same
>index to produce a third array?
>
>So that firstArray:= #(1 2 3 4)
>         secondArray:= #(5 6 1 2)
>
>will result in a thirdArray (6 8 4 6)

MethodFinder, MethodFinder, MethodFinder! ;-)

Entering #(1 2 3 4). #(5 6 1 2). #(6 8 4 6)
finds #+
and indeed

#(1 2 3 4) + #(5 6 1 2)
=> #(6 8 4 6)

Entering #((1 2 3 4) (5 6 1 2)). #(6 8 4 6)
finds #sum
and indeed

#((1 2 3 4) (5 6 1 2)) sum
=> #(6 8 4 6)

Voila.  Ted, this tool is priceless!  Thanks!

Cheers,
Helge




More information about the Squeak-dev mailing list