Integrated Dynamics - On the Dynamics of Integration

The Value of Operators

In Integrated Dynamics, Operators are first-class citizens. Up until now, we have only used manually using the Logic Programmer, but in this tutorial, we’ll look into how they can be used in a more dynamic way, by storing Operators in Variable Cards, and invoking them dynamically.

As a first step, go to the Logic Programmer, and create a new static Operator, by starting to type Arithmetic Addition Operator in the autocomplete dropdown-list and clicking it, and write it to a Variable Card. After that, create two Integer variables. Next, find the Apply operator, and apply the first Integer to the Operator, which will bind the first input argument of the addition Operator to that Integer, and will output a new Operator with one remaining input argument. Next, use the Apply operator again to bind the final input argument of the newly created Operator. Finally, use a Display Panel to visualize your dynamically invoked addition.

Next to applying Operators, there are a lot of other advanced Operator operations. We’ll now look into using Operators on Lists, more specifically the Filter Operator that takes a List and a Predicate (an Operator with one input argument and a Boolean output value). Start by creating a List of the Integers 1, 10 and 100. Next, store the Relational Equals Operator in a variable. Next, apply this operator on the Integer 10. Next, use the Filter Operator with your List and the applied Operator. This will filter away all the items from the List that return False by applying them on the given operator, which in this case means that all elements that are not equal to 10 will be removed from the list. Visualize the result in a Display Panel.

There are plenty of other operations on Operators, such as combining Predicates, flipping Operator arguments, and more operations on Lists.

Operator
Equals==Type one and two must be equal.
  • §rAny§0
  • §rAny§0
  • Boolean
Global name: anyEquals(§rAny§0, §rAny§0) → BooleanMethod name: §rAny§0.equals(§rAny§0) → Boolean
Operator
FilterfilterFilter a list of elements by matching them all with the given predicate.
  • Operator
  • List
  • List
Global name: operatorFilter(OperatorList) → ListMethod name: Operator.filter(List) → List
Operator
ApplyapplyApply for a given operator a given value.
  • Operator
  • §rAny§0
  • §rAny§0
Global name: operatorApply(Operator, §rAny§0) → §rAny§0Method name: Operator.apply(§rAny§0) → §rAny§0
Advancements
  • Dynamic AdditionsInvoke the addition Operator dynamically
  • Dynamic List FilteringFilter an Integer list 1, 10 and 100 to 10.
Recompensas
Variable Card64
Variable Card64
Variable Card64
Variable Card64