Most voted "functional-programming" questions
Functional programming is a programming paradigm that primarily uses functions as a means for building captures and expressing calculations that comprise a computer program.
Learn more…97 questions
Sort by count of
-
3
votes1
answer163
viewsIn a matrix Z of elements (i,j) how to assign the value 1 when i=j? (software R)
Under the following condition: ifelse(??, 1, Z/(1+1)) What to put in place of "??" so that R understands that when i=j in the matrix Z, I want to assign the value 1?…
-
3
votes1
answer93
viewsWhat are the advantages of using "currying" in a function?
I understand that, roughly speaking, to use currying is to break a function that takes several arguments into smaller functions that receive only parts of the arguments of the original function.…
-
3
votes1
answer180
viewsHow to add elements of two streams in java?
Hello, I would like to make a function that sums the elements of two Streams and returns a Stream with the results, in a "functional" way without using third party libraries. For example:…
-
3
votes1
answer72
viewsError in calculating a PA with Haskell
The function does not return the expected result but I followed the formula and can not understand the error in logic. I hope to return the term i-th. termoPA :: Int -> Int -> Int -> Int…
-
2
votes0
answers58
viewsWhat is the process of generating pdf files?
How is the internal process to generate a pdf file? Indifferent to the programming language that is generating it.
software-architecture pdf pdf-generation functional-programmingasked 9 years, 9 months ago Rod 9,412 -
2
votes1
answer78
viewsWhat is the Substitution Model in Scala - Replacement Model
Substitution Model - Replacement Model What is the concept behind? How It Works? What it affects the way we program in Scala
-
2
votes3
answers161
viewsHow can I make this code more functional in Javascript?
This code solves the problem of finding the in anth prime between 0 and 10,000: function PrimeMover(num) { var counter = 0; var primes = []; for (var i=2; i<=10000; i++){ for (var j = 2; j<i;…
-
2
votes1
answer173
viewsHow to use Consumer in a variable (Java 8)
I created my own data structure for a Text Adventure game, and in it each Action object has a Consumer. The next step would be whenever someone typed a word, went through the structure and found an…
-
2
votes2
answers153
viewsNext 0-Z Sequence Code with Javascript
I need to create a Javascript function that takes a string of letters and numbers and it returns the next count value. The count goes from 0 to Z. Example of the sequence: 0 - 1 - 2 - 3 - 4 - 5 - 6…
-
2
votes2
answers2157
viewsCreate function hexadecimal and octal conversion function in python
Good evening, I’m trying to do two functions one to convert hexadecimal numbers into decimals and one to convert octal numbers into decimals, this is my code: def hexadecimalparadecimal(n): decimal…
-
2
votes1
answer509
viewsCalculate the Cartesian product with functional programming
I’m writing a Python function that takes two lists and returns a list of tuples with the Cartesian product of the input function. I cannot use any ready-made Python library function. Ex:…
-
2
votes1
answer580
viewsbreak list by python size
Today I came across the need to break a list of over 100 values in a list of lists with a maximum of 100 values. I researched a lot, and in the end I put together the function: remove_list=[[]] n=0…
-
2
votes0
answers82
viewsAssociate final variable to another reference in lambda expression
I was developing a code that uses lambda expressions, where variables outside the scope of the expression should be declared as final. Then the doubt arose: I can associate the variable declared as…
-
2
votes2
answers501
viewsHow to receive an input during an R function?
It is possible to ask a question and receive an input while executing a function? Example: formateCdoispontos<-function(){ print('Tem certeza que quer fazer isso? (S/N)') ...…
-
2
votes2
answers75
viewsWith calling a file in Clojure?
Hello, I have already searched in several places, but I did not find the answer I wanted. I have the following function in the archive home.clj (defn hello [request] (let [name (get-in request…
-
2
votes1
answer33
viewsImmutability in the angular components
Hello, I am learning functional programming and would like to know how to apply the principle of immutability in the angular components. For example, in the case below I have a list of files that…
-
1
votes1
answer386
viewsWhat do the terms CPU-time Wall-clock-time mean?
Some documentation (programming) refers to these terms when there is some sort of limitation as to the use of the CPU, for example: Background tasks are limited by the amount of time use of…
terminology multithreading functional-programming cpu clockasked 7 years, 9 months ago rubStackOverflow 7,372 -
1
votes1
answer70
viewsWhy use the rational type?
Why do languages like Haskell and Clojure adopt rationale as a type? Why would I use Rationale instead of Float or Double?
-
1
votes1
answer126
viewsPassing value from a label to Arduino via serial
I have developed a Windowsform that contains a label that checks CPU usage and displays its variations, and a button that connects the software to the Arduino in the available serial port. I also…
-
1
votes1
answer112
viewsElixir multiplication on a Map does not work. Why?
I’m new to Elixir and I don’t understand the return of function. list = %{"100" => 1, "50" => 2, "20" => 4, "10" => 8, "5" => 16, "1" => 32} for {key, value} <- list, do:…
-
1
votes1
answer41
viewsDoubt Error Tree in Haskell
My teacher, in a matter of Haskell asked to set tree in the following way: Being that defining this way gives this error: And in many corners of the internet, the tree in Haskell they define using…
-
1
votes1
answer353
viewsWhat are and what are the main differences between Functional Programming and Reactive Programming?
I wanted a clear and objective explanation? I read separate cases, but I wanted to know the main points that differentiate the two
-
0
votes1
answer1230
viewsHow to know what the current $Location is
How do I validate when there is a change on the screen and the user clicks another hyperlink to exit the screen, the same can not allow. Is there any ready angular function that performs this check?…
-
0
votes1
answer54
viewsPHP - website e-commerce, generate UUID for each shopping cart
Good morning, first of all, I’m trying to create a unique code for each shopping cart, which is the best way, I was thinking of using UUID, but I have no idea how to do it, if anyone knows a good…
-
0
votes1
answer306
viewsString Encoding - Haskell
The following code encodes a sequence of equal characters, replacing the sequence with ! na, where n is the number of times the character a is repeated. Note that it only compresses sequences…
-
0
votes1
answer107
viewsDoubt, mistake Haskell
I want to sum the values of a list of lists in Haskell using the map function, but of the error. Type error gastoEmpresa :: [[Float]] -> Float gastoEmpresa xss = map(map sum xss)…
-
0
votes1
answer34
viewsDependency is not added to clojure project
I’m learning Clojure and created a simple spellchecker project. In this project, I would like to use the Stringutils class from Apache Commons, so I added the following lines of code to import it…
-
0
votes0
answers131
viewsTwo-dimensional Matrix in C
I have a record of products in C. Products can have up to 30 characters (columns), but can be infinite in quantity (rows). In the variable declaration, I used: char products[][30]; but when…
-
0
votes2
answers88
viewsHow to use extensive functions in Javascript
In Javascript primitive types have native functions, such as an object of the type Number has a function toString(): (1).toString(); // "1" And an array has a includes(): [1, 3, 4].includes(1); //…
javascript function functional-programming extension-methodasked 6 years, 10 months ago Yago Azedias 1,117 -
0
votes1
answer808
viewsHow to separate each element from a list, with a String, in a row
The problem is simple, I would like to add an element to a real-time generated list for each given iteration. For example, if the list l is generated through [x for x in range(10) if x%2==0], then I…
-
0
votes1
answer518
viewsHow to Replace Characters with Other with C#
For example: 4587 / 1235 / 7554 And then replaced 4587;1235;7554 Remove the spaces and in place of the bar, put point and comma, as it does in C#?
-
0
votes0
answers61
viewsError must take Exactly 2 Arguments - PHP/Wordpress/visual
Hello, I’m trying to create a custom component for visualComposer a dropdown, I have the php search.php file that creates the custom component, and I have the Recipe.php file that returns the data…
-
0
votes1
answer37
viewsThe difference between FOR and DOSEQ in clojure
What difference between for and doseq? I wrote a program, which returns me the highest value within the parameters informed. Note: I know that there is a function max and max-key, but I don’t want…
-
0
votes1
answer453
viewsFUNCTIONAL PROGRAMMING: Recursive function to calculate the rest of the division between two positive integers in ELM
Hello, I’m having trouble making a recursive function that passes as a result the rest of the division of two integers into ELM. I was able to perform the function without recursion as shown in the…
-
0
votes1
answer40
viewsRacket Function - Character comparison from a string
Good evening, I’m starting now to learn Racket for college and I have an implemented function that I don’t understand why it’s not working. The goal is to receive a string and a character and return…
functional-programmingasked 5 years, 1 month ago fsilverio 11 -
0
votes0
answers35
viewsHow to enter a number (x) and add up all the previous numbers?
How to enter a number and make the sum of all previous numbers, EXAMPLE: I enter the number 5, it will add up to 0+1+2+3+4 = 10 ! He will add and give the answer. I have to use the FOR command. My…
-
0
votes1
answer101
viewsHow to call a method when using the switchMap operator
I’m studying reactive forms, working with Framework Angular. Thinking about functional and reactive programming, I’m listening to the status changes of the control cep, then, first I used the…
angular functional-programming rxjs reactive-programmingasked 4 years, 10 months ago Thomas Erich Pimentel 3,059 -
0
votes0
answers38
viewsAre there Patterns shared between functional and object-oriented paradigm?
Desing Patterns is a subject that has strong appeal to object orientation. We can hardly see in the literature these subjects associated with another paradigm. However, in version 16.8 of React came…
oop pattern-design software-engineering functional-programmingasked 3 years, 8 months ago Paulo Sérgio Duff 1,201 -
0
votes0
answers14
viewshow to make algorithm for the second CPF checker code for Python?
while True: cpf = input("Digite n: ") novo_cpf = cpf[:-2] soma_digitos = 0 lista_digitos = [] for key, index in enumerate(novo_cpf): key_reverso = len(novo_cpf) + 1 - key…
-
0
votes1
answer33
viewsFunction in R is not taking the parameter correctly
I am creating a function, but when calling the function, the parameter is not working when performing FILTER and SUM. To select the column or to perform an n() type count, it works correctly.…
-
0
votes0
answers21
viewsHow to search Array objects within the Spreadsheet of Google Apps Script and compare with another spreadsheet?
I created a code where the number of Arrays is variable within an order control sheet! And I need to take the objects of this variable spreadsheet and check if the objects (product name) match with…
javascript node.js functional-programming google-app-engineasked 3 years, 4 months ago Gabriel Teixeira 1 -
-1
votes0
answers13
viewsEXTRACT LATEST EXCEL FILE INSIDE A PYTHON FOLDER
I would like to know how to tell python(pandas) that I only want to import the latest file you have in a certain folder. Every day the folder is updated with a new file and every day the program…
-
-2
votes3
answers1379
viewsHow to traverse an element by one in a JS array
Come on, guys, good afternoon. I’m doing a function that has the same utility as ANY. What is the idea, is to know if it has any number smaller than the given in the function inside the array,…
-
-2
votes1
answer80
viewsI am new in java and this line of code is giving error
import javax.swing.Joptionpane; public class test { public Static void main(String[] args) { Joptionpane.Showmessagedialog(null,"sla"); System.Exit(0); } }…
functional-programmingasked 5 years, 2 months ago Nômade 1 -
-2
votes1
answer115
viewsHow to add 2 objects and return number, in Python?
I have the following class: class num(int): def __init__(self, n): self.n = n I would like it to work as follows: A = num(2) B = num(3) A + B = 5 This is part of a much more complex personal…
-
-3
votes0
answers34
viewsHOW TO CREATE A WEBSITE OR FORUM THAT HAS ACCESS TO USERS' REGISTRATION DATA
I wanted to know if there is a site/ forum that ADM can access the data of who register (basically the login and password they used to create, only) and that is easy to handle (I am Noob in…
-
-6
votes1
answer43
viewsLoop error with for loop and loop control variable
the error written is and my code is this someone can help me fix this bug? The language is c…
functional-programmingasked 4 years, 1 month ago Sathler do valorinho 11