-
-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Why not use string-based solution on Armstrong's number, Clojure track? #1942
Comments
@exercism/clojure |
Yeah this could come across as useful advice or utter snobbery depending on the situation. I personally remember being rather blown away the day that someone showed me you could split a number arithmetically, without entering the world of strings. This is often people's first encounter with Clojure, and the intention is to encourage them to think more functionally. As a mentor there is an implicit expectation to offer something of value, so it is useful to have some talking points, so I've used this one many times but only after approving the solution already so as not to block their progress. I sure hope that people are not being told that their string-based solution is wrong. It might be good to make this more clear in the mentoring note. I appreciate the feedback. |
The mentoring note says:
But compare this:
I can't look at this and say
num->digits
should be preferred in any way:->>
is probably more idiomatic in Clojure, but if that means writing more compliated code, does it worth it?str
and work on each individual pieces.str
is done - plustoString()
attempts to breakdown by100
(see getChars()) rather than10
- I'd say usingstr
rather than breaking the number down by10
manually is a performance gain.In fact I believe in the opposite - the conciseness of string-based approach in comparison to
->>
just proved string-based works better for this particular case.The text was updated successfully, but these errors were encountered: