Updated regularity (markdown)
parent
28aaaa3e6a
commit
57bb0e5432
|
@ -1 +1,18 @@
|
|||
A
|
||||
A regularity is a map whose values are maps, all of whose members share the same keys. A map may be added to a regularity only if it has all the keys the regularity expects, although it may optionally have more. It is legitimate for the same map to be a member of two different regularities, if it has a union of their keys. Keys in a regularity must be keywords. Regularities are roughly the same sort of thing as classes in object oriented programming or tables in databases, but the values of the keys are not policed (see [[homogeneity]]).
|
||||
|
||||
A regularity may also have an association of methods, that is, functions which accept a member of the regularity as their first argument; this set of methods forms an API to the regularity. Of course a full hierarchical object oriented model can be layered on top of this, but a regularity does not in itself have any concept of class inheritance.
|
||||
|
||||
But, for example, if we have a regularity whose members represent companies, and those companies each have employees, then there might be a method `:payroll` of companies which might internally look like:
|
||||
|
||||
```
|
||||
(defun payroll (company)
|
||||
(reduce + (map :salary (:employees company))))
|
||||
```
|
||||
|
||||
which would be accessed
|
||||
|
||||
```
|
||||
(with ((companies . ::shared:pool:companies)
|
||||
(acme . companies:acme-widgets))
|
||||
(companies:methods:payroll acme))
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue