Follow up to the July 2011 Event

First of a big thanks (literally, heh) I hope you enjoyed the first meeting of our little group.  Very happy to see so many interested in FP, and glad to see the turnout for the “post-meeting” at the Kings Head.

Video

Links

Some of the links I mentioned in my talk:

Followup for Pure Functions w.r.t. Setters/Getters

I did some further digging, posting a question on Stack Exchange about Setters/Getters in Functional Programming.  Daniel Sobral (very learned in the Scala community) answered with what Amir had brought up, you essentially get a new copy of the object on which you invoked the setter. The new object has the modified property value.  Further to that, he pointed out the “copy” method of Case classes in Scala.  Essentially you can use it like this:

val modEmployee = origEmployee.copy(salary = 50000)

Now modEmployee contains a copy of origEmployee with the modified salary property.  Referential transparency of the getter for the salary property is maintained because the origEmployee’s salary remains the same and anyone with a reference to it doesn’t see the change at all.

IRC

I’ve setup an IRC chan for us to hang out on and chat, it’s up on Freenode at #wfpg.




3 thoughts on “Follow up to the July 2011 Event

  1. I think I understand now that referential transparency doesn’t mean the thing can’t modify the database, because database is not part of the program, so there are no side effect within the program.

  2. Pingback: The Basement Coders Developer Podcast » Introduction to Functional Programming

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>