Clean up benchmark.nbody using a smart combinator

db4
Slava Pestov 2009-01-11 15:37:05 -06:00
parent 82a7e28082
commit adc4245d8b
1 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors specialized-arrays.double fry kernel locals make math USING: accessors specialized-arrays.double fry kernel locals math
math.constants math.functions math.vectors prettyprint math.constants math.functions math.vectors prettyprint combinators.smart
sequences hints arrays ; sequences hints arrays ;
IN: benchmark.nbody IN: benchmark.nbody
@ -53,7 +53,7 @@ TUPLE: nbody-system { bodies array read-only } ;
offset-momentum drop ; inline offset-momentum drop ; inline
: <nbody-system> ( -- system ) : <nbody-system> ( -- system )
[ <sun> , <jupiter> , <saturn> , <uranus> , <neptune> , ] { } make nbody-system boa [ <sun> <jupiter> <saturn> <uranus> <neptune> ] output>array nbody-system boa
dup bodies>> init-bodies ; inline dup bodies>> init-bodies ; inline
:: each-pair ( bodies pair-quot: ( other-body body -- ) each-quot: ( body -- ) -- ) :: each-pair ( bodies pair-quot: ( other-body body -- ) each-quot: ( body -- ) -- )