[ prog / sol / mona ]

prog


Internal definitions vs letrec

6 2020-08-02 12:33

>>5
I think there are good justifications for internal definitions, it's probably the reason that SICP uses them. For example they always create less indentation, text, and parenthesis. They also allow you to more easily test your internal abstractions at the top-level and generalize these abstractions if they turn out to be generally applicable. I find it very helpful to when defining a procedure to actually start with wishful thinking and define the necessary helper functions at the top-level and then to test incrementally as I'm writing these stand alone components. Only after having something that works do I consider moving these helper procedures into the primary procedure's body. One downside they you all probably remember form SICP is it is not specified in which order internal definitions will be bound.

13


VIP:

do not edit these