2 ms·
That's a correct change--I chose the implementation that I did so that it was very obvious how the things remap to a "functional" approach. :) You see the poin
by angersock 12y ago
That's a correct change--I chose the implementation that I did so that it was very obvious how the things remap to a "functional" approach. :)
You see the point I'm driving at, though?
(and thanks for prodding me into writing code to illustrate things better)
- jacquesm 12y ago> You see the point I'm driving at, though? Yes, absolutely. I thought you were right on the money with the words but I figured a bit of code would do wonders to hammer it down. Erlang does an even better job I think: [X * X || X <- lists:seq(1,10), X * X > 10, X * X < 100]. Or: [Y || Y <- [X * X || X <- lists:seq(1,10)], Y > 10, Y < 100]. Slightly longer, but without that X * X repetition.
- angersock 12y agoYep. Erlang/Elixir is actually kind of a joy to work in for math stuff. Shoot me an email if you'd like to chat about that.
- jacquesm 12y agoI'm slowly slogging my way through Project Euler in Erlang, it's my default way of learning anything new and so far I've been making progress but I'm pretty sure that what I'm writing is absolutely horrible non-idiomatic erlang. I will probably take you up on that but after I've learned a bit more so at least I stand half a chance of understanding you.