Closed bobahop closed 1 year ago
@ErikSchierboom: a small but idiomatic enhancement to the recursive explanation for Scala Hamming is ready for review.
As you're saying this is more idiomatic, should this improved version be the version we show in the introduction/snippet/top of the approach?
Yes, I think you're right. Let me get rid of the substring stuff altogether...
@ErikSchierboom: Edits made for Hamming. Ready for review and hopefully merge. Still waiting on one other exercise to churn through Scala / Test / ci...
Added the following text to the match and recursion approach:
A more idiomatic way to do the same thing as the
substring()
method calls is to use thehead()
andtail()
methods. Thehead()
method returns the firstChar
in theString
, and thetail()
method returns all of theChar
s after the firstChar
, like so: