Comment

Comment by midgetjones

Great 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)
parent midgetjones 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton