simple derive utility macro

This commit is contained in:
Mike J Innes 2016-06-03 00:49:14 +01:00
parent 630170cec0
commit 8b7d575efe
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,6 @@
module Flux
using Lazy, Flow
using MacroTools, Lazy, Flow
# Zero Flux Given

View File

@ -22,3 +22,12 @@ function ∇graph(v::IVertex, ∇, out = d())
end
return out
end
macro derive(ex)
v = vertex(Flow.Do())
for (k, x) in ∇graph(il(graphm(resolve_calls(ex))), @flow())
k = Symbol("", k)
thread!(v, @v(Flow.Assign(k)(x)))
end
Expr(:quote, @> v cse syntax prettify)
end