On Sun, 17 Sept 2023 at 17:46, Emanuel Berg <in...@dataswamp.org> wrote:
> For example, (+ ...), (- ...) etc are preferable to > (arithmetic :operation 'addition ...), > (arithmetic :operation 'subtraction ...) etc. Let’s reframe that in more real-life examples. What is preferable and why: 1. a couple of functions a. ‘(my-sort-by SEQ LESSP)’ where LESSP is a function accepting two elements X and Y and returning ‘t’ when X should be sorted before Y, and b. ‘(my-sort-on SEQ KEY)’ where KEY is a function accepting an element X and returning a number such that sorting by that number yields the desired order; or 2. a single function that could be called as ‘(my-sort SEQ :by LESSP)’ or ‘(my-sort SEQ :key KEY)’, with the same semantics as above? Does your answer change if we want to extend the API to also support sorting in descending order? If it does, how?