xtmdoc-alist-lessthan   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;; sort the alists (as returned by the various handler functions) into
;; a reasonably meaningful order (least to most important)
(define xtmdoc-alist-lessthan
  (lambda (left right)
    (let ((categories '("C function"
                        "global var"
                        "polymorphic closure"
                        "polymorphic type"
                        "closure"
                        "named type"
                        "generic closure"
                        "generic type"
                        "type alias"
                        "builtin")))
      (let ((lpos (cl:position (cdr (assoc-strcmp 'category left)) categories))
            (rpos (cl:position (cdr (assoc-strcmp 'category right)) categories)))
        (if (<> lpos rpos)
            (< lpos rpos)
            (string<? (cdr (assoc-strcmp 'name left))
                      (cdr (assoc-strcmp 'name right))))))))


Back to Index