Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the access Reference Manual, version 1.6.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:08:56 2022 GMT+0.
Next: Systems, Previous: The access Reference Manual, Up: The access Reference Manual [Contents][Index]
A Common Lisp library to unify access to the most common data structures and to allow you to operate on them as they are (ie as a bunch of dictionaries with slightly different apis)
These functions allow unified access to these data structures:
They also opts to produce nil as opposed to signaling errors when they fail to access (eg (access nil 'anything) produces nil rather than signaling a missing method on nil (though if 'anything is specialized on nil it will call that method)). Slot unboundedness errors are not signaled.
This library will probably appeal most to new comers to the language as everyone else will probably be happy just calling each type of access according to its own api.
These can be handy for modifying deeply nested structures without lots of intermediary bindings eg:
(setf (accesses ucw::context 'ucw::context.request ucw::parameters '("id" :type :alist)) 2043)
Will correctly set the "id" parameter of the request to 2043. It will not signal an error if request is context is unbound, nor any of the slots.
The '("id" :type :alist) is required because ucw expects an alist, but access will default to plist when asked to set on a nil.
When we fail to find an reader/writer function, access will ultimately have to be reading and writing a datastructure. That happens in these generic functions. These functions also allow access extensibility to support any conceivable map datastructure.
Access will create a dictionary to put stuff into. The type of dictionary will depend on the :type parameter.
EX:
=>(setf (accesses place
'(:a :type :alist)
'(2 :type array)
'(:b :type 'hash-table)) 3)
;; 3
=> place
;; ((:a . #(nil nil #<hash-table :b=3 >)))
This libary is meant to make writing the program easier. It does many runtime lookups and checks to make sure that funcations called can support the types they are called with. As such it should not be used in code where performance is important. It should however allow you to prototype more rapidly and change the backing data stores without having to change their access (ie I can switch from a plist to an alist and everything will continue to work)
Given a function or symbol, see if the object has a slot named that or a reader/writer function associated with that name
Returns the names associated with the classes slots. Readers and writers returns the functions used to access and set these slots, however these currently only support readers/writers with the same name as the slot.
Given an object and a function / funcation-name, this will call the function passing in the object if it seems like that will work
A helper to find you the class of a given thing
(typecase o
(symbol (find-class o))
(standard-class o)
(standard-object (class-of o)))
A predicate to make comparing symbols in different packages easier, by comparing them case-insensitively based on symbol-name. In other respects it is equalp.
Functions to ease access to plist values (used by access when detecting a plist)
DOT syntax is invoked with #D reader macro on a form or by wrapping that form in a with-dot call
Many new-comers to the language long for their dot operator from other
lanugages they know. This functionality is provided (when desired) by
enable-dot-syntax (for #D) or wrapping a block in the with-dot macro. I wrote
these for fun and much prefer just using the access functions directly
(ie. I never actually use these syntax transformers). That said, when
the dot syntax is enabled, symbols with a dot in them will be
transformed to the appropriate accesses
calls.
EX: #Dfoo.bar.bast => (accesses foo 'bar 'bast) EX: (with-dot () (setf ht.key.subkey new-val)) => (setf (accesses ht 'key 'subkey) new-val)
;; Copyright (c) 2011 Russ Tyndall , Acceleration.net http://www.acceleration.net
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;;
;; - Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;;
;; - Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Next: Files, Previous: Introduction, Up: The access Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
A library providing functions that unify data-structure access for Common Lisp: access and (setf access)
Acceleration.net, Russ Tyndall, Nathan Bird, Ryan Davis
BSD
1.6.0
Next: Packages, Previous: Systems, Up: The access Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: access/access.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
access (system).
Next: access/arg-list-manipulation.lisp, Previous: access/access.asd, Up: Lisp [Contents][Index]
access (system).
Previous: access/access.lisp, Up: Lisp [Contents][Index]
access.lisp (file).
access (system).
Next: Definitions, Previous: Files, Up: The access Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: Indexes, Previous: Packages, Up: The access Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Setf expanders, Previous: Public Interface, Up: Public Interface [Contents][Index]
Restore readtable which was active before last call to If there was no such call, the standard readtable is used.
Enable reader syntax.
Similar to with-accessors except using the access functions
A macro which binds local variables from accessed values on object
according to bindings
bindings: (local-symbol-and-access-key
or (local-symbol access-key)
...)
obj: the thing we are accessing data from
A macro which binds local variables for each slot value in class as by access
A macro which binds (like with-access) all slot names of a class to a local
symbolmacro let storing and retrieving using access
class-name: a symbol or a list of class-names (symbols)
to make this easier to call we ignore quote and or
eg: ’t1=>t1, (or ’t1 ’t2 ...)=> (t1 t2 ...)
Next: Ordinary functions, Previous: Macros, Up: Public Interface [Contents][Index]
This should allow setting places through access
access (function).
Next: Generic functions, Previous: Setf expanders, Up: Public Interface [Contents][Index]
Access plists, alists, arrays, hashtables and clos objects
all through the same interface
skip-call, skips trying to call
Copy the values on ’from’ to ’to’ for all of the keys listed
keep accessing keys on resulting objects
eg: (accesses o k1 k2) => (access (access o k1) k2)
For an object and a list of fn/fn names, call-if-applicable repeatedly
See if there is a method named fn specialized on o, or a function named fn
and call it if so
TODO: dont call macro functions/special forms, they are not applicable
ensures o is a class (or list thereof) and returns all the direct slot reader functions)
returns the class of the object/symbol (or itself if it is a class), if passed a list returns a list of these results
compares symbols by equalp symbol-name
like slot-value but without boundedness errors and works with slot definitions
For o, does a reader function exist for it
Does o have a slot named slot-name
if lax? we will ignore packages to find the slot we will always return a slot-name from the specified package if it exists, otherwise we return the slot-name we found if its in a different package
For o, does a writer function exist for it?
Mutate the value stored in key k on object o, by passing it through fn
set places in plists, alists, hashtables and clos objects all through the same interface
keep accessing till you get to the end of keys , then store the result of
setting that field back up the call tree
returns the new value and the object that was stored there
(so for a plist / alist you have a ref to the val and the full list)
Next: Conditions, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Given an &rest value that contains a (partial) lambda list with keys somewhere in it, find the specified value for a given key
returns the slots for the class/obj or list of class/obj passed in
Ensure that a specific keyword has a value (or default) in an appliable arg list
get a value out of a plist based on its key
Remove a specific keyword and value from the
removes key & its value from plist returning (values plist (list-of-values-removed))
Set the keyword parameter id to the value new
if ensure? then only set if it doesnt exist (in which case new acts as a default)
If a key exists in the plist, set its value, otherwise add this key to the dictionary
Previous: Generic functions, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
A stack which holds the previous readtables that have been pushed here by ENABLE-DOT-SYNTAX.
Next: Generic functions, Previous: Special variables, Up: Internals [Contents][Index]
Gets the slots off a class an builds binding like (local::symbol orig::symbol) where local is the current *package* and orig is the original package of the symbol
used in with-all-slot-accessors
Internal function used to restore previous readtable.
Internal function used to enable reader syntax and store current readtable on stack.
remove any quote / ors so that list type-specifications
A macro which binds (like with-access) all slot names of a class to a local
symbolmacro let storing and retrieving using access
class-name: a symbol or a list of class-names (symbols)
to make this easier to call we ignore quote and or
eg: ’t1=>t1, (or ’t1 ’t2 ...)=> (t1 t2 ...)
Mapcan caused all sorts of trouble with its NCONCing
Reads a form and replaces dot calls
If we find a setf function named (setf fn) that can operate on o then call that with value new
Next: Conditions, Previous: Ordinary functions, Up: Internals [Contents][Index]
Previous: Generic functions, Up: Internals [Contents][Index]
simple-condition.
(quote nil)
:format-control
(quote nil)
:format-args
(quote nil)
:original-error
Previous: Definitions, Up: The access Reference Manual [Contents][Index]
Jump to: | %
(
A C D E F G H M N O P R S T W |
---|
Jump to: | %
(
A C D E F G H M N O P R S T W |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
F O S |
---|
Jump to: | *
F O S |
---|
Jump to: | A C F P S |
---|
Jump to: | A C F P S |
---|