27 lines
675 B
Common Lisp
27 lines
675 B
Common Lisp
;;;; cl-scopes/csys/space
|
|
;;;; definitions for (spatial) registering and retrieving objects by location
|
|
|
|
(defpackage :scopes/csys/space
|
|
(:use :common-lisp)
|
|
(:local-nicknames (:alx :alexandria)
|
|
(:util :scopes/util)
|
|
)
|
|
(:export #:create #:put #:fetch #:query))
|
|
|
|
(in-package :scopes/csys/space)
|
|
|
|
(defun create ()
|
|
(make-hash-table :test #'equalp))
|
|
|
|
(defun put (space key value)
|
|
(let ((current (gethash key space)))
|
|
(if current
|
|
(util:lgw "location already occupied" space key current value)
|
|
(setf (gethash key space) value))))
|
|
|
|
(defun fetch (space key)
|
|
(gethash key space))
|
|
|
|
(defun query (space pattern)
|
|
nil)
|
|
|