The cl-ca Reference Manual

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

The cl-ca Reference Manual

This is the cl-ca Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Tue Nov 15 04:33:37 2022 GMT+0.

Table of Contents


1 Introduction

cl-ca: common lisp cellular automata

cl-ca is a common lisp library for implementing programs using cellular automata (e. g. Conway's game of life).

usage

There some example programs to introduce you.

Most functions also include a docstring.

architecture

cl-ca is build around three functions which access the hash table all automata are stored in. This hash-table is located in a closure, therefore only these functions can access it.

The functions are:

The data about the automata is stored this way in the hash-table:

(x . y) . (state function)

(the cons pair (x . y) is the key and the list ist the value)

The function gets called each step with the list representing the automaton itself and a list of lists representing its neighbors (more on that later). It must return a list representing itself (this one then gets put in the hash-table). This allows an automaton not only change its state but also to modify its behavior.

The functions moore-neighbors and von-neumann-neighbors implement neighborhood (See the corresponding Wikipedia articles: Moore Neighborhood and Von Neumann Neighborhood). One of these functions (or another one doing something reasonable in this context) should be passed to run-step and is used to calculate neighborhood then.

can I ql:quickload it?

Yes


2 Systems

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


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

2.1 cl-ca

cellular automaton library

Author

Lukas Epple <post@lukasepple.de>

License

Public Domain

Version

0.0.1

Source

cl-ca.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-ca/cl-ca.asd

Source

cl-ca.asd.

Parent Component

cl-ca (system).

ASDF Systems

cl-ca.


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

3.1.2 cl-ca/packages.lisp

Source

cl-ca.asd.

Parent Component

cl-ca (system).

Packages

cl-ca.


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

3.1.3 cl-ca/cl-ca.lisp

Dependency

packages.lisp (file).

Source

cl-ca.asd.

Parent Component

cl-ca (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


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

4.1 cl-ca

cellular automaton library

Source

packages.lisp.

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 Ordinary functions

Function: create-automata (gen-state fun)

adds the automata between from-pos to to-pos in a
2d grid. For the initial state it calls gen-state each time with the position as argument

Package

cl-ca.

Source

cl-ca.lisp.

Function: get-automaton (pos)

gets an automaton from the hash table (in the closure)

Package

cl-ca.

Source

cl-ca.lisp.

Function: get-dimensions ()
Package

cl-ca.

Source

cl-ca.lisp.

Function: moore-neighbors (pos dim)

calculates the moore neighbors of an automaton

Package

cl-ca.

Source

cl-ca.lisp.

Function: print-automata (conversion-fun)

prints the automata between two positions. It uses a conversion function to determine which char to use

Package

cl-ca.

Source

cl-ca.lisp.

Function: run-step (neighborhood)

runs the the simulation for one step. it invokes the automata in the 2d grid defined by set-dimensions

Package

cl-ca.

Source

cl-ca.lisp.

Function: set-automaton (pos state fun)

sets an automaton in the hash table (in the closure)

Package

cl-ca.

Source

cl-ca.lisp.

Function: set-dimensions (dim)

Sets the dimensions (bondaries) of the simulation (cons upperleft lowerright)

Package

cl-ca.

Source

cl-ca.lisp.

Function: von-neumann-neighbors (pos dim)

calculates the von Neumann neighbors of an automaton

Package

cl-ca.

Source

cl-ca.lisp.


5.2 Internals


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

5.2.1 Ordinary functions

Function: wrap-if-necessary (pos dim)

Makes sure that pos is always between the boundaries of (car dim) and (cdr dim). Wraps pos if necessary

Package

cl-ca.

Source

cl-ca.lisp.

Function: wrap-one-dim (n min max)

makes sure that a position is always in the boundary min - max and wraps it around if necessary

Package

cl-ca.

Source

cl-ca.lisp.


Appendix A Indexes


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

A.1 Concepts


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

A.3 Variables