Functional programming is a programming paradigm which primarily uses functions as means for building abstractions and expressing computations that comprise a computer program.
Questions tagged [functional-programming]
395 questions
0
votes
0 answers
How to collect free/bound variables in Lambda Calculus?
I am building a simple interpreter for untyped lambda calculus, currently trying to implement alpha-reduction. According to this document on LC : Alpha-reduction is used to modify expressions of the form "λx.M". It renames all the occurrences of x…
Jan Parzydło
- 129
- 3
0
votes
1 answer
Lazy streams and infinite series
I just started Unix System Programming with Standard ML and starting on page 22 Shipman begins to explain a pure functional way of avoiding the constant state changes of typing at a keyboard: A lazy stream is an infinite list of values that is…
147pm
- 131
- 4
0
votes
1 answer
Functional data structure fast to add and unorded deletion
I am looking for a functional data structure that would work in this role. Adding items to the struct happens often. Removing items from the struct happens as often as adding them but I have no way of knowing what order the deletion happens in. Over…
Q the Platypus
- 173
- 5
0
votes
0 answers
Trying to determine Fixed Points
I'm basically trying to solve 4.2 (Taken from Semantics with Applications) As I see it, the functional F will be defined like so: (F g)s = s if s x == 0 (F g)s = gs[x -> x -1] if s x!=0 So, the first function is g1 s = undefined for all s I don't…
nz_21
- 123
- 1
- 4
0
votes
2 answers
Beta reduction order in Lambda calulus
Will it be wrong to use g for reducing (λx.λy.x) first in step (2) instead of using to reduce λg? Is there a rule against it?
n0unc3
- 33
- 1
- 6
0
votes
1 answer
Composition of compostion as a functor
"Composition of Composition" (i.e., (.) . (.) ) in Haskell), has type (a -> b) -> (c -> d -> a) -> c -> d -> b . Apparently, this is an instance of fmap , i.e. a functor between two categories. The question is: what is the domain and the codomain of…
xuq01
- 1,232
- 10
- 19
0
votes
1 answer
First-order vs Higher-order Programs
Can someone explain the difference between first-order programs and higher-order programs in the context of programming languages? My understanding so far is that Functional Languages (most) use higher order programs. Plus, higher functions either…
wa7d
- 103
- 3
0
votes
2 answers
Multiple inputs in lambda calculus (Confusing example)
In a programming class I take, we briefly (very briefly) touched lambda calculus. I think I have a pretty good grasp of the basics now, but one example given I just don't understand. Am I missing something or is the example possibly false? $\lambda…
user96726
-1
votes
1 answer
“Left identity” of Monad laws in Haskell is wrong
Monad laws in Haskell Left identity: return a >>= f ≡ f a Right identity: m >>= return ≡ m Associativity: (m >>= f) >>= g ≡ m >>= (\x -> f x >>= g) is widely known, and I think the "Left identity" rule does not make sense. In category theory, it is…
KenSmooth
- 109
- 2
-1
votes
2 answers
Defining an HTML Template as an Algebraic Type
Wondering if/how you could define a highly nested structure as a Dependent Type (or an Algebraic or Parameterized type). Specifically, an HTML template. Not that they work like this (HTML templates don't have variables to plug in), but imagine a…
Lance Pollard
- 2,343
- 1
- 20
- 37
-1
votes
1 answer
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 have seen commentary on the difference between…
vzn
- 11,218
- 1
- 29
- 52
-1
votes
1 answer
Call by value is known as pure function how ?give reason
I think call by value may be pure function or impure function... And pure function can be written through call by value or call by reference.... So according to the facts (c) should be correct ans...
Trivedi
- 9
- 1
-1
votes
2 answers
Are pure functions always computable functions?
Are pure functions always computable functions? In computer programming, a Pure function is a function that has the following properties: (1) the function return values are identical for identical arguments (no variation with local static variables,…
polcott
- 95
- 1
- 1
- 14
-1
votes
1 answer
Repeating functions in functional programming?
Functional programming is said to be superior in many ways to imperitive programming. But I am struggling to find a simple functional way of writing: x = f(y); g(x,x) Since in functional language this would be g(f(y),f(y)) thereby calling the…
zooby
- 273
- 1
- 7
-1
votes
2 answers
Applying FP/Categorical terminology to non-FP languages
In my continuing effort to finally wrap my brain around advanced FP/categorical concepts, I've been reading dozens of articles and tutorials; what I have concluded is that: 1) Category Theory and Software Engineering use the same words in different…
Crell
- 151
- 6