5b5e1b9adbbd

Remove `gethash-or-init`, it's already in Alexandria as `ensure-gethash`
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 22 Aug 2016 19:54:09 +0000
parents a1bc13ae51e7
children 2255eeb67076
branches/tags (none)
files losh.lisp package.lisp

Changes

--- a/losh.lisp	Mon Aug 22 19:51:05 2016 +0000
+++ b/losh.lisp	Mon Aug 22 19:54:09 2016 +0000
@@ -443,27 +443,6 @@
 (defun-fmda single-float)
 
 
-;;;; Hash Tables
-(defmacro gethash-or-init (key hash-table default-form)
-  "Get `key`'s value in `hash-table`, initializing if necessary.
-
-  If `key` is in `hash-table`: return its value without evaluating
-  `default-form` at all.
-
-  If `key` is NOT in `hash-table`: evaluate `default-form` and insert it before
-  returning it.
-
-  "
-  ;; TODO: think up a less shitty name for this
-  (once-only (key hash-table)
-    (with-gensyms (value found)
-      `(multiple-value-bind (,value ,found)
-        (gethash ,key ,hash-table)
-        (if ,found
-          ,value
-          (setf (gethash ,key ,hash-table) ,default-form))))))
-
-
 ;;;; Queues
 ;;; Based on the PAIP queues (thanks, Norvig), but beefed up a little bit to add
 ;;; tracking of the queue size.
--- a/package.lisp	Mon Aug 22 19:51:05 2016 +0000
+++ b/package.lisp	Mon Aug 22 19:54:09 2016 +0000
@@ -96,11 +96,6 @@
     #:fill-multidimensional-array-fixnum
     #:fill-multidimensional-array-single-float))
 
-(defsubpackage #:losh.hash-tables
-  (:documentation "Utilities related to hash tables.")
-  (:export
-    #:gethash-or-init))
-
 (defsubpackage #:losh.queues
   (:documentation "A simple queue implementation.")
   (:export