January 2019
Intermediate to advanced
376 pages
8h 49m
English
Modeling essentially requires you to write an indirect and very simple implementation of your code—often an algorithmically inefficient one—and pit it against the real implementation. The model should be so simple that it is obviously correct. You can then optimize the real system as much as you want: as long as both implementations behave the same way, there’s a good chance that the complex one is as good as the obviously correct one, but faster. So for code that does a conceptually simple thing, modeling is useful.
Let’s revisit the biggest/1 function from last chapter and put it in its own module:
About the Code | |
|---|---|
|
|
In the snippets that ... |