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

17 lines
346 B
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: namespaces math partial-continuations tools.test
2009-11-10 17:48:06 -05:00
kernel sequences fry ;
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 [
2010-01-14 10:10:13 -05:00
'[ over + @ drop ] each-integer drop f
2009-04-17 15:44:08 -04:00
] bshift 2nip ; inline
2007-09-20 18:09:08 -04:00
{ 55 } [
0 sum set
2007-09-20 18:09:08 -04:00
[ 1 10 range sum get + sum set f ] breset drop
sum get
] unit-test