Reducing redundant typing when returning named tuples

I think there was a post about this a while back but I’m not sure if it was before named tuples were in base or not and I also cannot find it.

Say I create local variables a, b, and c inside a function. I want to return a named tuple (a=a,b=b,c=c). But I do this a LOT and I have more meaningful variable names, so this gets lengthy because I have to type everything TWICE (:sob:) . Is there a macro sitting around somewhere that will take this variable list and create what I want? Something like mytuple = @NT a b c perhaps (I know @NT was already used for something else)

It needs to be dynamic because this is basically how I’ve started writing most of my functions…even if that is a bad design decision.

1 Like

I found it! Consider this some free publicity for https://github.com/JeffreySarnoff/NamedTupleTools.jl