Data dodania Pytanie
2017-09-27 22:09 Remove Promises that Return Undefined »
I'm trying to figure out how to filter out promises that are executed via Promise.all and return undefined. I provided an example below. I know I can...
(1) odpowiedzi
2017-09-27 21:09 Forming a tree with this format in DrRacket (or Scheme) »
So I am using DrRacket and have a struct defined as: (define-struct thing (a b)) Then, I have an example tree of this format: (define v (make-th...
(2) odpowiedzi
2017-09-27 05:09 Pseudo Code for a minimal height binary tree? »
I am trying to write code that takes in a number and makes a minimal height binary tree with that many vertices. The language I am using is a function...
(0) odpowiedzi
2017-09-26 22:09 How to return a lazy sequence from a loop recur with a conditional in Clojure? »
Still very new to Clojure and programming in general so forgive the stupid question. The problem is: Find n and k such that the sum of numbers up to...
(4) odpowiedzi
2017-09-26 20:09 Ad hoc polymorphic functions »
I have some data that I'd like to print (some is Maybe and some is not), and I'm trying to create a generic showField function as follows: showField ...
(2) odpowiedzi
2017-09-26 10:09 Updating named-function variable inside anonymous function Elixir »
I'm new to Elixir and trying to solve guitar tab problem. My code: def sumTabs([head|tail], result) do nextLine = hd(tail) tail = Li...
(1) odpowiedzi
2017-09-25 23:09 Missing parameter type for expanded function with underscore »
I'm trying to make function that compose itself - def genericComposition[T](f: T => T, g: T => T) = { def call(x: T) = g(f(x)) call _ }...
(2) odpowiedzi
2017-09-25 13:09 Java 8 streams - map element to pair of elements »
I have a stream of elements. I want to map each element to two different elements of the same type so that my stream will be two times longer in conse...
(2) odpowiedzi
2017-09-25 10:09 immutable functional data structure to represent graphs »
I (almost) fully understand the Zipper data structure for trees. However, in some publications I saw hints that it is also possible to use the Zipper ...
(0) odpowiedzi
2017-09-24 22:09 Randomize a List in Haskell »
I'm trying to, given a list, create a random arrangement of that elements in Haskell. I already tried the algorithm in Javascript and it worked. I'm p...
(2) odpowiedzi
2017-09-24 19:09 Returning Future[Int] from Future[Option[Int]] with support of Failing the future »
I have the below block of code. My intent is to do some processing with the method params and return Future[Int] or fail the Future. I want to fail th...
(1) odpowiedzi
2017-09-24 11:09 plai-typed : how to define function type? »
I'm playing with plai-type language. I have a function which should consume a predicate function (returning true or false) and a list of items. My co...
(1) odpowiedzi
2017-09-23 22:09 Why doesn't a prism set function return an Option/Maybe »
In functional optics, a well-behaved prism (called a partial lens in scala, I believe) is supposed to have a set function of type 'subpart -> 'pare...
(2) odpowiedzi
2017-09-23 16:09 Haskell - Understanding where and pattern matching »
Im trying to create a sum function in haskell. I'm doing this to get more familiar with the language. I've defined it as so: mysum :: [Integer] ->...
(1) odpowiedzi
2017-09-23 15:09 React router v4 - Authorized routes and components »
I have a problem to prevent unauthorized users from accessing authorized-only routes/components - such as logged in users dashboard I have the follow...
(1) odpowiedzi
2017-09-22 09:09 How to merge two different collections with functional style »
I have two collections: val one = Seq(("1", 123), ("3", 555), ("2", 31)) val two = Seq("1", "4", "2") I need to append second seq to first (order ...
(2) odpowiedzi
2017-09-22 06:09 Writing scheme function to double an element in a list given a character to search for »
My goal is to write a function named (double ALIST ELEM) that accepts a list of elements and returns that list where every occurrence of ELEM (any sch...
(1) odpowiedzi
2017-09-22 01:09 convert javascript es6 class to functional programming style »
I have a class that wrote in reactjs, but would like to convert to function using functional programming and not OOP. Anybody tell me how? Follow my ...
(2) odpowiedzi
2017-09-21 13:09 Build Json from an array of objects »
I'm trying to use typescript to build a json object from an array of objects like this one:[ [ { attribute: 'a', modifier: 121 }, { attribute...
(3) odpowiedzi
2017-09-20 23:09 Finding the size of a list that's too big for memory? »
Brand new Haskell programmer here. Just finished "Learn you a Haskell"... I'm interested in how large a set is that has some particular properties. ...
(3) odpowiedzi
2017-09-20 15:09 What is the role of the this variable when it comes to function currying using the .bind()? »
I came across to the following JS code (ES5) and I don't really I understand what is the meaning of the this variable. function multiply(a,b){ retu...
(5) odpowiedzi
2017-09-20 01:09 How do I use :: when pattern matching in OCaml »
let rec (l:int list) f int list = match l with | [] -> [] | hd::tl -> 2+tl I want to know is hd the first element and then tl is the sec...
(2) odpowiedzi
2017-09-19 08:09 Functional programming on nested arrays »
I'm trying to do more and more functional programming instead of imperative programming. Let's say I have a nested array data structure and I want to...
(1) odpowiedzi
2017-09-19 07:09 Java 8 lambda style wrapper for JDBC statement execution »
I have some wrapper class for JDBC statement execution with many methods like following: public ResultSet executeQuery(String sql) { try (Stateme...
(1) odpowiedzi
2017-09-19 04:09 Finding a map in list/vector of maps in Scala »
I have a vector/list of maps (Map[String,Int]). How can I find if a key-value pair exists in one of these maps in the list of maps using .find? ...
(2) odpowiedzi
2017-09-18 19:09 Elm decrement counter while iterating array »
I've recently decided to take a more in depth look at functional programming and I decided to start out with Elm. I'm very inexperienced at this so I...
(1) odpowiedzi
2017-09-18 14:09 sorting an array and comparing it to the original »
I'm trying to fully understand functional programming when sorting an array why does the original array change to the sorted array also? I want to ch...
(6) odpowiedzi
2017-09-18 12:09 Using functional programming with ggplot »
I'm not really used to use functionals and I cannot get ggplot to work with them. For some reason this works: function_factory <- function(x){ ...
(1) odpowiedzi
2017-09-17 14:09 How to map a function with additional parameter using the new Dataset api in TF1.3? »
I'm playing with the new Dataset api in Tensorflow v1.3. It's great. It is possible to map a dataset with a function as described here. I just interes...
(0) odpowiedzi
2017-09-17 04:09 Filtering list of tuples - better readability »
What is a good way( read better readability) to filter a list of tuples. I'm using tupleList.filter(_._2).map(_._1) But this does not feel readable...
(3) odpowiedzi
2017-09-17 00:09 Trying to replicate the elements in a list n times in OCaml »
I'm trying to write a function that would take an input like : repeat 3 [1;2] ;; and display something like: [1;2;1;2;1;2] Now the code I...
(2) odpowiedzi
2017-09-16 13:09 How do you compose functions in PureScript? »
Tried to use (.) for function composition, but it doesn't work. import Data.String (length, trim) trimmedLength :: String -> Int trimmedLength = ...
(1) odpowiedzi
2017-09-16 08:09 haskell syntax confusion -- function type declaration »
I am trying to learn haskell by going through the learn you a haskell book. I came across a function which confuses me a bit and would like to look fo...
(1) odpowiedzi
2017-09-15 21:09 Invoke Instance Method Reference On Instance Argument »
In Java is it possible to, given a non-static method reference, and an instance of the class, somehow communicate that you would like that class insta...
(1) odpowiedzi
2017-09-15 16:09 Parsing JSON haskell »
I am trying to access the inner Object in my request. This is my code: {-# LANGUAGE OverloadedStrings #-} import Network.Wreq import Control.Lens i...
(1) odpowiedzi