[back] [prev] [next] [index] [root]

 


MultiCounterInc

Increments a multi counter subject to a bound.

Syntax:

b := MultiCounterInc(L, n);

boolean
  b  
list
  L  
integer | list
  n  

See also:  MultiCounterInit

Description:

Increments a multi counter L. Incrementation is done if L[i] < n for some i, if n is an integer or L[i] < n[i] for some i, if n is a list. In case the counter was incremented, "true" is returned. Otherwise "false" is returned.


Example:

A counter with 2 items:

kash> L := MultiCounterInit(2);;
kash> while MultiCounterInc(L, 2) do
> Print(L, " ");
> od; Print("\n");[ 0, 0 ] [ 1, 0 ] [ 2, 0 ] [ 0, 1 ] [ 1, 1 ] [ 2, 1 ] [ 0, 2 ] [ 1, 2 ] 
[ 2, 2 ] > 


<- back[back] [prev] [next] [index] [root]