Comment by Daniel Martin on Applicative permutation to generate knight moves
Perhaps; one could also argue though that the original solution brought in unnecessary monad machinery, and it's more elegant to avoid the implicit imperative ordering monadic style enforces. It's...
View ArticleComment by Daniel Martin on Checking whether a number is a power of 10
1 is a power of 10 though, since 10 to the power of 0 is 1. This function returns false for 1.
View ArticleComment by Daniel Martin on Picking from a list of individuals based on their...
Though what the other answer said about Random - you really should let the user pass in a Random inject if their own
View ArticleComment by Daniel Martin on Largest product in a grid: Project Euler 11
What's ambiguous about "It was at the point where I was making my own function just to do addition that I began to suspect I'd gone off the rails. There must be a better way." ? That, there, felt wrong.
View ArticleComment by Daniel Martin on Largest product in a grid: Project Euler 11
I don't think you want break s in mul_4_adj, but rather return 0 - imagine a 3x3 block in the corner with very large values but surrounded by zeros on all sides.
View ArticleComment by Daniel Martin on Rust language solution to old "Perl Quiz of the...
Well, your rewrite of reduce doesn't work at all, and I couldn't figure out how to write it with iterators; however, I did switch it to using Vec<char> the way scramble does. This actually slowed...
View ArticleAnswer by Daniel Martin for Safe stack operations with lens
I don't really see how lens will help you at all here, but you can certainly take advantage of monad transformers to handle part of your calculations, and make it so that you can layer you stack...
View ArticleAnswer by Daniel Martin for Largest product in a grid: Project Euler 11
I accepted the answer that gave me a bunch of good ideas; here's the final form I ended up with. I'm mostly happy with it, except for the use of the move keyword. I don't understand what that's doing...
View ArticleRust language solution to old "Perl Quiz of the Week" #21
I'm particularly concerned here that I'm copying more often than I need to, and that's slowing things down; obviously, given the algorithm/approach, I need to do some copying, but I don't want to be...
View Article