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.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^5: Is it worth using Monads in Perl ? and what the Monads are ? by BrowserUk
in thread Is it worth using Monads in Perl ? and what the Monads are ? by rootcho

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.