Alignment ops

TimeDag.leftFunction
left(x, y[, alignment::Alignment; initial_values=nothing]) -> Node

Construct a node that ticks according to alignment with the latest value of x.

It is "left", in the sense of picking the left-hand of the two arguments x and y.

source
TimeDag.rightFunction
right(x, y[, alignment::Alignment; initial_values=nothing]) -> Node

Construct a node that ticks according to alignment with the latest value of y.

It is "right", in the sense of picking the right-hand of the two arguments x and y.

source
TimeDag.alignFunction
align(x, y) -> Node

Form a node that ticks with the values of x whenever y ticks.

source
TimeDag.align_onceFunction
align_once(x, y) -> Node

Similar to align(x, y), except knots from x will be emitted at most once.

This means that the resulting node will tick at a subset of the times that y ticks.

source
TimeDag.coalignFunction
coalign(x, [...; alignment::Alignment]) -> Node...

Given at least one node(s) x, or values that are convertible to nodes, align all of them.

We guarantee that all nodes that are returned will have the same alignment. The values of each node will correspond to the values of the input nodes.

The choice of alignment is controlled by alignment, which defaults to UNION.

source
TimeDag.first_knotFunction
first_knot(x::Node{T}) -> Node{T}

Get a node which ticks with only the first knot of x, and then never ticks again.

source
TimeDag.active_countFunction
active_count(nodes...) -> Node{Int64}

Get a node of the number of the given nodes (at least one) which are active.

source
TimeDag.prependFunction
prepend(x, y) -> Node

Create a node that ticks with knots from x until y is active, and thereafter from y.

Note that the value_type of the returned node will be that of the promoted value types of x and y.

source
TimeDag.throttleFunction
throttle(x::Node, n::Integer) -> Node

Return a node that only ticks every n knots.

The first knot encountered on the input will always be emitted.

Info

The throttled node is stateful and depends on the starting point of the evaluation.

source
TimeDag.lagFunction
lag(x::Node, n::Integer)

Construct a node which takes values from x, but lags them by n knots.

This means that we do not introduce any new timestamps that do not appear in x, however we will not emit knots for the first n values that appear when evaluating x.

Note

If x is a constant node, and n > 0, lag(x, n) will be an empty_node of the same value_type as x.

Conceptually, this is consistent with the view that a constant is represented by a single knot at the start of time.

source
lag(x::Node, w::TimePeriod)

Construct a node which takes values from x, but lags them by period w.

Note

For any constant, lagging by an amount of time is a no-op. This is because the constant is represented as a single value at the start of time (which will later appear at the start of the evaluation window).

source
Base.diffFunction
diff(x::Node[, n=1])

Compute the n-knot difference of x, i.e. x - lag(x, n).

source
TimeDag.count_knotsFunction
count_knots(x) -> Node{Int64}

Return a node that ticks with the number of knots seen in x since evaluation began.

source
Base.mergeFunction
merge(x::Node...) -> Node

Given at least one node x, create a node that emits the union of knots from all x.

If one or more of the inputs contain knots at the same time, then only one will be emitted. The last input in which a knot occurs at a particular time will take precedence.

If the inputs x have different value types, then the resultant value type will be promoted as necessary to accommodate all inputs.

source