Re: Combining @ and [*] in one function call?
Ralph Ritoch <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CABFWrWUW6PAzYENSmpczUtZ0ay+VvKq3MA7nbXE9qLBZpqxokA@mail.gmail.com> |
Chris, Have you tried using parenthesis to control the order of operations? colors = GTK2.GdkColor(@(color_defs[*])); This seems to work for me. Best Regards, Ralph Ritoch On Fri, Apr 25, 2014 at 4:53 AM, Chris Angelico <[email protected]> wrote: > 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 > >