>> This might be a bit of a stretch, but... is it possible to
>> "expand/split" variable arguments to call another function with fixed
>> arguments? I would like to define a function that takes as input another
>> function F and some values v1, vn... , and applies F to v1, ..., vn.
>>
>> For example, I can define:
>>
>> def F(a: string, b: number)
>> enddef
>>
>> def G(...values: list<any>): void
>> F(values[0], values[1])
>> enddef
>>
>> G('xyz', 42)
>>
>> I would like to generalize G so that it can invoke any function, i.e.:
>>
>> def G2(F: func, ...values: list<any>): void
>> F(XXXX)
>> enddef
>>
>> G2(F, 'xyz', 42)
>>
>> The problem is: what can I put in place of XXXX? F(values) doesn't cut
>> it.
>
> Why not use call():
> call(F, ['xyz', 42])
Ah, I had forgotten about call()!
> Or, if you need G2() to do something more:
> def G2(F: func, ...values: list<any>): void
> call(F, values)
> enddef
Yes, that does exactly what I have asked for.
Thanks!
Life.