TupleTypes.jl

A testbed for an API to access Tuple parameters
Popularity
0 Stars
Updated Last
8 Years Ago
Started In
June 2015

Tuples

Build Status Coverage Status

This package explores an interface to work with Tuple{}s. See JuliaLang/julia#11547

It provides the following methods to work with Tuples as though they are containers of their parameters. It does not export these methods as they would clash with the Base methods of the same name. As such, they must be called fully-qualified with the module name.

  • Tuples.length(T): The number of component types in a Tuple T.
  • Tuples.collect(T): Returns the component types inside the Tuple T as an iterable container
  • Tuples.getindex(T, i::Integer): Returns the i-th component of the Tuple T
  • Tuples.getindex(T, Is): Returns an iterable container with each element set to the i-th component, for each i in Is.

Additionally, it provides a convenience method for constructing Tuple types by calling NTuple, akin to the base method ntuple:

  • NTuple(f, n::Integer): Construct a Tuple{} such that the i-th component is the result of f(i).