Skip to main content

All Questions

0 votes
2 answers
537 views

How to return each line of a text file using a recursive function?

I am trying to return each line of html.txt: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> My current code is this: def line_out(file): if len(file) == 1:...
Flamenco33's user avatar
1 vote
3 answers
786 views

Scala: Most efficient way to process files in folder based on a file list

I am trying to find the most efficient way to process files in multiple folders based on a list of allowed files. I have a list of allowed files that I should process. The proces is as follows val ...
Kylo's user avatar
  • 141
-4 votes
1 answer
175 views

What is the difference between loop, comprehension and recursion in functional programming languages

I'm studying elixir and I see that there is two ways to iterate Comprehension And recursion I'd like to Know the difference between loop and comprehension specially, I've googled the question but I'...
Abdulrahman Abdullah's user avatar
0 votes
3 answers
324 views

Print series of number every 50

I need to paginate through an API and I am creating the URLs. The URL looks like this: /search/officers?q=XXXXX&items_per_page=50&start_index={} The maximum items per page allowed in the ...
Tytire Recubans's user avatar
2 votes
1 answer
109 views

Functional way to convert a loop that is based on intermediate value that updates on each loop in python

My title might not be very direct, but basically, I want to change the following code written using for loop into a recursive function. import numpy as np irrel_pos = range(3, 11) n_extra_pos = [2, 3]...
TheRimalaya's user avatar
  • 4,602
0 votes
1 answer
150 views

Uses “Recursion” concept to iterate collection data in Functional Programming

I read some papers and documents that said that Functional Programming uses “recursion” concept to iterate collection data, while OOP uses “loop” concept to iterate collection data (for example:- the ...
vuduc's user avatar
  • 7
-1 votes
3 answers
87 views

recursion functional programming dilemma

Below is my code in JavaScript. The loop answer down at the bottom is the correct answer. My recursion version is incorrect and it is so illogical that when the index is 3 and the array length ...
john chau's user avatar
  • 453
0 votes
1 answer
75 views

Should I use loops?

I have been learning the functional programming in ML for quit a while I got fixated on the of recursion and tail recursion. almost ( rather every ) loop I write in other language I write tail ...
Ahmed Eid's user avatar
  • 4,844
9 votes
4 answers
4k views

infinite loop in functional programming?

I was wondering: can infinite loops be done in functional programming? example: when using the windows API to get windows messages, it is usually implemented in a loop. I know it is possible to make ...
symbiont's user avatar
  • 1,580