Data dodania Pytanie
2017-02-05 02:02 Scala grouping list into list tuples with one shared element »
What would be short functional way to split list List(1, 2, 3, 4, 5) into List((1,2), (2, 3), (3, 4), (4, 5)) ...
(3) odpowiedzi
2017-02-04 16:02 Is using Optional in Scala's case classes and classes fields a code smell? »
There were already quite a few discussions on Stackoverflow about proper ways of using Optional in Java (Discussions like this one, or this) As of n...
(2) odpowiedzi
2017-02-04 12:02 Filtering on Java 8 List »
I have a list of type List in functional java using List type provided by fj.data.List import fj.data.List List<Long> managedCustomers I am ...
(3) odpowiedzi
2017-02-04 02:02 Horner's rule for two-variable polynomial »
Horner's rule is used to simplify the process of evaluating a polynomial at specific variable values. https://rosettacode.org/wiki/Horner%27s_rule_for...
(2) odpowiedzi
2017-02-03 21:02 Translate merge function from Haskell to F# »
I have this function in haskell which I would like to code in F# using native syntax and not the array functions such as map2. Haskell: merge [] ys ...
(1) odpowiedzi
2017-02-03 15:02 How to sum list of integers and save each step to new list? »
I'm struggling to find simple-functional way to transform val ints = List(1, 2, 3, 4, 5) into List(1, 3, 6, 10, 15) How can it be done? ...
(5) odpowiedzi
2017-02-03 13:02 Any linter to warn about side-effects in JavaScript? »
With the flexibility of JavaScript, we can write code full of side-effects, or just purely functional. I have been interested in functional JavaScrip...
(3) odpowiedzi
2017-02-02 20:02 How to access :cause, :via and :trace keys of an exception in Clojure? »
I could not find a way to access :cause, :via and :trace keys of an exception. Here is the code: (try (throw (IllegalArgumentException. "1")) (c...
(1) odpowiedzi
2017-02-02 18:02 map varargs function lua »
I want to be able to map functions that take multiple arguments like function(a, b) return a+b end onto a table so that I can write stuff like ...
(3) odpowiedzi
2017-02-02 14:02 With Java 8's Stream API, how can I write a filter function that is pure? »
If I'm writing a filter function, I'm depending on an outside variable for my filter. For example: public List<String> getMatches(String search...
(2) odpowiedzi
2017-02-01 22:02 What is the right way to write functions in languages that support functional programming? »
I believe that functions should not contain instructions or variables that are not intimately/closely related to those functions. For instance, let's...
(0) odpowiedzi
2017-02-01 15:02 Finding result of a recursive function »
The given question is: "What is the value of f 572 for the following definition of f?" f :: Int -> Int f n = g n (n+1) g :: Int -> Int -> I...
(1) odpowiedzi
2017-01-31 23:01 Extract keys and left values from a Map<?, Either> in Javaslang »
Given a Map<String, Either<Boolean, Integer>, what's the most straightforward way to convert it to a Map<String, Boolean> containing on...
(0) odpowiedzi
2017-01-31 09:01 Which combinations of CAP does GdH support? »
I'm interested in the implementation of GdH (Glasgow Distributed Haskell). However, I could not find out which combinations in CAP theorem GdH support...
(0) odpowiedzi
2017-01-31 00:01 Passing additional parameters in higher-order functions »
Consider this example: const samples = ["foo", "bar"]; const excludeFoos = function(item) { return item !== "foo"; } const foos = sampl...
(6) odpowiedzi
2017-01-30 19:01 Is there a "while" equivalent that can be used inside a parenthetical statement in JavaScript? »
I often find JavScript shortcuts useful, such as replacing if/else statements like if (a !== 0) { b = c; } else { b = d; } with b = a ? c : d;...
(6) odpowiedzi
2017-01-30 18:01 How to name list without the last element »
Lets assume we have a list [x,y,z] Usually in functional languages and computer since we can say head = x tail = [y,z] last = z but how to name...
(1) odpowiedzi
2017-01-30 14:01 Create a function with an undetermined number of successive calls »
As part of a programming challenge, we are tasked with creating a function with an undetermined number of successive calls. As an example, let's say t...
(2) odpowiedzi
2017-01-29 16:01 Convert class to module Python3 »
I have a basic scrapy class that spiders a website. I simply want to convert it to only using functions instead of a class-oop structure. How can I ...
(1) odpowiedzi
2017-01-29 05:01 Split list into 2 lists of odd & even positions - SML? »
I'm required to write a function that takes a list and splits it into 2 lists. The first list will hold elements in odd position and 2nd list hold ele...
(2) odpowiedzi
2017-01-28 14:01 Is there a requiredFalse method in Java 8 for argument checking? »
I want to check arguments in a method. I've found the Objects.requireNonNull method which makes the code easily readable. Is it some similar build in ...
(4) odpowiedzi
2017-01-28 10:01 Value of bindings in SML? »
can someone please explain why is "ans" is bound to value of 16 in here after evaluation - this is a correct answer? I thought the answer 3 since we'...
(2) odpowiedzi
2017-01-28 03:01 Is it usual to wrap a variable in an useless `id` call to avoid eta-conversion issues on proofs? »
Using a language similar to Morte/CoC, I'm trying to prove the simple statement there are lists of arbitrary lengths. For that, I wrote the following ...
(1) odpowiedzi
2017-01-27 17:01 Implementing a functional interface to work with InputStreams »
The Scenario I'm trying to dev an @FuntionalInterface to work with InputStreams. The main Interfaces is: Interface StreamTransformer<T> - ...
(1) odpowiedzi
2017-01-27 06:01 How to define types in a DSL in Haskell? »
I've been writing an AST to build a DSL in Haskell and, for that, I'm using GADTs to define expressions such as: data Expr a where I :: Int -&...
(1) odpowiedzi
2017-01-27 03:01 LISP function to print out fibonacci sequence up to N amount of numbers »
I have to write code that computes N Fibonacci numbers (where N is the function parameter). I'm new to LISP and am struggling with the syntax. This is...
(3) odpowiedzi
2017-01-26 21:01 Create one array from 2 Arrays with keys x & y »
I have 2 Arrays xDates and yMentions xDates [1453766400000, 1453852800000, 1453939200000... yMentions [5160, 5240, 7090... Goal is an Array lik...
(3) odpowiedzi
2017-01-26 10:01 C# purely functional dictionary »
Does there exist (if not in the standard library, then perhaps as a Nuget package) a class, suitable for use from C#, that provides a purely functiona...
(4) odpowiedzi
2017-01-26 05:01 How to use recursive type in Kotlin »
What I want to do is something like this fun <F, A, R> recur(f: (F, A) -> R, arg: A): R = f(f, arg) where F = (F, A) -> R How can I typ...
(1) odpowiedzi
2017-01-25 10:01 While recursing in functional programming (or otherwise), what are the benefits/limitations of working with an explicit state variable? »
I was playing around with functional programming in Python, and realized there are two ways to replace loops with recursion. The canonical recursion t...
(3) odpowiedzi
2017-01-25 06:01 Pattern Matching SML? »
Can someone please explain the: "description of g"? How can f1 takes unit and returns an int & the rest i'm confused about too!! (* Description o...
(1) odpowiedzi
2017-01-25 04:01 How to append to existing array after cherry picking keys from another array of objects using ramda »
I have an existing array of objects const oldData = [ {'one': 1, 'two': 2}, {'one': 3, 'two': 4} ]; I have a new array of objects: const newDa...
(4) odpowiedzi
2017-01-24 16:01 Mapping an array of functions over an array in Javascript »
I often need to map a list of functions (processors) to several arrays(channels) of float data) so I have written a helper function... const mapMany ...
(4) odpowiedzi
2017-01-24 15:01 Working with beta reduce »
I brought the Haskell book and struggle with beta reduce. I do understand the concept but do not know, how to use it, when I have a lambda in front o...
(1) odpowiedzi
2017-01-24 14:01 Functional programming : Where does the side effect actually happen? »
After beginning to learn Haskell, there something I don't understand in Haskell even after reading a lot of documentation. I understand that to perfo...
(1) odpowiedzi