Use constant stack effect to prevent compilation errors
parent
c06d328ea3
commit
b55f6d9114
|
@ -72,13 +72,13 @@ IN: project-euler.011
|
||||||
|
|
||||||
: pad-front ( matrix -- matrix )
|
: pad-front ( matrix -- matrix )
|
||||||
[
|
[
|
||||||
length [ 0 <repetition> ] each
|
length [ 0 <repetition> ] map
|
||||||
] keep [ append ] map ;
|
] keep [ append ] 2map ;
|
||||||
|
|
||||||
: pad-back ( matrix -- matrix )
|
: pad-back ( matrix -- matrix )
|
||||||
<reversed> [
|
<reversed> [
|
||||||
length [ 0 <repetition> ] each
|
length [ 0 <repetition> ] map
|
||||||
] keep [ <reversed> append ] map ;
|
] keep [ <reversed> append ] 2map ;
|
||||||
|
|
||||||
: diagonal/ ( -- matrix )
|
: diagonal/ ( -- matrix )
|
||||||
horizontal reverse pad-front pad-back flip ;
|
horizontal reverse pad-front pad-back flip ;
|
||||||
|
@ -98,9 +98,6 @@ PRIVATE>
|
||||||
[ call 4 max-product , ] each
|
[ call 4 max-product , ] each
|
||||||
] { } make supremum ;
|
] { } make supremum ;
|
||||||
|
|
||||||
! TODO: solution works but doesn't completely compile due to the creation of
|
|
||||||
! the diagonal matrices, there must be a cleaner way to generate those
|
|
||||||
|
|
||||||
! [ euler011 ] 100 ave-time
|
! [ euler011 ] 100 ave-time
|
||||||
! 4 ms run / 0 ms GC ave time - 100 trials
|
! 4 ms run / 0 ms GC ave time - 100 trials
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue