simple derive utility macro
This commit is contained in:
parent
630170cec0
commit
8b7d575efe
@ -1,6 +1,6 @@
|
|||||||
module Flux
|
module Flux
|
||||||
|
|
||||||
using Lazy, Flow
|
using MacroTools, Lazy, Flow
|
||||||
|
|
||||||
# Zero Flux Given
|
# Zero Flux Given
|
||||||
|
|
||||||
|
@ -22,3 +22,12 @@ function ∇graph(v::IVertex, ∇, out = d())
|
|||||||
end
|
end
|
||||||
return out
|
return out
|
||||||
end
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user