The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Normen (35) [Avatar] Offline
#1
Follow up on http://www.manning-sandbox.com/message.jspa?messageID=143233#143233

v12, p.14
>Suppose we replace all occurrences of the term `x` with the expression referenced by `x`.

So we are checking if `x` is referentially transparent. As the values of `r1` and `r2` are the same as before, so `x` was referentially transparent.

v12, p.15
>Suppose we substitute the call to `append` like we did earlier, replacing all occurrences of `y` with the expression referenced by `y`.

"substitute the call to `append`" doesn't that mean to replace "append" by its definition/ value? This is confusing here.

Why don't you just phrase it like you did earlier:

>Suppose we replace all occurrences of the term `y` with the expression referenced by `y`.

So we are checking if `y` is referentially transparent. As the values of `r1` and `r2` are *not* the same as before, so `y` was *not* referentially transparent.
(What I want to state here, is up to here one does not need to mention purity wrt. `append`, we are just checking if `y` is RT and it is not. I think this is didactically better. Next we can go to examine the property of purity wrt. `append`).

And what's more, this function `append` on `StringBuilder`s is *not* pure: as we know that `x`, `", World"`, and `toString` are RT, but the program results in a different outcome, the only reason can be that `append` is *not a pure function*.


Thanks, /nm

Message was edited by:
normen.mueller

Typo correction.