Hacker News new | past | comments | ask | show | jobs | submit login

Pattern matching is awesome and we should make use of it whenever appropriate, but not every situation is appropriate. For instance, if your formatted_hour functions were larger, or shared some amount of code between them, then cond might be a great option instead. Or case, or even the dreaded if statement. As a community, sometimes we overuse our cool special features just because we have them! Personally, I like the case statement as a middle ground for lots of scenarios. You still get pattern matching and it's pretty readable.



If the formatted_hour functions were larger or shared some amount of code, I wouldn't have suggested it ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: