def positions

bend-lint-rules@0.2.0.0 · lib/text/main.bend:324

import bend-lint-rules@0.2.0.0/lib/text/main.bend as BendLintRules
import Base
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists

324# Where each offset of `offsets` is in `text`, in order: one pass over the text, whatever the number of offsets.
325def positions(text: String, offsets: List<&2, U32>) -> List<&2, Position>:
326  Walk.positions(
327    Lists.sort(
328      ~Located,
329      ~Located.is_le,
330      Walk.locate(Lists.sort(~Placed, ~Placed.is_le, Placed.of(offsets, 0, [])), text)
331    ),
332    []
333  )

Uses (12)

Used by (1)