The cl-locatives Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-locatives Reference Manual

This is the cl-locatives Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 03:56:08 2022 GMT+0.

Table of Contents


1 Introduction

                             CL-LOCATIVES
                             ============

                           By Robert Smith

Locatives are the Lisp equivalent of pointers, minus the
arithmetic. In Lisp terms, they make the concept of "places"
first-class.

The main API consists of the macro LOCATIVE-FOR, which takes as an
argument a place, as you would give to SETF; and the function
DEREFERENCE, which extracts the value of that place, and (SETF
DEREFERENCE), which sets the value of that place.

The following example pretty much sums up the API:

(let* ((x (make-array 5 :initial-element 0))
       (l (locative-for (aref x 2))))
  (setf (dereference l) 5)
  (list l
        x
        (dereference l)))

gives

(# #(0 0 5 0 0) 5)

as a result. We also have LOCATIVEP, and you can funcall the
LOCATIVE-WRITER of a locative if you need to deal with multiple values
(a rare case).

This code can be very useful for porting over C code which uses
pointers and by-reference values a lot.


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-locatives

Implementation of locatives, pointer-like objects in Lisp.

Author

Robert Smith <quad@symbo1ics.com>

License

BSD 3-clause (See LICENSE)

Source

cl-locatives.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-locatives/cl-locatives.asd

Source

cl-locatives.asd.

Parent Component

cl-locatives (system).

ASDF Systems

cl-locatives.


3.1.2 cl-locatives/package.lisp

Source

cl-locatives.asd.

Parent Component

cl-locatives (system).

Packages

cl-locatives.


3.1.3 cl-locatives/cl-locatives.lisp

Dependency

package.lisp (file).

Source

cl-locatives.asd.

Parent Component

cl-locatives (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-locatives

A package for creating and manipulating locatives.

Source

package.lisp.

Nickname

loc

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: locative-for (place)

Return a locative for the place PLACE.

PLACE should be a form that can be passed as the first argument to SETF.

Package

cl-locatives.

Source

cl-locatives.lisp.


5.1.2 Setf expanders

Setf Expander: (setf dereference) (locative)
Package

cl-locatives.

Source

cl-locatives.lisp.

Reader

dereference (function).


5.1.3 Ordinary functions

Function: dereference (locative)

Return a value that a locative LOCATIVE "points" to.

Package

cl-locatives.

Source

cl-locatives.lisp.

Setf expander for this function

(setf dereference).

Reader: locative-writer (instance)
Package

cl-locatives.

Source

cl-locatives.lisp.

Target Slot

writer.

Function: locativep (object)
Package

cl-locatives.

Source

cl-locatives.lisp.


5.1.4 Standalone methods

Method: print-object ((object locative) stream)
Source

cl-locatives.lisp.


5.1.5 Structures

Structure: locative

A pointer-like data structure to allow, among other things, "reference passing" programming style.

Package

cl-locatives.

Source

cl-locatives.lisp.

Direct superclasses

structure-object.

Direct methods

print-object.

Direct slots
Slot: reader
Type

function

Initform

(error "must provide reader function.")

Readers

locative-reader.

Writers

This slot is read-only.

Slot: writer
Type

function

Initform

(error "must provide writer function.")

Readers

locative-writer.

Writers

This slot is read-only.


5.2 Internals


Previous: , Up: Internals   [Contents][Index]

5.2.1 Ordinary functions

Function: %make-locative (&key reader writer)
Package

cl-locatives.

Source

cl-locatives.lisp.

Reader: locative-reader (instance)
Package

cl-locatives.

Source

cl-locatives.lisp.

Target Slot

reader.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   R   S   W  
Index Entry  Section

R
reader: Public structures

S
Slot, reader: Public structures
Slot, writer: Public structures

W
writer: Public structures

Jump to:   R   S   W