Use constant stack effect to prevent compilation errors
parent
c06d328ea3
commit
b55f6d9114
|
@ -72,13 +72,13 @@ IN: project-euler.011
|
|||
|
||||
: pad-front ( matrix -- matrix )
|
||||
[
|
||||
length [ 0 <repetition> ] each
|
||||
] keep [ append ] map ;
|
||||
length [ 0 <repetition> ] map
|
||||
] keep [ append ] 2map ;
|
||||
|
||||
: pad-back ( matrix -- matrix )
|
||||
<reversed> [
|
||||
length [ 0 <repetition> ] each
|
||||
] keep [ <reversed> append ] map ;
|
||||
length [ 0 <repetition> ] map
|
||||
] keep [ <reversed> append ] 2map ;
|
||||
|
||||
: diagonal/ ( -- matrix )
|
||||
horizontal reverse pad-front pad-back flip ;
|
||||
|
@ -98,9 +98,6 @@ PRIVATE>
|
|||
[ call 4 max-product , ] each
|
||||
] { } 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
|
||||
! 4 ms run / 0 ms GC ave time - 100 trials
|
||||
|
||||
|
|
Loading…
Reference in New Issue