project-euler: [ + ] 2map -> v+

db4
Björn Lindqvist 2014-11-18 03:12:41 +01:00 committed by John Benediktsson
parent 61ba941740
commit 8b09038e2f
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
USING: fry kernel math math.primes.factors sequences sets project-euler.common ;
USING: fry kernel math math.primes.factors math.vectors sequences sets
project-euler.common ;
IN: project-euler.203
! http://projecteuler.net/index.php?section=problems&id=203
@ -42,7 +43,7 @@ IN: project-euler.203
swapd '[ @ dup ] replicate nip ; inline
: (generate) ( seq -- seq )
[ 0 prefix ] [ 0 suffix ] bi [ + ] 2map ;
[ 0 prefix ] [ 0 suffix ] bi v+ ;
: generate ( n -- seq )
1 - { 1 } [ (generate) ] iterate combine ;

View File

@ -4,8 +4,8 @@
USING: accessors arrays byte-arrays fry hints kernel lists make math
math.functions math.matrices math.order math.parser math.primes.factors
math.primes.lists math.primes.miller-rabin math.ranges math.ratios
namespaces parser prettyprint quotations sequences sorting strings
unicode.case vocabs vocabs.parser words ;
math.vectors namespaces parser prettyprint quotations sequences sorting
strings unicode.case vocabs vocabs.parser words ;
FROM: sequences => change-nth ;
IN: project-euler.common
@ -74,7 +74,7 @@ PRIVATE>
: max-path ( triangle -- n )
dup length 1 > [
2 cut* first2 max-children [ + ] 2map suffix max-path
2 cut* first2 max-children v+ suffix max-path
] [
first first
] if ;