getCombined method
Returns a lazy iterable combining facts and derived tuples for a relation.
This avoids allocating a new list on every rule evaluation by yielding elements from both sources without copying. O(1) allocation instead of O(n).
Implementation
@pragma('vm:prefer-inline')
Iterable<List<Object>> getCombined(
String relation,
Map<String, List<List<Object>>> facts,
Map<String, List<List<Object>>> derived,
) sync* {
final f = facts[relation];
if (f != null) yield* f;
final d = derived[relation];
if (d != null) yield* d;
}