Re: `let*' and functional design

Bruce Hoult <bruce@xxxxxxxxx> writes:

> I really hate the CL/Scheme "let" because I like to give meaningful
> names to lots of intermediate values

I try to avoid giving names to intermediate values. I'll make an
intermediate variable only if

1. The value is used in more than one place.

2. The intermediate value is `important enough' to deserve a name.

3. Using the value producing form `in-place' clutters the code.

> I also use let* as the contents of many or most bodies in imperative
> code. But it's very easy to tell the difference -- in imperative code
> the expression bound to some of the names is a progn (begin in Scheme)
> containing all the side-effecting code that needs to be executed between
> the previous binding (and presumably using it) and this one.
> e.g.
> (let* ((name (begin (printf "What is your name?: ")
> (read)))
> (age (begin (printf "Hi, ~a, how old are you?: " name)
> (read))))
> (printf "Thanks for the information~n")
> age)

For this, I'd write a prompting-read subroutine.