randomforestwhitaker / questions

questions
0 stars 0 forks source link

boolean bad smell #4

Closed adampingel closed 6 years ago

adampingel commented 6 years ago

https://github.com/randomforestwhitaker/questions/blob/df5ab371251d6690faa24f280f5fd266d0a702c5/answer_1.scala#L15-L20

If you ever find yourself returning true or false, you're probably not phrasing the function as parsimoniously as you can. Simplify this expression.

randomforestwhitaker commented 6 years ago

simplified to x >= 0. was too eager to apply pattern matching to everything lol