Data dodania Pytanie
2017-03-29 17:03 Order of Evaluation of Arguments in Ocaml »
I would like to know why does ocaml evaluate the calls from right to left, is that a FP principle or it doesn't matter at all to a FP language ? A qu...
(1) odpowiedzi
2017-03-29 08:03 Avoiding complex if statements »
I have the following function const getVal = (type, a, b, val) => { if(type) { if(a && b) { return val; }e...
(5) odpowiedzi
2017-03-28 20:03 Taylor series via F# »
I'm trying to write Taylor series in F#. Have a look at my code let rec iter a b f i = if a > b then i; else f a (iter (a+1) b f i) let...
(1) odpowiedzi
2017-03-28 19:03 How do I create an 2-D array in Haskell? »
I'm trying to learn Haskell by creating a board game. I currently have a game that is [[Char]] and I'm trying to create another board of the same colu...
(1) odpowiedzi
2017-03-28 07:03 In Scala, why does a type annotation must follow for the function parameters ? Why does the compiler not infer the function parameter types? »
I have a simple question, why is the Scala compiler not able to infer the function parameter types by itself ? ...
(2) odpowiedzi
2017-03-27 12:03 Information hiding and functional programming coding style »
I was developing a simple class, called Simulator, that applies a list of Simulations to a certain input. For each input the simulations can produce a...
(2) odpowiedzi
2017-03-27 05:03 Unable to group_by, table and gglot inside a function »
I want to be able to return group_by summary, table of a variable and geom_boxplot for a dataset Reproducible example: set.seed(100) df <- data.f...
(1) odpowiedzi
2017-03-27 01:03 How can I execute multiple statements in a single function? »
I am learning Haskell and for an assignment I have to print a Snakes and Ladders game. Starting out, I am trying to print the board and this is what ...
(3) odpowiedzi
2017-03-26 21:03 Understand Function capturing through map and reduce »
I 'am beginner in Elixir language , so In the blow example iex> Enum.reduce([1, 2, 3], 0, &+/2) 6 iex> Enum.map([1, 2, 3], &(&a...
(3) odpowiedzi
2017-03-26 20:03 Performance gain implementing concatMap with foldl' for finite list? »
I read from Foldr Foldl Foldl' that foldl' is more efficient for long finite lists because of the strictness property. I am aware that it is not suita...
(1) odpowiedzi
2017-03-26 19:03 New line in Haskell »
I've been looking through previously asked questions and I can't find an answer that solves my problem, although I thought at least one of them would....
(1) odpowiedzi
2017-03-25 16:03 Understanding 'maybe' in haskell »
So say we have an example of a function sqrt that gives us the square root of a floating point number but does not abort on negative inputs. So what w...
(2) odpowiedzi
2017-03-25 15:03 Haskell data type for hmatrix Vector and Matrix »
I am just starting out with Haskell, I have read up to the defining data types section of LYAH and am attempting to implement the Sum-Product algorith...
(1) odpowiedzi
2017-03-25 14:03 How to translate this javascript code into functional way (better using Ramdajs)? »
I'm trying to create settings module with interface that can give functions for changing and reading from settings object. Now code looks like this: ...
(1) odpowiedzi
2017-03-24 15:03 javascript: Using lodash/fp flow to return objects »
I am converting a _.chain group of functions to use _fp.flow, but am having some difficulty dealing with the way flow curries complex objects. I am tr...
(2) odpowiedzi
2017-03-24 08:03 Scala code prettification - loop 2D array with if statement »
Hey i am pretty new to functional programming so what is the most scala-like way to write this peace of code? var ANSWERS_ARRAY // Is array for ((row...
(2) odpowiedzi
2017-03-24 02:03 Scala Exception Handling »
I am writing data from parquet to Tableau. For this For each partition, I have created a table and create a tableau row from parquet row Insert ea...
(1) odpowiedzi
2017-03-23 21:03 Haskell's (<-) in Terms of the Natural Transformations of Monad »
So I'm playing around with the hasbolt module in GHCi and I had a curiosity about some desugaring. I've been connecting to a Neo4j database by creatin...
(3) odpowiedzi
2017-03-23 18:03 Prolog - average predicate: Arguments not sufficiently instantiated »
I have a list of cars (auto in german), where the first Variable is the license-plate and the second one the speed: [auto(eu-ts884, 69), auto(dn-gh18...
(1) odpowiedzi
2017-03-23 13:03 Javascript: How can I replace nested if/else with a more functional pattern? »
The following pattern gets repeated in my React app codebase quite a bit: const {items, loading} = this.props const elem = loading ? <Spinner /&...
(3) odpowiedzi
2017-03-22 19:03 How to double elements in an F# list and set them in a new list »
I am very new to F# and functional programming in general, and would like to recursively create a function that takes a list, and doubles all elements...
(1) odpowiedzi
2017-03-22 12:03 Swift refactor with generics: how can I imply runtime values from the generic type? »
I'm trying to factorize methods using generics in Swift. My methods are as follow: func searchFoo(searchText: String?, completion: @escaping ([Foo]?...
(1) odpowiedzi
2017-03-22 03:03 RE: Error encountered in ramda-fantasy map method »
I am trying to understand how the map works in FP. I want to test how does the map work in Functional Programming. Below is the testing code. var R...
(1) odpowiedzi
2017-03-21 23:03 OCaml Triple every number in a list of integers »
So I need to write a function that will triple every number in a list of integers Here is what I have so far: let number = [1; 2; 3; 4];; let rec ...
(2) odpowiedzi
2017-03-21 17:03 Breaking an integer up into chunks, functionally »
Consider the problem of decomposing milliseconds into readable time units. Imagine you had a function that did that > breakupMillis(100000000) Ar...
(3) odpowiedzi
2017-03-21 03:03 The improved solution for 2 sum algorithm »
I try to work out the functional implementation for the algorithm in leetcode (https://leetcode.com/problems/two-sum/#/description) I guess what I ne...
(3) odpowiedzi
2017-03-20 16:03 scala and akka function literal ? need help in understanding the language of functional pattern »
entity(as[ConnectionData]) { connection_data => I am trying to understand in the above code snippet example how the connection_data, language wis...
(2) odpowiedzi
2017-03-20 10:03 Elixir/ExUnit: how to test functions with system calls most elegantly? »
Situation Normally, unit tests like ExUnit should be self-contained with input, function call and desired output, so that the test can run on any sys...
(1) odpowiedzi
2017-03-20 08:03 Validating search parameters using predicates »
I have a validate() method that checks the arguments passed in a rest url. The arguments are linked to a model class like the following class SearchC...
(2) odpowiedzi
2017-03-19 22:03 Unit testing higher order functions in F# »
Take the following F# example: let parse mapDate mapLevel mapMessge (groups : string list) = { DateTime = mapDate( ...
(1) odpowiedzi
2017-03-19 10:03 Scala doesn't recognize implicit conversion »
I'm trying to define an additional method on Scala's Try via implicit conversions. Here's my isolated, reproducible example-- import scala.util.Try ...
(1) odpowiedzi
2017-03-19 05:03 Finding the number of digits in a given base in haskell »
say we are given numbers n and b where b is the base to be taken, to find the number of digits in n i know that the formula is ⌊logmN⌋+1 however...
(1) odpowiedzi
2017-03-18 22:03 lambda syntax in scheme language »
I am learning functional programming. A question came to my mind when I read about the lambda section introduction about FP. In Scheme the syntax f...
(2) odpowiedzi
2017-03-18 19:03 Reading integers from a list »
I'm facing the following problem in Haskell: I want to parse such list: ["1", "2", "3"] into a Maybe [Int]. What I can do is, using readMaybe from Te...
(1) odpowiedzi
2017-03-18 18:03 F# functional coupled iteration: performance issue and preferred functional style »
I am getting through the excellent book "Real-World Functional Programming" by Tomas Petricek and Jon Skeet (two SO gurus, btw, thanks to both of them...
(1) odpowiedzi