./../../src/activity-levels.lsp

## activity-levels/active [ Methods ]

[ Top ] [ activity-levels ] [ Methods ]

DESCRIPTION

     Returns t or nil depending on whether we're active at this point.  The
     object remembers where we were last time; this means if we change level
     before getting to the end of a ten-list, we'll pick up where we left off
     next time we return to that level.  <level> can be a floating point number:
     in this case it will be rounded. But <level> must be between 0 and 10,
     where 0 is always inactive, 10 is always active, and anything inbetween
     will use the data lists circularly.

ARGUMENTS

     - the activity-levels object

OPTIONAL ARGUMENTS

     - the activity-level number we want to test. Although optional, it's
       expected that this argument will usually be defined.  Default = 5.

RETURN VALUE

     T or NIL

EXAMPLE

    (let ((al (make-al)))
      (print (loop for i below 15 collect (active al 0)))
      (print (loop for i below 15 collect (active al 5)))
      (print (loop for i below 15 collect (active al 1)))
      (print (loop for i below 15 collect (active al 9)))
      (loop for i below 15 collect (active al 10)))

    =>
    (NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)
    (T T NIL NIL T NIL T T NIL NIL NIL T NIL T NIL)
    (T NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL T NIL)
    (T T NIL T T T T T T T T T T T NIL)
    (T T T T T T T T T T T T T T T)

SYNOPSIS

    (defmethod active ((al activity-levels) &optional level)

## activity-levels/make-al [ Functions ]

[ Top ] [ activity-levels ] [ Functions ]

DESCRIPTION

     Make an activities-level object for determining (deterministically) on a
     call-by-call basis whether a process is active or not (boolean).  This is
     determined by nine 10-element lists (actually three versions of each) of
     hand-coded 1s and 0s, each list representing an 'activity-level' (how
     active the process should be).  The first three 10-element lists have only
     one 1 in them, the rest being zeros.  The second three have two 1s,
     etc. Activity-levels of 0 and 10 would return never active and always
     active respectively.

ARGUMENTS

     None required.

OPTIONAL ARGUMENTS

     start-at (default NIL): which of the three 10-element lists to start with
     (reset to).  Should be 1, 2, or 3 though if NIL will default to 1.

RETURN VALUE

     The activities-level object.

SYNOPSIS

    (defun make-al (&optional start-at)

## activity-levels/reset [ Methods ]

[ Top ] [ activity-levels ] [ Methods ]

DESCRIPTION

     Reset the activity-levels object to restart at the first element of the 1st
     (or user-specificed) 10-element list.

ARGUMENTS

     The activity-levels object.

OPTIONAL ARGUMENTS

     start-at: should be between 0 and 2; it indicates which of the 10-lists
     we're going to start with.  Default = 1.

RETURN VALUE

     T

SYNOPSIS

    (defmethod reset ((al activity-levels) &optional (start-at 1) ignore)

## named-object/activity-levels [ Classes ]

[ Top ] [ named-object ] [ Classes ]

NAME

     activity-levels

     File:             activity-levels.lsp

     Class Hierarchy:  named-object -> activity-levels

     Version:          1.0.6

     Project:          slippery chicken (algorithmic composition)

     Purpose:          Class used in rthm-chain.  Used on a call-by-call basis
                       to determine (deterministically) whether a process is
                       active or not (boolean).

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

     Creation date:    4th February 2010

     $$ Last modified: 11:10:51 Wed Jul  1 2015 BST

     SVN ID: $Id: activity-levels.lsp 5468 2016-01-18 17:29:54Z medward2 $