Skip to content

Instantly share code, notes, and snippets.

View cdsousa's full-sized avatar

Cristóvão Duarte Sousa cdsousa

View GitHub Profile
@cdsousa
cdsousa / fsa_literal_macros.jl
Created August 27, 2015 11:38
Experiments with literal vectors and matrices for FixedSizeArrays.jl
using FixedSizeArrays: Mat, FixedVector
immutable Vec{N, T} <: FixedVector{N, T}; _::NTuple{N, T}; end
macro fsa(expr)
if expr.head == :vect
Expr(:call, :Vec, expr.args...)
elseif expr.head == :hcat
Expr(:call, :Mat, [Expr(:tuple, a) for a in expr.args]...)
elseif expr.head == :vcat
if isa(expr.args[1], Expr) && expr.args[1].head == :row