Predicate<T> typedef
Predicate<T> =
bool Function(T input)
useful compound methods
Implementation
// extension DartCompoundApi on VirtualMachine {
// T popChecked<T, R extends FlightValue<T>>() {
// final value = Pop();
// if (value.runtimeType != R) throw TypeError();
// return value.value;
// }
//
// double popNumber() => popChecked<double, NumberValue>();
//
// String popString() => popChecked<String, StringValue>();
//
// dynamic popObject() => popChecked<dynamic, DartObjectValue>();
//
// Map<FlightValue, FlightValue> popMap() =>
// popChecked<Map<FlightValue, FlightValue>, MapValue>();
//
// // sets a named variable in the current frame
// void operator []=(String name, dynamic value) {
// push(value);
// push(name);
// store();
// }
//
// // sets a named variable in the current frame
// FlightValue operator [](String name) {
// push(name);
// load();
// return Pop();
// }
//
// /// run a program (dart or flight) in the current frame
// void runInCurrentContext(dynamic program) {
// final closure = box(program);
// if (closure.isNotFunction) {
// throw TypeError();
// }
// (closure as Closure).invoke(this);
// }
//
// /// function call without constantly pushing/popping
// void fcall(FlightValue fn) {
// push(fn);
// execute();
// }
//
// /// convert the passed value to its flightvalue
// FlightValue box(dynamic value) {
// push(value);
// return Pop();
// }
//
// /// pop the stack until you find a particular value, returning everything you popped
// /// takes a parameter as to whether or not to include the found value (default true)
// List<FlightValue> popUntil(Predicate<FlightValue> predicate,
// {includeFound = true}) {
// final retval = Queue<FlightValue>();
// while (true) {
// final next = Pop();
//
// if (includeFound == false && predicate(next)) {
// return retval.toList(growable: false);
// }
//
// retval.addFirst(next);
//
// if (includeFound == true && predicate(next)) {
// return retval.toList(growable: false);
// }
// }
// }
// }
typedef Predicate<T> = bool Function(T input);