IFClite TypeScript API
    Preparing search index...

    Function foldBetweenPairs

    • Merge gte/lte pairs on the identical subject into one BetweenChip, regardless of which one appears first. A subject with only a gte, only a lte, or more than one of either, is left as plain rules — folding only ever removes exactly two entries and adds exactly one, never guesses which of several candidates pairs with which.

      Pairing happens in a PASS OF ITS OWN, before anything is written to out: a single combined pass that pushed a lte immediately (because it isn't itself a gte) and only later discovered, at its gte partner's index, that the two pair up, would leave that lte in out TWICE — once as the plain rule already pushed, once folded inside the chip — so [lte(300), gte(100)] (partner before the gte that finds it) silently produced three rules on unfold instead of two. Deciding every pair up front means the emitting pass never has to un-push something it already committed.

      Parameters

      Returns FoldedRule[]