Created
January 10, 2012 20:23
-
-
Save osa1/1590973 to your computer and use it in GitHub Desktop.
persistent set data structure built on top of persistent hamt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :cl-user) | |
(defpackage pset | |
(:use :cl :hamt) | |
(:export put get make-pset) | |
(:shadow put get)) | |
(in-package pset) | |
(defstruct (pset | |
(:print-function | |
(lambda (struct stream depth) | |
(declare (ignore struct depth)) | |
;; TODO: | |
(format stream "")))) | |
(data (hamt:make-hamt))) | |
(defun put (pset item) | |
(make-pset :data (hamt:put (pset-data pset) (hamt::make-keyval-pair item item)))) | |
(defun get (pset item) | |
(hamt:get (pset-data pset) item)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment