1 ! Copyright (c) 2007 Aaron Schaefer
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays combinators io kernel math math.functions math.parser
4 math.statistics namespaces sequences tools.time ;
5 IN: project-euler.ave-time
7 : collect-benchmarks ( quot n -- seq )
9 >r >r datastack r> [ benchmark , ] curry tuck
10 [ with-datastack drop ] 2curry r> swap times call
13 : ave-time ( quot n -- )
14 [ collect-benchmarks ] keep swap mean round [
15 # " ms run time - " % # " trials" %
16 ] "" make print flush ; inline