simple derive utility macro
This commit is contained in:
parent
630170cec0
commit
8b7d575efe
@ -1,6 +1,6 @@
|
||||
module Flux
|
||||
|
||||
using Lazy, Flow
|
||||
using MacroTools, Lazy, Flow
|
||||
|
||||
# Zero Flux Given
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user