Most general higher-order constraint describing a sequence of integers ordered with respect to a relation

后端 未结 3 1545
时光取名叫无心
时光取名叫无心 2020-11-22 04:16

In CLP(FD), we frequently need to state: \"This is a list of integers and finite domain variables in (sometimes: strictly) ascending/descending order.\"

Is

3条回答
  •  轮回少年
    2020-11-22 04:46

    Hoogle was not very useful, but Hayoo is!

    foldcmpl

    so this is a special form of fold for a list, but it does not apply length list times but one time less.

    isSortedBy

    is not entirely general in its name, but in its signature. Maybe insisting on the most general name is not that helpful. Otherwise we just have entities all over?

    The definition reads:

    The isSortedBy function returns True iff the predicate returns true for all adjacent pairs of elements in the list.

    Maybe: all_adjacent_pairs(R_2, Xs). which sounds a bit after having a looping construct that has adjacent_pair as some modifier.

提交回复
热议问题