Skip to main content
15 events
when toggle format what by license comment
Dec 5, 2016 at 17:52 comment added Andres F. @Basilevs Instead of requesting things, why not write your own answer? :)
Dec 5, 2016 at 17:35 history edited Doc Brown CC BY-SA 3.0
added 43 characters in body
Dec 5, 2016 at 17:34 comment added Basilevs Yes, that's good. A bit like vector, though :(
Dec 5, 2016 at 17:32 comment added Basilevs I think, this means any non-monadic types are very underrepresented in FP and are non-trivial to deal with. Hence my request for non-monadic example.
Dec 5, 2016 at 17:28 comment added Doc Brown @Basilevs: here is one: docs.oracle.com/javase/tutorial/essential/concurrency/…. And it means we have to work on our Google foo. I am also pretty sure if one makes himself through SICP, the question clarifies itself, but I did not want to reference a full book in my answer ;-)
Dec 5, 2016 at 17:28 comment added Basilevs I was sure too and have not found one. Do you know what this may mean?
Dec 5, 2016 at 17:26 comment added Doc Brown @Basilevs: this is always straightforward - instead of mutating an object for a certain operation, let the operation internally make a shallow copy of the object, replace the attributes in that copy by the modified values, and return the new object. Unmodified collections will be just copied "by reference", and collections which need to be "modified" will be replaced by the new collection returned by the immutable equivalent operation. I am sure there are beginners examples for this approach all over the web in different programming languages, can't just find a good representative one.
Dec 5, 2016 at 16:58 comment added Basilevs I only see collections there, no complex non-uniform objects. Please clarify.
Dec 5, 2016 at 16:55 comment added Doc Brown @Basilevs: I did not want to dive too deep into implementation details, the Wikipedia article I linked to leads to lots of good resources and examples
Dec 5, 2016 at 16:53 history edited Doc Brown CC BY-SA 3.0
added 151 characters in body
Dec 5, 2016 at 16:37 history edited Doc Brown CC BY-SA 3.0
deleted 88 characters in body
Dec 5, 2016 at 14:36 comment added Basilevs A description of a procedure to create a modified copy of complex structure with named and typed fields would help better.
Dec 5, 2016 at 13:39 history edited Doc Brown CC BY-SA 3.0
added 93 characters in body
Dec 5, 2016 at 13:29 history edited Doc Brown CC BY-SA 3.0
added 187 characters in body
Dec 5, 2016 at 12:54 history answered Doc Brown CC BY-SA 3.0