Paste: silly benchmark

Author: slava
Mode: factor
Date: Fri, 22 May 2009 23:08:22
Plain Text |
USING: arrays command-line kernel math math.parser
namespaces sequences values prettyprint ;
IN: meaningless-benchmark

VALUE: counter

0 to: counter

TUPLE: node children ;

: counter++ ( -- ) counter 1 + to: counter ;

: <node> ( children -- node ) counter++ node boa ;

: make-tree ( depth -- tree )
    dup 1 >
    [ 1 - [ make-tree ] [ make-tree ] bi 2array <node> ]
    [ drop f <node> ]
    if ;

: parameter ( -- n ) command-line get first string>number ;

parameter make-tree drop counter .

New Annotation

Summary:
Author:
Mode:
Body: