lindahua/DeExpr.jl — pull request #17 by tshort (2013-02-06 01:12:31+00:00)
Title: Add @devec_transform for devectorizing operations with associative types

I wrote this mainly to work with DataFrames (https://github.com/HarlanH/DataFrames.jl/issues/179), but since it is designed to work with all associative types, maybe you would like to include it with DeExpr. Here is an example:

```julia
julia> d = {:x => rand(2), :y => rand(2), :z => rand(2)}
{:x=>[0.938044, 0.638445],:y=>[0.899549, 0.122162],:z=>[0.339539, 0.136685]}

julia> @devec_transform d z2 = sqr(z)
{:z2=>[0.115287, 0.0186828],:x=>[0.938044, 0.638445],:y=>[0.899549, 0.122162],:z=>[0.339539, 0.136685]}

julia> @devec_transform(d, xyz => x + y + z)
{:z2=>[0.115287, 0.0186828],:x=>[0.938044, 0.638445],:y=>[0.899549, 0.122162],:z=>[0.339539, 0.136685],:xyz=>[2.17713, 0.897292]}

julia> @devec_transform(d, y => y .* 2)
{:z2=>[0.115287, 0.0186828],:x=>[0.938044, 0.638445],:y=>[1.7991, 0.244324],:z=>[0.339539, 0.136685],:xyz=>[2.17713, 0.897292]}

```