Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Is it worth using Monads in Perl ? and what the Monads are ?

by Anonymous Monk
on Jun 11, 2007 at 23:07 UTC ( [id://620592]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Is it worth using Monads in Perl ? and what the Monads are ?
in thread Is it worth using Monads in Perl ? and what the Monads are ?

...all I can find online are citations and references...
What happens when you click on the PDF link in the light blue box in the upper left hand corner? What about this link instead?
  • Comment on Re^4: Is it worth using Monads in Perl ? and what the Monads are ?

Replies are listed 'Best First'.
Re^5: Is it worth using Monads in Perl ? and what the Monads are ?
by BrowserUk (Patriarch) on Jun 12, 2007 at 00:15 UTC

    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.
Re^5: Is it worth using Monads in Perl ? and what the Monads are ?
by Anonymous Monk on Jun 11, 2007 at 23:08 UTC
    Whoops, I meant to say "upper right hand corner". Sorry.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://620592]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-19 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found