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

Close enough?

  case X of
    {Cat, N} when Cat == expense; Cat == invoice; Cat == loss  -> Total - N;
    {credit, N}  -> Total + N
  end



patrec said that

> you can sometimes ameliorate it with guards

which is exactly what you did, so I don't think you're disagreeing here :)




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

Search: