Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.
/ cl-heap Public archive

Thread-safe heap implementations for Common Lisp

License

Notifications You must be signed in to change notification settings

zerth/cl-heap

Repository files navigation

heap

Thread-safe heap (priority queue) implementations for Common Lisp. Initial implementation includes splay heaps.

Usage:

(let ((heap (heap:make-heap))
      (items (loop for i from 0 below 1024
                   for x = (random 1024)
                   collect x
                   when (zerop (mod i 2)) collect x)))

  (dolist (x items)
    (heap:heap-push heap x x))

  (assert (= (length items) (heap::heap-count heap)))

  (loop for x in (sort items #'<)
        do (multiple-value-bind (next pri empty-p)
               (heap:heap-pop heap)
             (assert (not empty-p))
             (assert (= next pri))
             (assert (= next x))))

  (assert (zerop (heap::heap-count heap))))

About

Thread-safe heap implementations for Common Lisp

Resources

License

Stars

Watchers

Forks

Packages

No packages published