Have one-argument '<? et al function as 'make<? et al Alan Manuel Gloria 26 Feb 2014 04:16 UTC

Hello SRFI-114 mailing list,

This is a rather SRFI-105-centric proposal, but I'd like to propose
that, if '<? and friends are given a single comparator argument, it
return a function predicate:

 (<? comparator) => predicate-function
 ... and so on...

This allows the following use of SRFI-105:

(define-record-type <set>
  (node c l v r)
  (c get-c)
  (l get-l)
  (v get-v)
  (r get-r))

{(define set[v-find]
    ((null? set) #f)
    ((not (set? set)) (raise-type-error-whatever-whatever))
      (let ((c (get-c set))
            (v (get-v set)))
          ({v-find (<? c) v}  (get-l set)[v-find])
          ({v-find (=? c) v}  #t)
          ({v-find (>? c) v}  (get-r set)[v-find])))))}

Admittedly, it's possible to just use 'make<? and friends if we're
going to use SRFI-105 anyway, but it seems clearer to use <? if
SRFI-105 is something to support.