## afu/binlist-to-proportions [ Functions ]

[ Top ] [ afu ] [ Functions ]

DATE

``` May 23rd 2019, Heidhausen
```

DESCRIPTION

``` From a list of an arbitrary number of 1s and 0s, create a list of
corresponding proportions: Each occurrence of 1 starts a new item, with each
subsequent occurence of 0 incrementing the proportion we'll collect.

NB all 0s at the beginning of the list will be ignored until we see the
first 1.
```

ARGUMENTS

``` a simple list of 1s and 0s
```

RETURN VALUE

``` a list of integers
```

EXAMPLE

```(binlist-to-proportions '(1 0 0 1 0 1 0 1 0 0 0))
--> (3 2 2 4)

;;; the final 1 has no following 0s so its 'length' is 1
(binlist-to-proportions '(1 0 0 1 0 1 0 1 0 0 0 1))
--> (3 2 2 4 1)

(binlist-to-proportions '(0 0 0 1 0 0 1 0 1 0 1 0 0 0 1))
--> (3 2 2 4 1)
```

SYNOPSIS

```(defun binlist-to-proportions (binlist)
```

## afu/inflate-proportionally [ Functions ]

[ Top ] [ afu ] [ Functions ]

DATE

``` May 23rd 2019, Heidhausen
```

DESCRIPTION

``` Take a list of proportions (generally integers but floating-point works too)
and create a longer list, using the proportions scaled proportionally. In
other words a list like '(1 2 3) will become '((1 2 3) (2 4 6) (3 6 9))
i.e. internally always in proportion like the original but leading of course
then to other proportions when used with permutations (see inline comments).
```

ARGUMENTS

``` a simple list of proportions
```

OPTIONAL ARGUMENTS

``` keyword arguments:
- :invert. Whether to invert proportions (e.g. 3 becomes 1/3)  . Default =
T.
- :rescale. Whether to scale the results to be within new
minima/maxima. This should be a two-element list (min. max.). Default =
'(0 1).
- :highest. The highest number to use from the original list when scaling.
This limit is offered so that we don't end up with most of our numbers
down at the very bottom end of our scale. Default = 4.
- :lowest. Similar to :highest but the minimum scaler we'll use.
Default = 1.
- :reverse. Whether to alternate the original order with the reverse thereof
when looping through the list and applying proportional scalers. Default =
T.
- :expt. An exponent to raise our results to before the rescaling process
(if used). Of course this completely changes proportions but there are
times when results are far too skewed to the bottom of the range so using
an exponent such as 0.3
```

RETURN VALUE

SYNOPSIS

```(defun inflate-proportionally (l &key (invert t) (rescale '(0 1))
(lowest 1) (highest 4)
(reverse t) (expt nil))
```

## afu/make-afu [ Functions ]

[ Top ] [ afu ] [ Functions ]

DATE

``` May 23rd 2019, Heidhausen
```

DESCRIPTION

``` Make an afu object. See https://michael-edwards.org/wp/?p=1227 for examples.
```

ARGUMENTS

``` Any keyword arguments that make-instance would accept i.e. slots such as
start-at, level, minimum...
```

RETURN VALUE

``` An afu object
```

EXAMPLE

```(make-afu :level 3 :minimum -3 :maximum 3 :exponent .3)

AFU: start-at: 0, level: 3, period: 113
minimum: -3, maximum: 3, num-unique: 32
unique: (-3.0 -2.908942 -2.8265874 -2.7273216 -2.6483202 -2.5553133
-2.4432077 -2.3418174 -2.2489507 -2.2196069 -2.1223445 -1.8698215
-1.7599787 -1.7449956 -1.6306628 -1.5945365 -1.4747927 -1.3338206
-1.1639004 -1.0286679 -0.86946154 -0.824985 -0.6775627 -0.5040059
-0.29480958 -0.12831879 0.3039422 0.7751665 0.98014116 1.5123172
2.3448153 3.0)
binlist: (1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0
0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0
1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1 0
1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1)
CIRCULAR-SCLIST: current 0
SCLIST: sclist-length: 408, bounds-alert: T, copy: T
this: NIL,
next: NIL
NAMED-OBJECT: id: NIL, tag: NIL,
data: (-2.1223445 -1.4747927 -2.5553133 -1.4747927 -0.6775627 -2.4432077
-2.1223445 -0.6775627 -1.8698215 -2.1223445 -1.4747927 -2.5553133
-1.4747927 -0.6775627 -2.4432077 -2.1223445 -0.6775627 -1.8698215
-2.1223445 -1.4747927 -2.5553133 -1.4747927 -0.6775627 -2.4432077
-2.1223445 -0.6775627 -1.8698215 -2.1223445 -1.4747927 -2.5553133
-1.4747927 -0.6775627 -2.4432077 -0.6775627 -1.1639004 -2.7273216
-1.1639004 -1.8698215 -2.8265874 -1.8698215 -2.4432077 -2.2196069
...
```

SYNOPSIS

```(defun make-afu (&rest keyargs &key &allow-other-keys)
```

## afu/scale [ Methods ]

[ Top ] [ afu ] [ Methods ]

DATE

``` May 23rd 2019, Heidhausen
```

DESCRIPTION

``` Scale the existing data list to be within new bounds. NB this does not check
the existing data list for its maximum and minimum values, rather it uses
the existing minimum and maximum slot values (which should be correct,
unless something went wrong).
```

ARGUMENTS

``` - the afu object
- the new desired minimum (number). Default = NIL = use the current minimum
slot.
```

OPTIONAL ARGUMENTS

``` - the new desired maximum (number). Default = NIL = use the current maximum
slot
```

RETURN VALUE

``` the new data list
```

SYNOPSIS

```(defmethod scale ((a afu) new-min &optional new-max ignore1 ignore2)
```

## circular-sclist/afu [ Classes ]

[ Top ] [ circular-sclist ] [ Classes ]

NAME

``` afu

File:             afu.lsp

Class Hierarchy:  named-object -> linked-named-object -> sclist ->
circular-sclist -> afu

Version:          1.1.0

Project:          slippery chicken (algorithmic composition)

Purpose:          AFU = Alternativ fuer Unentschiedener (a little play on
the rather silly German political party).  This translates
to Alternative for the Undecided. Building on the
circular-sclist and activity-levels class, it's meant as a
deterministic alternative to randomness.

Author:           Michael Edwards: m@michael-edwards.org

Creation date:    May 18th 2019