NamedTuples.jl provides an implementation of type safe named tuples for 
Julia (cf named tuples in python). NamedTuples may be used anywhere that a 
tuple is currently being used, for example in the definition of a method or 
as the return value of a method. NamedTuples are implemented using Julia’s 
macro system ensuring that the run time cost is equivalent to constructing 
a regular immutable type.

NamedTuples may also be used in cases where a small typed immutable 
dictionary is desired.

https://github.com/blackrock/NamedTuples.jl

Any bugs or issues please reach out or open an issue.

module Test
using NamedTuples

function foo( y )
    a = 1
    x = 3
    return  @NT( a => 1, b => "world", c => "hello", d=>a/x, y => a/y  )
end
function bar( nt::@NT( a::Int64, c::ASCIIString ))
    return repeat( nt.c, nt.a )
end

end

Test.foo( 1 ) # Returns a NamedTuple of 5 elements
Test.bar( @NT( a=> 2, c=>"hello")) # Returns `hellohello`




Reply via email to