Data dodania Pytanie
2017-06-19 11:06 Is there any point in drawing an UML class diagram in functional programming? »
I have been asked on a school project to show the UML diagrams I used - if I did - to realise the project. But the project I was working on was in C ...
(4) odpowiedzi
2017-06-19 10:06 Compose javascript functions with more than one argument »
How can I convert this function composition into more readable format? funcA(argumentA, funcB(argumentA, funcC(argumentA, argumentB))) What I'd lik...
(3) odpowiedzi
2017-06-19 00:06 Functional Programming scala »
I was following "Functional Programming Principles in Scala" from coursera and in the second week the assignments is about "Purely Functional Sets" We...
(2) odpowiedzi
2017-06-18 22:06 Increasing performance of a function which processes an array using destructuring and recursion »
I wanted to create a function which takes another function and an array as parameters and calls that function for each three consecutive elements of t...
(4) odpowiedzi
2017-06-18 18:06 SML syntax error »
Logic: eploy(list, constant) if list is empty then return: 0; else return: (first_element + constant*eploy(rest_of_the_e...
(1) odpowiedzi
2017-06-18 01:06 Checking whether an Array[A] is sorted? »
While working through a problem found in 'Functional Programming in Scala': Implement isSorted, which checks whether an Array[A] is sorted accordi...
(1) odpowiedzi
2017-06-17 23:06 Passing function code using java 8 supplier »
I am trying to understand lambdas in Java 8. I have this very simple example using a functional interface. This is not a working example and I under...
(1) odpowiedzi
2017-06-17 22:06 What is the flow type for a zipAll function, such as in lodash/fp? »
Even in normal lodash, zip's type is declared using overloads, like: zip<A, B>(a1: A[], a2: B[]): Array<[A, B]>; zip<A, B, C>(a1: A...
(1) odpowiedzi
2017-06-17 11:06 Is refactoring more difficult in functional programming than in OOP? »
Because of the fact that in OOP you can encapsulate (hide) a lot of details as private fields in a class, you can hide most of the details. So when yo...
(1) odpowiedzi
2017-06-16 20:06 When use of "reduce" is appropriate? »
Sometimes people use reduce to make code shorter, but for me, it looks a little bit complicated and confusing. Following code looks pretty clear for ...
(0) odpowiedzi
2017-06-16 14:06 Shouldn’t `EitherT` be covariant? Especially in the Left? »
I have the following code def addKitten(kitten: Kitten): EitherT[Future, GenericError, UUID] = { val futureOfEither = db.run { // returns a Future[...
(2) odpowiedzi
2017-06-16 02:06 Scala partial application via underscore when composing function literals »
I am composing function literals, though unlike most examples I've seen I'm starting with a multi-argument function that is then curried. I have: //...
(1) odpowiedzi
2017-06-15 23:06 Scala: sort list by sum of duration »
I have the following classes: Task(id: String, time: Duration) Product(id: String, tasks: List[Task]) Then, I have a list list: List[Product] with...
(3) odpowiedzi
2017-06-15 15:06 How can the lack of return type polymorphism in untyped languages be alleviated? »
I've been working with Church encoding recently and when I look at a typical type newtype ChurchMaybe a = ChurchMaybe { runChurchMaybe :: forall r ...
(2) odpowiedzi
2017-06-15 14:06 F# sum of all other elements in list »
Lets say i have a function definition like this: let sum (numbers: int list) = // code here What are possible ways to compute a sum of all othe...
(2) odpowiedzi
2017-06-15 13:06 Understanding the max function operation on Python dictionary »
I am trying to understand the operation on max function on Python dictionary. Following is the code I am using: tall_buildings = { "Empire State...
(3) odpowiedzi
2017-06-14 20:06 Composing data structures during reduce/fold »
I'm working on a Natural Language Processing project (and learning Elixir), and can't figure out the idiomatic way to transform my data. In order not...
(1) odpowiedzi
2017-06-14 19:06 How to check if some of the object values match the predicate in Ramda? »
Since there is no R.some, how do I implement the following in Ramda? const hasKey = (predicate, object) => Object.keys(object) .map(key =&gt...
(1) odpowiedzi
2017-06-14 11:06 In functional programming, why IO's join method should run the unsafePerformIO twice? »
In DrBoolean's Gitbook, there are several examples explaining monad, for Maybe: Maybe.prototype.join = function() { return this.isNothing() ? Maybe...
(1) odpowiedzi
2017-06-13 17:06 python3: Using ternary operator in map, it will return None »
For python 2.7.13 >>> lst_ = [1] >>> map(lambda x, y: x + y if y else 1, lst_, lst_[1:]) [1] For python 3.6.1 >>> lst_ ...
(1) odpowiedzi
2017-06-13 12:06 Is explicit type passing not equivalent to type inference (in terms of expressiveness)? »
I try to translate traverse/sequenceA to Javascript. Now the following behavior of the Haskell implementation gives me trouble: traverse (\x -> x)...
(1) odpowiedzi
2017-06-13 10:06 Function Composition With Monads...not working »
I have some ugly data, that requires a lot of ugly null checks. My goal is to write a suite of functions to access/modify it in a point-free, declarat...
(1) odpowiedzi
2017-06-12 18:06 Javascript: point-free style in callback »
So I wanted the elements of the array arr1 that also happen to belong to the array arr2. I figured arr1.filter(arr2.includes) should do the trick, but...
(2) odpowiedzi
2017-06-12 16:06 What is the best way to do extensive null checks in F# when calling C# code »
I would like to know the best way to interact with C# code from F# in a functional way, when I have to check null many times. From C#, is easy becaus...
(1) odpowiedzi
2017-06-12 09:06 What is the best practice for Handling Log message with using functional way »
I'm new in scala programming. I'm puzzled now for how to declare a biz method in a asynchronous and functional way, that the method implementation sho...
(1) odpowiedzi
2017-06-11 20:06 Python __slots__ metaclass issue »
I'm currently implementing slotted metaclasses using type(): type(i, (), {'__slots__': tuple(data) I would of course ideally keep with slots as I h...
(1) odpowiedzi
2017-06-11 17:06 Objects Referential transparency for functional programming in Java 8 »
I have been studying functional programming and one of the requirements is that they are pure in the sense that they only return the computed value an...
(2) odpowiedzi
2017-06-11 13:06 Converting mutable struct to immutable in Swift »
I've searched a lot, read up on functional programming, and can't seem to find a straightforward answer to my problem. I'm creating a game utility lib...
(1) odpowiedzi
2017-06-10 19:06 Name of a common pattern-matching functional operator »
In functional programming, what is the name (or name of the concept) of the following functional operator P?: Given two functions f and g, and pre...
(2) odpowiedzi
2017-06-10 15:06 How to test Isabelle proof from archieve list »
From Archieve of Isabelle Proofs if one wants to test AVL Tree, how to go about it? Proof is there and gets approved by Isabelle Ide as well but wha...
(0) odpowiedzi
2017-06-10 15:06 Ramda length deep »
I have an array of arrays one level deep and need to calculate the sum of lengths of the nested arrays, i.e. length deep. Trying to figure out a good ...
(3) odpowiedzi
2017-06-09 17:06 Scala: creating HashMap using two Lists »
I have two lists in Scala: val workersList = Worker1 :: Worker2 :: Worker3 :: Worker4 :: Nil // type List[Worker] val workStationsList = WS1 :: WS2 :...
(1) odpowiedzi
2017-06-09 16:06 HashMap only has one element instead of three »
I am filling a HashMap in Scala like so: val hashMap = new HashMap[P, List[T]]() { list.map(x => put(x.param1, x.param1.elements)) } The problem...
(1) odpowiedzi
2017-06-09 07:06 scala how to reduce while n > 0 »
I am wondering if there's a way to deal with a while (n > 0) loop in a more functional way, I have a small Scala app that counts the number of digits ...
(4) odpowiedzi
2017-06-08 21:06 Map Filter and Fold in C++ »
I have a problem that normally would be well suited for Java streams, but I'm currently using c++11. The way I would solve this problem in Java is: ...
(1) odpowiedzi