Questions tagged [functional-programming]
Functional programming is a programming paradigm which primarily uses functions as means for building abstractions and expressing computations that comprise a computer program.
388
questions
0
votes
1
answer
38
views
Is Calling a Function a Side Effect
I've noticed a pattern in trying to make functional programming effective - there is still some kind of impure, effectful operation going on, but it gets holed up in a single, manageable imperative ...
1
vote
1
answer
49
views
Understanding how lazy functional languages achieve IO (...sometimes?)
An Alternative view of I/O programs, popular in earlier lazy functional programming languages, was to see the input and output as Strings, that is as lists of characters. Under that model an I/O ...
0
votes
1
answer
70
views
Free variable in the programming language
From the wikipedia of Free variables and bound variables
In computer programming, the term free variable refers to variables used in a function that are neither local variables nor parameters of that ...
0
votes
1
answer
34
views
What are the non-overlapping properties of a function?
Specifically, properties that identify preconditions over which a function can be used without resulting in undefined behavior or data races.
For example, I am familiar with 3 important properties:
...
2
votes
1
answer
43
views
Is there any reference materials on complexity analysis for lazy languages?
Is there any books, papers or articles on how to analyze the time complexity of programs written in lazy languages such as Haskell?
I know how laziness is implemented and how it can be expanded and ...
1
vote
2
answers
66
views
(how) is assignment or binding possible in purely functional languages?
i can't seem to find much info on the following question:
how (if at all) is the fixing of names to values (by binding or assignment) possible in a purely functional system like the lambda calculus?
i'...
0
votes
0
answers
65
views
Representation of pairs in System F
System F defines the data type pair as:
$$X\times Y := \Pi Z. (X\to Y \to Z)\to Z$$
with:
$$\langle x,y \rangle := \Lambda Z. \lambda p^{X\to Y\to Z}.p \text{ }x\text{ } y$$
Projections are defined:
$$...
0
votes
1
answer
37
views
time complexity of loops
what is the time complexity of:
for (i = 1; i <= n; i = 2*i)
for (j = 0; j < i; j++)
sum++;
?
I thought it is O(nlogn) since the otter loop ...
-1
votes
1
answer
167
views
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......
0
votes
0
answers
18
views
Would it be fair to describing a parser generator as a functional language?
I'm playing around with the implementation of PEGs and it struct me that the parser generator itself isn't any different than the language it's use to construct. If fact, it has all of the hallmarks ...
0
votes
0
answers
27
views
Are these two implementations of Bag different monads?
I am not an expert with functional programming. What I know is that the bag data structure satisfies the definition of a monad. There are two different implementations of Bag: one with linked lists, ...
3
votes
1
answer
53
views
What is the object translating part of a monadic endofunctor?
A monad is an endofunctor $T:C\rightarrow C$ with natural transformations $\eta:id_C\rightarrow T$ and $\mu:T^2\rightarrow T$.
Being natural transformations mean that $$T(f)\circ \eta_A = \eta_B\circ ...
3
votes
2
answers
153
views
Does this esoteric representation of integers have decidable equality?
Consider the following datatypes in Haskell:
data Foo = Halt | Iter Foo
newtype BigInt = BigInt {nthBit :: Foo -> Bool}
Foo ...
2
votes
2
answers
150
views
Translation between unit/bind and map/join in monads
Is there a translation between unit/bind and fmap/join in monads?
https://stackoverflow.com/questions/34398239/with-monads-can-join-be-defined-in-terms-of-bind
gives a partial one:
bind f m = join (...
0
votes
1
answer
75
views
Is it possible for a language to have mixed evaluation strategies?
As far as I am aware, most functional programming languages today use a call-by-value eager evaluation strategy with some exceptions like Haskell. I am curious if it is possible for a language to have ...