Questions tagged [functional-programming]
For questions regarding functional programing concepts like immutability, closures, pure functions, and monads or regarding functional languages which enforce some or all of these constraints.
6 questions from the last 365 days
6
votes
0
answers
277
views
What challenges might still prevent compiler or JIT optimizations of common FP operations like map, filter, and reduce?
(While I'm referring to JS in my example, I don't intend to be constrained to JS: so any comments/answers concerning FP-style APIs for working with collections for any language are welcome and ...
3
votes
2
answers
343
views
Does a Rust implementation of the Monkey programming language require a garbage collector?
Awhile back I wrote a Rust implementation of the Monkey programming language by Thorsten Ball (https://monkeylang.org/). When I got done with it I was a bit surprised that I never used an Arc/Rc ...
8
votes
2
answers
433
views
Can total (primitive) corecursion be implemented?
I'm trying to understand how to implement corecursion in a total functional context. I've already implemented recursion using standard techniques (for loops) but I ...
7
votes
2
answers
592
views
When do functional programming languages need advanced garbage collection?
While thinking about garbage collection, I realized a simple fact that a garbage collector that is more than reference counting is needed because there are circular references, but there are ...
1
vote
2
answers
319
views
What is the mathematical abstraction of bitflags for use in a purely functional language?
A lot of C APIs like to have something called bit flags to signal the functions configuration options like Vulkan, OpenCL, SQLite and much more, it a typical pattern to it.
This common pattern of ...
9
votes
7
answers
2k
views
Is there a generic way to refer to the current function in recursion?
In writing recursive functions (functional style), I often need to refer to the current function (depending on the context).
e.g.
f 0 = 0
f (S n) = f n + 2
Are ...