[Newbies] syntax to do array as value:value:...

LordGeoffrey lordgeoffrey at optusnet.com.au
Fri Dec 25 19:34:55 UTC 2009


Prefect. Thanks.

Randal L. Schwartz wrote:
>>>>>> "LordGeoffrey" == LordGeoffrey  <lordgeoffrey at optusnet.com.au> writes:
>>>>>>             
>
> LordGeoffrey> Is there a method that does what magicDo does?
> LordGeoffrey> #(#(1 2 true)
> LordGeoffrey>    #(2 1 false)) magicDo: [:a :b :r |
> LordGeoffrey>         "do something useful"
> LordGeoffrey>    ]       _______________________________________________
> LordGeoffrey> Beginners mailing list
> LordGeoffrey> Beginners at lists.squeakfoundation.org
> LordGeoffrey> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
> what do you want a, b, and r to be?
>
> Maybe the values 1, 2, true the first time, and 2, 1, false the second?
>
> If so:
>
> #((1 2 true) (2 1 false)) do: [:row |
>    [:a :b :r | "do something useful" ] valueWithArguments: row.
> ].
>
> Beware... if your row doesn't have exactly three values, you'll
> get an exception.  If you don't want that, consider #valueWithPossibleArgs:
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20091226/bf9a2cb5/attachment.htm


More information about the Beginners mailing list