VariadicList can not be passed along

I have two functions - each taking a VariadicList. If I want to pass the received VariadicList as it is to another - it does not work. How to make it work? I am pasting the compiler output below:

fn take(*take_input: Int):
    pass

fn give(*give_input: Int):
    take(give_input)

fn main():
    print("hello")

error: invalid call to ‘take’: argument #0 cannot be converted from ‘VariadicList[Int]’ to ‘Int’
take(give_input)
^~~~~~~~

What you’re looking for is variadic unpacking, which is currently unsupported:

fn give(*give_input: Int):
    take(*give_input) # unpacked arguments are not supported yet

A potential work-around is to use VariadicList directly, and create a wrapper which has variadic arguments:

fn take(take_input: VariadicList[Int]):
    pass

fn take(*take_input: Int):
    take(take_input)

fn give(*give_input: Int):
    take(give_input)

fn main():
    print("hello")

That woks. Thanks for the prompt reply - much appreciate it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.