All Questions
Tagged with loops functional-programming
3
questions
3
votes
2
answers
5k
views
Using 'reduce' vs 'for' loop for returning boolean [closed]
I was wondering what people think about using a reduce function vs loop for returning true if a condition exists.
Example:
var a = [1, 5, 7, 4, 2, 5, 3];
var greaterThan5 = a.reduce(function(prev, ...
9
votes
1
answer
3k
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)
{
...
0
votes
1
answer
233
views
LOOP program only need inc and zero
I have 4 different commands in LOOP programming language:
y=Zero()
y=Val(x)=copy x and put it in register y
y=Inc(x)=x+1
y=Dec(x)=x-1
Finally I also have
loop n times {
...
...