Functional programming is a programming paradigm which primarily uses functions as means for building abstractions and expressing computations that comprise a computer program.
7
votes
1answer
78 views
The “CPS” approach has done great harm to performance in SML/NJ; reasoning desired
In a comment to Learning F#: What books using other programming languages can be translated to F# to learn functional concepts? Makarius stated:
Note that the "CPS" approach has done great harm to ...
3
votes
1answer
30 views
ML - Type Interface
From my recitation class -
Can you please explain
why does operator $"+"$ signature is $ int \rightarrow (int \rightarrow int)$ ?
How does this graph is build ?
And what is mean $t=u ...
5
votes
3answers
117 views
How does 'deforestation' remove 'trees' from a program?
I think understand how deforestation consumes and produces a list at the same time (from a fold and an unfold function -- see this good answer on CodeReview here), but when I compared that with the ...
7
votes
3answers
179 views
Why do we use persistent data structures in functional programming?
Functional programming employs persistent data structures and immutable objects. My question is why is it crucial to have such data structures here? I want to understand at a low level what would ...
2
votes
1answer
25 views
How is the following ML Curry expression evaluated
This question is not homework but it's related to material in a general course I take about programming languages, so I don't know whats the site policy about this
In ML the following expression:
...
10
votes
2answers
210 views
What is meant by Category theory doesn't yet know how to deal with higher-order functions?
In reading Uday Reddy's answer to What is the relation between functors in SML and Category theory? Uday states
Category theory doesn't yet know how to deal with higher-order
functions. Some ...
8
votes
3answers
133 views
What is the relation between functors in SML and Category theory?
Along the same thinking as this statement by Andrej Bauer in this answer
The Haskell community has developed a number of techniques inspired by
category theory, of which monads are best known ...
6
votes
3answers
128 views
anonymous lambda functions (functional programming)
What are anonymous (lambda) functions? What is the formal definition of an anonymous function in a functional programming language?
In my simple terms, when I am programming in scheme/lisp I would ...
4
votes
3answers
111 views
How can SML infer types like this?
Wikipedia says:
fun factorial n =
if n = 0 then 1 else n * factorial (n-1)
A Standard ML compiler is required to infer the static type int -> int of ...
1
vote
3answers
84 views
Expressing semantics of an array as a function
An assignment questions asks the following:
Consider an array 'var a : array[1..10] of real'. Express the
semantics of this array as a function, defining the domain and
codomain (you might ...
0
votes
1answer
60 views
I have trouble to understand pattern calculus, could someone explain it in simple terms?
I am trying to understand the basic ideas of pattern calculus and do not have a lot of time to read through a rather long book. Can someone explain this in simple terms and give an example of how ...
6
votes
1answer
116 views
How do Functional Reactive Programming and the Actor model relate to each other?
FRP is about streaming events and behaviours through pure functions. The Actor model - at least, as implemented in Akka - is about streaming immutable messages (which can be considered to be discrete ...
4
votes
1answer
84 views
What is the state of the art in encapsulated search in functional logic programming?
I am particularly interested in solutions to the problem that encapsulated search can depend on the order of evaluation.
According to [1], encapsulated search in PAKCS depends on the order of ...
7
votes
2answers
149 views
Studying Programming Language Theory
I have recently become extremely interested in understanding and proving aspects of (functional) programming languages.
However as I dive deeper in, things like $\lambda$ calculus, category theory, ...
1
vote
1answer
141 views
Recursion problem involving head, tail and xor
Consider a set of functions:
head(l) returns first bit from list l, e.g.
...
8
votes
4answers
362 views
Lambda calculus outside functional programming?
I'm a university student, and we're currently studying Lambda Calculus. However, I still have a hard time understanding exactly why this is useful for me. I realize if you do loads of functional ...
6
votes
2answers
327 views
How to implement a prolog interpreter in a purely functional language?
Is there a clear reference, with pseudo-code, on how to go about implementing a Prolog interpreter in a purely functional language? That which I have found so far seems to deal only with imperative ...
8
votes
1answer
145 views
Concise example of exponential cost of ML type inference
It was brought to my attention that the cost of type inference in a functional language like OCaml can be very high. The claim is that there is a sequence of expressions such that for each expression ...
-2
votes
1answer
115 views
What is an example for which the purely functional programming approach gives better results than imperative style?
I have seen some questions related to functional programming on stackexchange sites which suggests it has significant popularity. I have some experience with it from many years ago in Lisp/Scheme and ...
4
votes
2answers
108 views
Difference between multimethods and overloading
Context
I've been programming in java for a few years now. And atm i'm learning something totally different: Clojure.
There the expression problem can be solved by using multimethods whereas in java ...
2
votes
0answers
51 views
Is there any research to indicate programmers are/are not moving to a hybrid of functional and object-oriented?
I am converting the OCaml Format module which does I/O and maintains state in a record with mutable values. As such it is a good candidate for me to convert to pure F#, pure C# and a hybrid.
Since ...
2
votes
2answers
307 views
What does “dummy argument” mean?
What is does it mean when an argument to a function is called a dummy argument? I have not encountered this term outside Fortran, is it a general term in computer science? What would be examples of ...
17
votes
4answers
832 views
Is Category Theory useful for learning functional programming?
I'm learning Haskell and I'm fascinated by the language. However I have no serious math or CS background. But I am an experienced software programmer.
I want to learn category theory so I can become ...
7
votes
1answer
160 views
Does High Order Functions provide more power to Functional Programming?
I've asked a similar question on cstheory.SE.
According to this answer on Stackoverflow there is an algorithm that on a non-lazy pure functional programming language has an $\Omega(n \log n)$ ...
10
votes
1answer
175 views
Constraint-based Type Inference with Algebraic Data
I am working on an expression based language of ML genealogy, so it naturally needs type inference >:)
Now, I am trying to extend a constraint-based solution to the problem of inferring types, based ...
5
votes
1answer
116 views
ML functions from polymorphic lists to polymorphic lists
I'm learning programming in ML (OCaml), and earlier I asked about ML functions of type 'a -> 'b. Now I've been experimenting a bit with functions of type ...
8
votes
2answers
207 views
ML function of type 'a -> 'b
Our professor asked us to think of a function in OCaml that has the type
'a -> 'b
i.e. a function of one argument that could be anything, and that can return ...