I would like to mention http://exercism.io . It has unit tests written also
Yes, I've used exercism to broaden my knowledge and I've recommended the site to friends and colleagues who wanted to learn programming. You mentioned tests: on exercism you don't write unit tests by yourself, the tests are only for you to check your solution. It certainly helps to see how tests can be written in any language, but you aren't forced into a strict TDD style. The best feature on exercism for me is to be…
Practicing Elixir or any programming language
41–50 of 59 posts
Re: Practicing Elixir or any programming language
#42Great article, thanks! I'm not an expert Alchemist by any means, but whenever I see a `cond`, I try to see if it can be refactored out using pattern matching (after I was picked up on the same thing during an interview!) defp formatted_hour("AM", "12"), do: "00" defp formatted_hour("AM", hours), do: hours defp formatted_hour("PM", "12"), do: "12" defp formatted_hour("PM", hours), do: 12 + String.to_integer(hours)
Re: Practicing Elixir or any programming language
#43> Why algorithms? > Because this kind of problem is an interesting way to put yourself searching all the API of the language in order to solve the challenge in the more elegant/concise way you currently can. Bullcrap. APIs are either going to be irrelevant for solving an algorithm, or will simply do the job for you. "Implementing an algorithm" usually means writing it from scratch using simple data structures, primit…
It's important to be able to look at a problem and think "i bet I could find a function in the standard library that could help me solve this problem" or "I should just solve this from scratch with the basic functions I know, like map/filter/reduce/etc. So I disagree somewhat here.
Re: Practicing Elixir or any programming language
#44Great article, thanks! I'm not an expert Alchemist by any means, but whenever I see a `cond`, I try to see if it can be refactored out using pattern matching (after I was picked up on the same thing during an interview!) defp formatted_hour("AM", "12"), do: "00" defp formatted_hour("AM", hours), do: hours defp formatted_hour("PM", "12"), do: "12" defp formatted_hour("PM", hours), do: 12 + String.to_integer(hours)
defp formatted_hour("AM", hours), do: rem(hours, 12)
defp formatted_hour("PM", hours), do: 12 + formatted_hour("AM", hours)Re: Practicing Elixir or any programming language
#45Re: Practicing Elixir or any programming language
#46Where I'd want to stretch it is some data structure and algorithm exercises, maybe even some design patterns. I'd love to be able to have a common environment where I can start to learn any one of multiple languages using similar exercises.
Re: Practicing Elixir or any programming language
#47So his approach is to go through hackerrank exercises to learn the language. Anyone familiar with hackerrank able to comment on that vs say project Euler?
I would say that Hacker Rank helps with learning syntax of a language. I'm not sure if it helps greatly with learning how to implement framework type ideas or large programs. Hacker Rank is best at teaching algorithms & problem solving. I did a couple the other day & at first I thought they looked difficult. After breaking them down & thinking about them, they surprisingly weren't all that hard.
Re: Practicing Elixir or any programming language
#48Great article, thanks! I'm not an expert Alchemist by any means, but whenever I see a `cond`, I try to see if it can be refactored out using pattern matching (after I was picked up on the same thing during an interview!) defp formatted_hour("AM", "12"), do: "00" defp formatted_hour("AM", hours), do: hours defp formatted_hour("PM", "12"), do: "12" defp formatted_hour("PM", hours), do: 12 + String.to_integer(hours)
def convert(> ":"
> ":"
> >) do
"#{formatted_hour(h,period)}:#{m}:#{s}"
end
defp formatted_hour(hours,"PM"), do: "#{String.to_integer(hours) + 12}"
defp formatted_hour("12","AM"), do: "00"
defp formatted_hour(hours, "AM"), do: hoursRe: Practicing Elixir or any programming language
#49Semi-OT, but I really want to steal whatever slick CSS you used to get that full page load then slam-in sidebar.
Re: Practicing Elixir or any programming language
#50Great article, thanks! I'm not an expert Alchemist by any means, but whenever I see a `cond`, I try to see if it can be refactored out using pattern matching (after I was picked up on the same thing during an interview!) defp formatted_hour("AM", "12"), do: "00" defp formatted_hour("AM", hours), do: hours defp formatted_hour("PM", "12"), do: "12" defp formatted_hour("PM", hours), do: 12 + String.to_integer(hours)
I personally like recursive pattern matching defp formatted_hour("AM", hours), do: rem(hours, 12) defp formatted_hour("PM", hours), do: 12 + formatted_hour("AM", hours)