O'Reilly logo
  • Jason Pollard thinks this is interesting:

Exercise 2.21 Using let, we can eliminate the expensive squaring operation in our integer square root function. Code a variant of introot that maps n to its integer square root k, paired with the difference nk2. Only simple multiplications and divisions are needed; an optimizing compiler could replace them by bit operations.


Cover of ML for the Working Programmer, Second Edition


I've checked the answer to this online but I can't understand how the code works in a breakdown