fix project euler 151 and add a unit test

db4
Doug Coleman 2009-08-11 18:22:44 -05:00
parent c12d6fe543
commit eccc919c18
2 changed files with 8 additions and 6 deletions

View File

@ -0,0 +1,4 @@
USING: project-euler.151 tools.test ;
IN: project-euler.151.tests
[ 12138569781349/26138246400000 ] [ euler151 ] unit-test

View File

@ -39,11 +39,11 @@ SYMBOL: table
: (pick-sheet) ( seq i -- newseq )
[
<=> sgn
<=>
{
{ -1 [ ] }
{ 0 [ 1- ] }
{ 1 [ 1+ ] }
{ +lt+ [ ] }
{ +eq+ [ 1- ] }
{ +gt+ [ 1+ ] }
} case
] curry map-index ;
@ -71,8 +71,6 @@ DEFER: (euler151)
{ 1 1 1 1 } (euler151)
] with-scope ;
! TODO: doesn't work currently, problem in area of 'with map' in (euler151)
! [ euler151 ] 100 ave-time
! ? ms run time - 100 trials