Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's just:

    (let [[quotient remainder] (floor x y)]
      (+ (* quotient z)
         (* remainder (first (floor z y)))))
Because in Clojure there's no multiple value bind, when you want to return many results from a function, you wrap it in a vector, and that means you than just destructure that vector. That also means, it's not smart enough to know if it's used in a single value context or multi value context, so you need to always get the value out of the vector, which is why I call first in that second call to floor.


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

Search: