-
Notifications
You must be signed in to change notification settings - Fork 8
Examples Operators
Luis Llamas edited this page Aug 26, 2019
·
8 revisions
★ = important
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.Where([](int x) {return x >= 2; })
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.Distinct()
.ToSerial();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.If([](int x) { return x > 2; },
[](int x) {Serial.println(10 * x); })
.If([](int x) { return x <= 2; },
[](int x) {Serial.println(5 * x); })
.DoNothing();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.ForEach([](int x) {Serial.println(x); })
.DoNothing();
}
void loop()
{
}
#include "ReactiveArduinoLib.h"
int values[] = { 0, 1, 1, 2, 1, 5, 4 };
size_t valuesLength = sizeof(values) / sizeof(values[0]);
void setup()
{
Serial.begin(115200);
while (!Serial) delay(1);
Reactive::FromArray(values, valuesLength)
.Repeat(3)
.ToSerial();
}
void loop()
{
}