Okay. I missed that. Small text and rapidly diminishing eyesight (it's late here).
At a cursory glance, it's still smoke and mirrors :) Take the streams example. It fetches a list of filenames from the keyboard and then displays them.
It then explains that referential transparency is maintained, even if the same filename is supplied twice and some other program changes that file between the two reads--giving different output from the file_display function for the same input--because:
...there is no lexical connection between a request and a response. Thus, although two differemt read requests of the same file are equivalent values, their effect will depend upon their position in the list, they could each invoke a different response, reflecting the fact that the file may have been modified between the two reads.
Hand transcribed because c&p from the pdf produces garbage! I hate pdfs.
So, by that definition of referrential transparency, if I have a function f, which takes a list of numbers and returns a list of numbers having doubled them. And I supply a list [2,2,2,2,2] and it returns [-1, 217,'fred',12345678901234567890, null], that's legit, referential transparency wise, because although the inputs are all the same value, they also have position. And the input to the function was a list and the output was a list. And provided that if I pass in another list containing the same values, I get the same output list everything is okay.
But...if I supply the same list of two identical filenames to file_display a second time, I would get different output from the first time! Because the file remains changed from the first time it was read. (And could have changed again.) So, same input list, same positions, produces different output.
Smoke and mirrors!
Further discussion should probably be off-post. (Email on my home node if your a different anonymonk to the other anonymonk :)
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
Whoops, I meant to say "upper right hand corner". Sorry. | [reply] |