Functional programming is a paradigm which attempts to solve computational problems by the chained evaluation of functions whose output is determined by their inputs rather than the programme state. In this style of programming, side effects and mutable data are deprecated and usually strictly ...
-3
votes
0answers
30 views
Applied Lambda Calculus Eager Evaluation Strategy [closed]
I have an exam tomorrow and I cant get my head around Lambda Calculus.
In the sample exam paper I have there is this question
(λn,λarg1.λarg2.λarg3.λarg4.λarg5.λarg6.if (>= n (- λarg3 1)) (arg1 ...
-1
votes
0answers
59 views
Implementing a term rewriting system in a procedural language [on hold]
How can I implement a term rewriting system in a procedural language like C? More precisely, I want to implement a system where, for example, a user can input the following rules:
add .a 0 = a
add .a ...
0
votes
1answer
129 views
What kind of reputation does Java 8 have among “enterprise” companies? [closed]
Are the new, functionally-inspired features of Java 8 well-regarded within the enterprise development community? Have they been adopted by large companies? Have coding standards been updated to ...
14
votes
9answers
2k views
What would be good factual arguments to convince high level management to consider functional programming? [closed]
There are tons of "theoretical" arguments for why functional programming is a Good idea (too many for that to have stayed as an open question, and correctly so).
However, most of them are arguments ...
2
votes
3answers
177 views
Declaring lambdas in Java8
What would be the best practice to declare lambdas in Java8 code? How it was designed to be used?
For example, let's say that we have a method that accept a Function. I want to provide function ...
18
votes
1answer
1k views
Confusion between F# and C# [duplicate]
I am fairly new to functional programming and C#/F#.
What is unclear to me is: Can you do functional programming in C# and/or in F#?
Or is it something like, you write some OO code in C#, and some FP ...
2
votes
2answers
310 views
Should we refactor our existing codebase to use functional programming, especially streams? [closed]
We have a large project written in PHP. It almost exclusively uses imperative operations, as in example 1. Should we refactor our existing code to use functional operations? Do you think that the code ...
3
votes
1answer
147 views
Functional programming for loop side effect
I am trying to get my head around as to why having a local variable or a for loop inside a function is not considered to be pure functional programming.
Given this function:
int as_int(char *str)
{
...
1
vote
4answers
270 views
Is it possible to use functional paradigm in imperative languages?
If I understand the concept correctly the goal, which functional languages are trying to achieve is to eliminate any side effects from functions and to eliminate a state. The rationale behind this is ...
-1
votes
1answer
67 views
New DDD, context-oriented, functional… approach in building business layer [closed]
We are building some business modules that must be intuitive for developers to use, so the code itself explains and forces developers to use it in certain way. This applies both for enhancing the ...
12
votes
1answer
347 views
What is Banana split and fusion in functional programming?
These terms got mentioned in my university course. Quick googling pointed me to some university papers, but I am looking for a simple explanation.
2
votes
1answer
162 views
In what way are union types better for correctness than a common interface?
I've just recently started familiarising myself with functional programming, mostly via F#, and there's one particular functional idiom that I'm not fully understanding the benefits of. I've seen it ...
0
votes
1answer
135 views
Programming CPU Emulator Functional Style [closed]
I want to write an 8086 CPU emulator in javascript, functional style.
How would one conceptualise / design an 8086 emulator, or any CPU emulator that has registers and realmode memory access in a ...
9
votes
5answers
560 views
Why do functional programs have a correlation between compilation success and correctness?
I've been trending toward functional programming for 4 years now, ever since I first started working with LINQ. Recently, I wrote some pure functional C# code and I noticed, first hand, what I've ...
1
vote
3answers
123 views
What do I use for a variant in a UML class diagram?
Does standard UML specify how a variant (aka tagged union, discriminated union, sum type, etc) should be depicted in a class diagram?
2
votes
1answer
182 views
Is the application architecture of Facebook Flux a new idea?
Facebook announced that it's using the architecture they call Flux to develop their projects.
It consists of a single direction dataflow, and concepts like a Dispatcher, Stores and Actions (well ...
0
votes
3answers
177 views
Reference counting & GC in LISP [closed]
What is the main method for reclaiming the memory in LISP? Does LISP really need garbage collection? Would not reference counts suffice?
I just wanted to know whether reference counts are enough ...
0
votes
1answer
129 views
How to Understand the concept of Immutablity in Functional Programming [duplicate]
I have come across several sources that say that immutability is a concept that is followed in functional programming. I have come across this concept when looking at collections in Scala where a new ...
3
votes
0answers
156 views
Lightweight data modeling vs traditional classes [closed]
I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding ...
1
vote
1answer
150 views
What was the influence of Chris Okasaki's data structures on Scala? [closed]
I heard a friend say:
The first real use of Chris Okasaki's book was in Clojure's data structures
I heard another friend say:
No, they influenced the design of Scala in quite a subtle way.
...
3
votes
6answers
773 views
How can IO cause side effects in Functional Programming? [duplicate]
Whenever I read about Haskell, I find that IO can cause side effects.
But I do not understand how it would do it?
Do we mean that we are writing to a file from one lazy sequence and another lazy ...
11
votes
5answers
2k views
Why is reading from memory not a side-effect but reading from a file is?
What does exactly make reading from the process memory a pure operation? Suppose I created an array of 100 integers in the global memory and then took the 42th element of this array. It is not a side ...
1
vote
3answers
218 views
Help me to understand 'stateless' software in functional programming
I'm an experienced software engineer, and have experience in a range of languages from PHP, Ruby, C#, Java - the last few years I've primarily worked in Java.
I'm now learning Scala, and it's my ...
4
votes
2answers
273 views
Alternative to language purity
Purity
One of the interesting concepts in Haskell is the purity. However, I am wondering what the pragmatic reasons behind this is - let me explain a bit more before you reject my question.
My main ...
1
vote
0answers
93 views
What makes the functional and logic programming paradigms well suited for programming AI? [duplicate]
I have been researching different programming paradigms. I have found a lot of people saying that one of the areas where logic and functional programming are particularly good is programming AI, but I ...
3
votes
1answer
231 views
How to avoid global state without large function signatures?
So, there are some good answers to this question, namely:
Why is Global State so Evil?
I have a specific question about the alternatives Mikera proposed as the answer with the second most up-votes. ...
0
votes
2answers
165 views
Is this instance of mixing FP and OOP a good design?
I had a strange-feeling pattern come up in some code I was writing. In a project with user accounts, there was a lot of code that needed to do common things such as creating accounts, deleting them, ...
3
votes
1answer
124 views
How do I avoid duplicating utility functions across modules?
I've seen this question but it doesn't help me because I'm writing functional code (Standard ML) and the answers there are heavily focused towards OOP (the OP is advised to use the Facade pattern, to ...
8
votes
2answers
430 views
Applying the principles of Clean Code to functional languages
I'm currently reading Robert Martin's Clean Code. I think it's great, and when writing OO code I'm taking his lessons to heart. In particular, I think his advice to use small functions with meaningful ...
22
votes
3answers
2k views
What is referential transparency?
I have seen that in imperative paradigms
f(x)+f(x)
might not be the same as:
2*f(x)
But in a functional paradigm it should be the same. I have tried to implement both cases in Python and Scheme, ...
1
vote
1answer
502 views
Composing programs from small simple pieces: OOP vs Functional Programming [closed]
I started programming when imperative programming languages such as C were virtually the only game in town for paid gigs. I'm not a computer scientist by training so I was only exposed to Assembler ...
0
votes
2answers
70 views
Map multiple functions over a single data item [closed]
I'm in the process of learning Scala and I came across a scenario today where I need to map multiple functions over a single piece of data and wondered if there was a formal name for this. It sort of ...
2
votes
1answer
82 views
Expected time for lazy evaluation with nested functions?
A colleague and I are doing a free R course, although I believe this is a more general lazy evaluation issue, and have found a scenario that we have discussed briefly and I'd like to find out the ...
1
vote
1answer
88 views
What is the value of a let expression
From what I understand, every code in f# is an expression, including let binding.
Say we got the following code:
let a = 5
printfn "%d" a
I've read that this would be seen by the compiler as
let a ...
1
vote
2answers
107 views
How can I make sense of the word “Functor” from a semantic standpoint? [closed]
When facing new programming jargon words, I first try to reason about them from an semantic and etymological standpoint when possible (that is, when they aren't obscure acronyms). For instance, you ...
3
votes
1answer
260 views
Have enterprises adopted pure FP to create desktop user interfaces? Examples? [closed]
I see some evidence (F#) online that functional programming is penetrating enterprise.
Where I work we primarily develop VB.NET WinForms applications. The .NET infrastructure for developing ...
1
vote
1answer
166 views
Is Lambda Still Supported In Python?
Only one or two years ago, I remember reading Python constructs that would be removed from Python -- reduce was one of them -- and other constructs that would be emphasized like comprehensions and ...
4
votes
1answer
180 views
How should I recursively process a file in Haskell?
Basically I'm expanding a literate program in Haskell. There are two things I need to look for to expand. Here's an example file:
program.c.lit:
==============
Some comments in the source file that I ...
2
votes
4answers
1k views
Why would the switch from C# to scala make sense in order to take advantage of scala's functional capabilities? [closed]
What is the benefit of using functional program for large scale software projects? I have heard it is pretty performance equivalent to regular OOP. I also have heard that it is more "mathematically ...
2
votes
1answer
185 views
Difference between Yesod and Ocsigen web frameworks [closed]
I have been looking at web-frameworks in functional languages and eventually found Yesod and Ocsigen interesting. As far as I understand, they leverage the type system to statically prevent basic ...
5
votes
0answers
187 views
How to represent hard-to-calculate “properties” of “objects” in functional code?
I have a polyline "class" in my Clojure program, which is represented by a vector of points. (It's not really a class or anything.)
The polyline's length (in the geometric sense) is something that is ...
0
votes
1answer
342 views
When does a Monad become a hammer?
I realize my precursory understanding on Monads is severely lacking in detail considering my knowledge comes mostly from Douglas Crockford's Monads and Gonads talk and complicated with my sevear ...
3
votes
3answers
509 views
Why not apply Interface Segregation Principle to “extreme”
Providing that clients would typically consume just one method, though methods would be conceptually related, why not always apply the Interface Segregation Principle to the extreme and have [many] ...
30
votes
5answers
3k views
Why do some functional programming languages use a space for function application?
Having looked at some languages for functional programming, I always wondered why some fp-languages use one or more whitespace characters for function application (and definition), whereas most (all?) ...
2
votes
2answers
344 views
extensible effects in purescript
In Purescript, IO an other effects are managed with the Eff monad, and extensible effects, which are declared like this:
main :: Eff (trace :: Trace, random :: Random) {}
So if I understand well, ...
4
votes
3answers
537 views
Functional programming strategies in imperative languages
I've been convinced for awhile now that some strategies in functional programming are better suited to a number of computations (i.e immutability of data structures). However, due to the popularity of ...
12
votes
8answers
1k views
Mental Models or Real-World-Metaphors for Functional Programming
Does anyone have a good mental model or metaphor for functional programming which references something in the real world?
Object Oriented programing intuitively makes sense to me. There are things ...
2
votes
1answer
480 views
Why are most functional programming languages also interpreted languages?
Functional/non-functional and interpreted/compiled are two different categorizations, yet it seems that there are a lot of overlaps in the programming languages that fall under those categories. Is ...
6
votes
4answers
303 views
Dealing with state problems in functional programming
I've learned how to program primarily from an OOP standpoint (like most of us, I'm sure), but I've spent a lot of time trying to learn how to solve problems the functional way. I have a good grasp on ...
1
vote
1answer
192 views
Object-Oriented equivalent of LISP's progn function?
I'm currently writing a LISP parser that iterates through some AutoLISP code and does its best to make it a little easier to read (changing prefix notation to infix notation, changing setq assignments ...