Combining @ and [*] in one function call?
Chris Angelico <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CAPTjJmqzxL6o+UCJWGv-K8T7XDSydo-SuPd4DWbRhd2tB6x-dQ@mail.gmail.com> |
Situation: I have an array(array(int)) of arguments, which I'd like to
pass through a function which takes a series of int arguments. Is
there a way to do this without a lambda?
colors = lambda(array x) {return GTK2.GdkColor(@x);}(color_defs[*]);
This works, but it's not exactly readable. I could go for an explicit
loop and use @, or I can use a lambda to do the @-ing and something
like this, but neither's as clear as what I'd like to do:
colors = GTK2.GdkColor(@color_defs[*]);
Is there a way to combine them into something that concise?
FWIW, color_defs = ({
({255, 255, 0}),
({127, 0, 127}),
// ... ... ...
}), and GTK2.GdkColor wants three separate arguments, red/green/blue.
ChrisA