Questions tagged [purely-functional]

Purely Functional is a term in computer science used to describe algorithms, data structures, or programming languages that do not allow modification of data at run-time.

Purely Functional is a term in computer science used to describe algorithms, data structures, or programming languages that do not allow modification of data at run-time.

A pure function is a function whose returned value depends on nothing other than the arguments, and that causes no side effects; it contains no mutable hidden states. One consequence is that given the same arguments it will return the same value no matter when it is called, or how many times it is called, in the course of the program. In other words, such a function call (a "pure expression") has a value that does not depend on history or context.

Related concepts:

243 questions
-2
votes
1 answer

Is there a solution for the match-mapping-group pattern in python by Functional programming?

For example, I have a list such as [2, 4, 7, 9, 6, 12, 38]. I want to firstly recognize each number by whether it is odd, then add 100 to each odd and 101 to each even,finally get two lists. There are 3 steps: 1. Number matching that it is odd or…
-3
votes
1 answer

Can a "pure" function reference a property?

A pure function is one which given the same arguments, will always return the same result and will have no side effects. So Sum(x,y) => x + y; is pure because it meets this criteria. However, in a language like C# where you can have properties, this…
Chris
  • 107
  • 5
-3
votes
1 answer

Are these functions pure or impure?

I have two functions which I am unable to tell if they are pure or not. Here is the first one. someFunction(ref input1, ref input2) { input2 = input1 + input2 return input2 } I believe that its an impure function because it is allowing…
user6800688
  • 145
  • 3
  • 11
1 2 3
16
17