def sorted_by

bend-mathlib@0.8.1.0 · list.bend:707

import bend-mathlib@0.8.1.0/list.bend as List
import Base

707# A list is sorted by a comparator when every adjacent pair is in order.
708def sorted_by(~A: Data, ~le: A -> A -> Bool, +xs: List<&2, A>) -> Data:
709  {List.all(~&1, ~(A & A), ~(p => le(Pair.fst(A, A, p), Pair.snd(A, A, p))), List.zip(&2, A, &2, A, xs, List.tail(&2, A, xs))) == True{} : Bool}

Uses (8)

Used by (44)