Author: | yac |
---|---|
Mode: | factor |
Date: | Sun, 24 Jul 2011 09:25:00 |
TUPLE: ctr e n ; : <ctr> ( -- ctr ) f 0 ctr boa ; : check ( ctr e -- ctr' ) over n>> zero? [ >>e 1 >>n ] [ over e>> = [ [ 1 + ] change-n ] [ [ 1 - ] change-n ] if ] if ; : majority ( seq -- e/f ) <ctr> [ check ] reduce e>> ;