Not sure I understand. Do you want something like
function foo(args...; kwargs...)
bar(args...; kwargs...)
end
kl. 14:04:10 UTC+2 fredag 4. juli 2014 skrev Oliver Lylloff følgende:
>
> Thanks Ivar,
>
> That's indeed the obvious choice for the general case.
> However for my example, the function PyPlot.contourf can't take a tuple as
> input, so they must be converted from e.g. (:cmap,"hot") to cmap="hot".
>
> Hope it makes sense.
>
> Oliver
>
> Den fredag den 4. juli 2014 13.47.10 UTC+2 skrev Ivar Nesje:
>>
>> function foo(args...)
>> bar(args...)
>> end
>>
>> kl. 13:42:29 UTC+2 fredag 4. juli 2014 skrev Oliver Lylloff følgende:
>>>
>>> Hello everyone,
>>>
>>> I'm trying to write a function that takes an unknown number of variables
>>> and insert those into another function
>>>
>>> function foo(args...)
>>> bar(args)
>>> end
>>>
>>> Is there any obvious way of converting the tuple of args into something
>>> callable by bar?
>>>
>>> In my example, I'm trying to create a custom plotting function with
>>> PyPlot and retain the possibility of changing the function inputs:
>>>
>>> function mycontour(x,y,b;kwargs...)
>>> fig = plt.figure(figsize=(colwidth,0.85colwidth),tight_layout=true)
>>> contourf(x,y,b,kwargs)
>>> axis("equal")
>>> axis("tight")
>>> # and several other settings
>>> end
>>>
>>> Note that in this case it is probably only keyword arguments thats going
>>> to used but I still think the general case with args is useful.
>>>
>>> I would like to be able to call mycontour with e.g.
>>> mycontour(x,y,b;levels=[1:10],cmap="CMRmap_r") and have the kwargs inserted
>>> into contourf(x,y,b,levels=[1:10],cmap="CMRmap_r"). Where levels and cmap
>>> are valid keywords of contourf.
>>>
>>> Any ideas?
>>>
>>> Best,
>>> Oliver
>>>
>>