Integrated Dynamics - On the Dynamics of Integration

De waarde van operators

In Integrated Dynamics, Operators are first-class citizens. Up until now, we have only used them 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==Tests whether two values are equal. The types of both must be the same.
  • Willekeurig
  • Willekeurig
  • Booleaanse waarde
Global name: anyEquals(WillekeurigWillekeurig) → Booleaanse waardeMethod name: Willekeurig.equals(Willekeurig) → Booleaanse waarde
Operator
FilterfilterFilter a list of elements by matching them all with the given predicate.
  • Operator
  • Lijst
  • Lijst
Global name: operatorFilter(OperatorLijst) → LijstMethod name: Operator.filter(Lijst) → Lijst
Operator
ApplyapplyApply for a given operator a given value.
  • Operator
  • Willekeurig
  • Willekeurig
Global name: operatorApply(OperatorWillekeurig) → WillekeurigMethod name: Operator.apply(Willekeurig) → Willekeurig
Advancements
  • Dynamisch optellenRoep de optellingsoperator dynamisch aan
  • Dynamische lijstfilteringFilter een gehele getallenlijst van 1, 10 en 100 tot 10.
Beloningen
Variabelekaart64
Variabelekaart64
Variabelekaart64
Variabelekaart64