Internal Mutation of Persistent Data Structures
To clarify, when I mean use the terms persistent and immutable on a data structure, I mean that:
What’s the proper term for a function inverse to a constructor – to unwrap a value from a data type?
Edit: I’m rephrasing the question a bit. Apparently I caused some confusion because I didn’t realize that the term destructor is used in OOP for something quite different – it’s a function invoked when an object is being destroyed. In functional programming we (try to) avoid mutable state so there is no such equivalent to it. (I added the proper tag to the question.)
Guidelines for creating referentially transparent callables
In some cases, I want to use referentially transparent callables while coding in Python. My goals are to help with handling concurrency, memoization, unit testing, and verification of code correctness.
C++11 support for higher-order list functions
Most functional programming languages (e.g. Common Lisp, Scheme / Racket, Clojure, Haskell, Scala, Ocaml, SML) support some common higher-order functions on lists, such as map
, filter
, takeWhile
, dropWhile
, foldl
, foldr
(see e.g. Common Lisp, Scheme / Racket, Clojure side-by-side reference sheet, the Haskell, Scala, OCaml, and the SML documentation.)
What is the difference between functional relational programming and functional programming?
After reading both this thread and the linked paper, I don’t understand how FRP (functional relational programming) is different from (FP) functional programming.
Can higher-order functions in FP be interpreted as some kind of dependency injection?
According to this article, in object-oriented programming / design dependency injection involves
Does immutability entirely eliminate the need for locks in multi-processor programming?
Part 1 Clearly Immutability minimizes the need for locks in multi-processor programming, but does it eliminate that need, or are there instances where immutability alone is not enough? It seems to me that you can only defer processing and encapsulate state so long before most programs have to actually DO something (update a data store, […]
design a model for a system of dependent variables
I’m dealing with a modeling system (financial) that has dozens of variables. Some of the variables are independent, and function as inputs to the system; most of them are calculated from other variables (independent and calculated) in the system.
Functional Methods on Collections
I’m learning Scala and am a little bewildered by all the methods (higher-order functions) available on the collections. Which ones produce more results than the original collection, which ones produce less, and which are most appropriate for a given problem? Though I’m studying Scala, I think this would pertain to most modern functional languages (Clojure, Haskell) and also to Java 8 which introduces these methods on Java collections.
Using foldr to append two lists together (Haskell)
I have been given the following question as part of a college assignment. Due to the module being very short, we are using only a subset of Haskell, without any of the syntactic sugar or idiomatic shortcuts….I must write: