Add key/start/end to the bisect functions
author |
Steve Losh <steve@stevelosh.com> |
date |
Sat, 10 Nov 2018 19:35:46 -0500 |
parents |
de9d10a9b4b5 |
children |
a8b03be59283 |
(in-package :losh.clos)
(defun build-slot-definition (conc-name slot-spec)
(destructuring-bind (name &key
(type nil type?)
(documentation nil documentation?)
(initform nil initform?)
(accessor (symb conc-name name))
(initarg (ensure-keyword name)))
(ensure-list slot-spec)
`(,name
:initarg ,initarg
:accessor ,accessor
,@(when initform? `(:initform ,initform))
,@(when type? `(:type ,type))
,@(when documentation? `(:documentation ,documentation)))))
(defmacro defclass* (name-and-options direct-superclasses slots &rest options)
"`defclass` without the tedium.
This is like `defclass`, but the `:initarg` and `:accessor` slot options will
automatically be filled in with sane values if they aren't given.
"
(destructuring-bind (name &key (conc-name (symb name '-)))
(ensure-list name-and-options)
`(defclass ,name ,direct-superclasses
,(mapcar (curry #'build-slot-definition conc-name) slots)
,@options)))