project-euler.150: use cum-sum.

db4
John Benediktsson 2015-07-14 20:55:43 -07:00
parent 6bb65fcfd3
commit a98bbb672a
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
USING: hints kernel locals math math.order math.ranges project-euler.common
sequences sequences.private ;
USING: kernel locals math math.order math.ranges math.statistics
project-euler.common sequences sequences.private ;
IN: project-euler.150
! http://projecteuler.net/index.php?section=problems&id=150
@ -34,7 +34,7 @@ IN: project-euler.150
! sequence helper functions
: partial-sums ( seq -- sums )
0 [ + ] accumulate swap suffix ; inline
cum-sum 0 prefix ; inline
: partial-sum-infimum ( seq quot -- seq )
[ 0 0 ] 2dip [ + [ min ] keep ] compose each drop ; inline