factor/extra/partial-continuations/partial-continuations-tests...

17 lines
344 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: namespaces math partial-continuations tools.test
kernel sequences ;
2008-03-01 17:00:45 -05:00
IN: partial-continuations.tests
2007-09-20 18:09:08 -04:00
SYMBOL: sum
: range ( r from to -- n )
over - 1 + rot [
-rot [ over + pick call drop ] each 2drop f
] bshift 2nip ;
[ 55 ] [
0 sum set
[ 1 10 range sum get + sum set f ] breset drop
sum get
] unit-test