Data dodania Pytanie
2017-08-13 18:08 Append to end of string Ramda.js »
I am trying to append a string to the end of a string using Ramda, but the following does not work. R.append("A", "B") it returns ['A','B'] Does ...
(3) odpowiedzi
2017-08-12 16:08 How to repeat a list of functions in haskell »
I want to have an infinite list of functions that cycles through some pattern. For example: [(+), (-), (+), (-), ...] If I do something like fmap r...
(1) odpowiedzi
2017-08-12 05:08 How to handle a huge collection of functions in Python 2.7 »
So I am working on this existing code base which has about 150 or so functions as time series I wanted to store them in a class in order to prevent n...
(2) odpowiedzi
2017-08-11 22:08 Compose multiple predicate functions into one »
Is it possible to compose for example: (defn- multiple-of-three? [n] (zero? (mod n 3)) (defn- multiple-of-five? [n] (zero? (mod n 5)) into: multip...
(1) odpowiedzi
2017-08-11 15:08 Dependency injection and mocking in functional javascript and RxJS »
I am trying to rewrite a library written in classical OO Javascript into a more functional and reactive approach using RxJS and function composition. ...
(2) odpowiedzi
2017-08-11 14:08 Function return type not enforced »
I would be very thankful if someone patient enough explained to me the situation below. It seems to me as if Haskell were ready to perform some kind o...
(2) odpowiedzi
2017-08-10 21:08 File object versus with statement in tree structure »
I am doing some automated data processing and result analysis which take the form of a three with some recursion and some looping within it. The whole...
(0) odpowiedzi
2017-08-10 19:08 Javascript callback with setTimeout »
I am really new to funcitonal paradigm and I have a hard time understanding what is going on with the following snippet. const countDown = (val, cb, ...
(2) odpowiedzi
2017-08-10 09:08 How to return in Java 8 a Map with one entry removed »
Using Java 8 I have a Map<String, String> and I want to use a method of one of the standard libraries to return a Map with a specified entry rem...
(2) odpowiedzi
2017-08-09 11:08 How to write this function without arrow function »
SOLVED: My object value assignment should have been a[1] not obj[1] I'm practising some functional programming with javascript and I don't yet fully ...
(1) odpowiedzi
2017-08-09 10:08 Trying to refactor this code to use only immutable structures »
I'm a student of functional programming. I am still weaning myself off the old variable-mutation habits. But sometimes I get stuck. Ok, so here is the...
(2) odpowiedzi
2017-08-09 02:08 Functional code in assembly? (pure functions) »
I'm currently working on chess in TASM 16bit. I recently learned about pure functions and how they are the coolest thing in the universe, so my quest...
(1) odpowiedzi
2017-08-08 22:08 Use Ramda indexBy with variable index »
I need to transform some JSON data, and Ramda's indexBy does just about exactly what I want. The code below works for a single object: const operati...
(1) odpowiedzi
2017-08-08 12:08 Accessing matched obect in a patern matcher in Scala »
I'm currently doing the course Functionnal Programming Principles in Scala on Coursera and I've just learned about pattern matching. I'm trying to do ...
(1) odpowiedzi
2017-08-07 19:08 Difference in how IO works in FP vs Non FP languages »
Let's take the simple case here (pseudo code) def readnonfp(): String = { nonMonadicIO.readFile("somefile") } def readfp(): IO[String] = { m...
(0) odpowiedzi
2017-08-07 16:08 React: How to supply callback arrow functions to stateless functional child components? »
I'm struggling to supply a callback function to a stateless functional child component. I have these two components: export const FrontDeskGUI = () =...
(1) odpowiedzi
2017-08-06 12:08 Generate and combine functions from collections »
I want to compose a sequence of functions that when given a string passes it through all the created functions and produces a modified string. e.g. s...
(2) odpowiedzi
2017-08-06 09:08 Update nested values based on a condition using Ramda »
I am trying to update a value in an array in a nested object structure using Ramda. I want to update the value prop of the object in C with the name...
(2) odpowiedzi
2017-08-06 08:08 What is the concept of Chain Complete? »
I'm reading the book called 'Thinking Functionally with Haskell' by Richard Bird, and encountered the notion of Chain Complete regarding induction ove...
(1) odpowiedzi
2017-08-05 23:08 Erlang append / concat one list to another list »
I know there are other ways to avoid using Accumulators and the built in ++ will append one list to another list. However, if I build my own tail recu...
(1) odpowiedzi
2017-08-05 19:08 Rewriting imperative for loop to declarative style in Scala »
How do I rewrite the following loop (pattern) into Scala, either using built-in higher order functions or tail recursion? This the example of an iter...
(4) odpowiedzi
2017-08-05 03:08 Are there ever more than one possible functor instance of a given type »
I have the feeling that, for any ADT, there is only ever one possible Functor instance. Because the function (a -> b) for fmap only ever has one t...
(0) odpowiedzi
2017-08-04 19:08 How to create discrete streams in fs2 Functional Stream for Scala? »
Is it possible to create stream of discrete events in fs2? if so how to do it. I just started to play with the library and I know I have a lot to stud...
(0) odpowiedzi
2017-08-04 18:08 Using car and cdr »
I am new to scheme and having a hard time with using car and cdr. I have an AST string literal in ast. (define ast '(program ((assign (var i int) ...
(1) odpowiedzi
2017-08-04 17:08 Concat elements of tuple if contiguous lables are same »
I have a list of tuples. [('a', 1), ('b', 1), ('c',1), ('d', 2), ('e',1)]` The second element of tuple is its label. I want to concatenate the co...
(1) odpowiedzi
2017-08-03 18:08 How should I map over Maybe List? »
I came away from Professor Frisby's Mostly Adequate Guide to Functional Programming with what seems to be a misconception about Maybe. I believe: ma...
(2) odpowiedzi
2017-08-03 17:08 Find the fibonacci sum that is less than a given number in less than O(n) »
I am trying to work on a problem and part of the solution is to find the sum of finbonacci numbers that is less than an input number. Now the upper li...
(2) odpowiedzi
2017-08-03 11:08 lodash: and_then-like behavior for chain »
Is there any way in lodash that works like chain, but pass value to next stage only when it is not undefined? Just behaves as Result<T>::and_the...
(0) odpowiedzi
2017-08-02 12:08 None type in Priority queue scala »
I'm using a priority queue to order a case class called TreeNodeWithCostAndHeuristic case class TreeNodeWithCostAndHeuristic[S,A](parent:Option[Tre...
(2) odpowiedzi
2017-08-02 09:08 Searching through Array for 2 values next o each other »
I'm working on solution for a problem which I've solved in C#, but now I'm porting my code to F#. I've got a byte array and I need to search two value...
(3) odpowiedzi
2017-08-02 00:08 How to convert a string to a boolean[] array using Java 8 streams? »
The * character converts to true, everything else to false. This answer shows how to convert to Boolean[], but I seek to convert to an array of scala...
(2) odpowiedzi
2017-08-01 19:08 How to functionally compose Scala's Either »
If I have one or more Either values how can I compose them in a functional way so that I can log an error if there is a left value but continue in the...
(1) odpowiedzi
2017-08-01 12:08 Pipeline of functions scala »
Is it possible to create a pipeline of functions in scala?. I wanted to do something like the following syntax in F#, achieved through the |> operator...
(3) odpowiedzi
2017-08-01 08:08 Understanding Map and Reduce in Java 8/9 functional programming (lambda expression). How map() and reduce() increases performance? »
This one line of Functional Programming code does: 2*3 + 4*3 + 6*3 + 8*3 + 10*3 operation. int sum = IntStream.rangeClosed(1,10) /* closed range *...
(1) odpowiedzi
2017-07-31 23:07 declare variable scala as set of instructions »
Is it possible to declare a variable in scala as the result of a series of instructions?. I'm trying to do something equivalent to the following F# sn...
(2) odpowiedzi