LispPad
  • Home
  • Applications
    • 🖥️LispPad
      • Sessions
      • Editor
      • Preferences
    • 📱LispPad Go
    • 📜Language
    • 📖Libraries
  • Libraries
    • ⚙️LispKit
      • (lispkit archive tar)
      • (lispkit archive zip)
      • (lispkit base)
      • (lispkit bitset)
      • (lispkit box)
      • (lispkit bytevector)
      • (lispkit char)
      • (lispkit char-set)
      • (lispkit combinator)
      • (lispkit comparator)
      • (lispkit control)
      • (lispkit core)
      • (lispkit crypto)
      • (lispkit csv)
      • (lispkit datatype)
      • (lispkit date-time)
      • (lispkit debug)
      • (lispkit disjoint-set)
      • (lispkit draw)
      • (lispkit draw turtle)
      • (lispkit draw barcode)
      • (lispkit draw chart bar)
      • (lispkit dynamic)
      • (lispkit enum)
      • (lispkit format)
      • (lispkit graph)
      • (lispkit gvector)
      • (lispkit hashtable)
      • (lispkit heap)
      • (lispkit http)
      • (lispkit http oauth)
      • (lispkit http server)
      • (lispkit iterate)
      • (lispkit json)
      • (lispkit json schema)
      • (lispkit list)
      • (lispkit list set)
      • (lispkit log)
      • (lispkit markdown)
      • (lispkit match)
      • (lispkit math)
      • (lispkit math matrix)
      • (lispkit math stats)
      • (lispkit math util)
      • (lispkit object)
      • (lispkit port)
      • (lispkit prolog)
      • (lispkit queue)
      • (lispkit record)
      • (lispkit regexp)
      • (lispkit serialize)
      • (lispkit set)
      • (lispkit sqlite)
      • (lispkit stack)
      • (lispkit stream)
      • (lispkit string)
      • (lispkit styled-text)
      • (lispkit system)
      • (lispkit system call)
      • (lispkit system keychain)
      • (lispkit system pasteboard)
      • (lispkit test)
      • (lispkit text-table)
      • (lispkit thread)
      • (lispkit thread channel)
      • (lispkit-thread-future)
      • (lispkit thread shared-queue)
      • (lispkit type)
      • (lispkit url)
      • (lispkit vector)
    • ⚙️LispPad
      • (lisppad applescript)
      • (lisppad draw map)
      • (lisppad location)
      • (lisppad speech)
      • (lisppad system)
      • (lisppad turtle)
    • ⚙️SRFI
  • Examples
    • 📝LispKit
    • 📝LispPad
    • 📝LispPad Go
  • Releases
    • 🖥️LispPad
    • 📱LispPad Go
  • Downloads
  • Privacy Policy
  • Contact
Powered by GitBook
On this page
  1. Libraries
  2. LispKit

(lispkit heap)

Last updated 6 months ago

Library (lispkit heap) provides an implementation of a priority queue in form of a binary max heap. A max heap is a tree-based data structure in which for any given node C, if P is a parent node of C, then the value of P is greater than or equal to the value of C. Heaps as implemented by (lispkit heap) are mutable objects.


heap-type-tag

Symbol representing the heap type. The type-for procedure of library (lispkit type) returns this symbol for all heap objects.

(make-heap pred<?)

Returns a new empty binary max heap with pred<? being the associated ordering function.

(heap-empty? hp)

Returns #t if the heap hp is empty, otherwise #f is returned.

(heap-max hp)

Returns the largest item in heap hp, i.e. the item which is larger than all others according to the comparison function of hp. Note, heap-max does not remove the largest item as opposed to heap-delete-max!. If there are no items on the heap, an error is signaled.

(heap-add! hp e1 ...)

Inserts an item into the heap. The same item can be inserted multiple times.

(heap-delete-max! hp)

Returns the largest item in heap hp, i.e. the item which is larger than all others according to the comparison function of hp, and removes the item from the heap. If there are no items on the heap, an error is signaled.

(heap-clear! hp)

Removes all items from hp. After this procedure has been executed, the heap is empty.

(heap-copy hp)

Returns a copy of heap hp.

Returns a new vector containing all items of the heap hp in descending order. This procedure does not mutate hp.

Returns a list containing all items of the heap hp in descending order.

Returns a list containing all items of the heap hp in ascending order.

Inserts all the items from list items into heap hp.

Creates a new heap for the given ordering predicate pred<? and inserts all the items from list items into it. list-\>heap returns the new heap.

Creates and returns a new heap for the given ordering predicate pred<? and inserts all the items from vector vec into it.

(heap->vector hp)

(heap->list hp)

(heap->reversed-list hp)

(list->heap! hp items)

(list->heap items pred<?)

(vector->heap vec pred<?)

⚙️