"Apply" method to array?

Hi,

This is a newbie question:

Is there a way to apply (as in Lisp, Scheme and the like) a method/block
to an array, so that the elements of the array become the arguments of
the method call. Something like:

a(1,2,3) ~~ a.apply([1,2,3])

Cheers,
Thomas.

Thomas Link wrote:

Hi,

This is a newbie question:

Is there a way to apply (as in Lisp, Scheme and the like) a method/block
to an array, so that the elements of the array become the arguments of
the method call. Something like:

    a(1,2,3) ~~ a.apply([1,2,3])

Like this?
a(*[1,2,3])

  • is used in argument list to unpack array contents to arguments (like
    here) or to pack arguments into an array,like in “def mymethod(*args)”
···


([ Kent Dahl ]/)_ ~ [ http://www.pvv.org/~kentda/ ]/~
))_student_/(( _d L b_/ (pre-) Master of Science in Technology )
( __õ|õ// ) )Industrial economics and technological management(
_
/ö____/ (_engineering.discipline=Computer::Technology)

Like this?
a(*[1,2,3])

  • is used in argument list to unpack array contents to arguments (like
    here) or to pack arguments into an array,like in “def mymethod(*args)”

Excellent. Thanks a lot.

Ciao,
Thomas.