Data dodania Pytanie
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
2017-03-17 17:03 Finding the largest power of a number that divides a factorial in haskell »
So I am writing a haskell program to calculate the largest power of a number that divides a factorial. largestPower :: Int -> Int -> Int Here...
(2) odpowiedzi
2017-03-17 16:03 Permutations with for comprehensons »
So I have a bit of a problem figuring out how to generate permutations with Scala for comprehensions. The problem is that I want to have function that...
(1) odpowiedzi
2017-03-17 10:03 Why am I receiving this error message "UnboundLocalError: local variable 'sigma_opt' referenced before assignment" »
I have a dataset that follows a lognormal distribution. If I plot the y-values against the x-values on a semilog-x axis, the distribution will appear ...
(1) odpowiedzi
2017-03-16 23:03 Ambiguous interface »
I am getting the following error when trying to compile my Haskel code Main.hs:11:1: error: Ambiguous interface for ‘Data.Matrix’: it ...
(1) odpowiedzi
2017-03-16 22:03 Partial application argument manipulation with Ramda »
This obviously doesn’t work- as always isn’t called with whenTrueValue like it does in the top implementation of whenPropTrueAlways. Is there a wa...
(1) odpowiedzi
2017-03-16 00:03 java - curry an existing static function »
To take full advantage of function composition in Java I'd like to curry some existing static functions that I commonly use. A perfect candidate for ...
(3) odpowiedzi
2017-03-15 21:03 F# - Convert a char to int »
While coding in F# for a project, I have come to a point where I want to convert a char to an int. I.e. let c = '3' c |> int //this will however g...
(1) odpowiedzi
2017-03-15 03:03 Using anonymous functions in Haskell CIS194 Week 2 Exercise 2 »
I am trying to learn haskell through the "CIS 194: Introduction to Haskell 2013" course and have run into a snag with exercise 2 in the second week. I...
(1) odpowiedzi
2017-03-15 01:03 scala inline function - "ar.reduce((x,y) => x)" works but "ar.reduce{case(x,y) => x}" doesnt »
given the following input: scala> val as = List(Array(1,2,3), Array(10,20,30), Array(100,200,300)) as: List[Array[Int]] = List(Array(1, 2, 3), Arr...
(2) odpowiedzi
2017-03-14 20:03 Lodash chaining with sortBy produces error while vanilla sort works »
Given this: let nums = [1,5,4] let sorter = (a,b) => a.property > b.property ? 1 : -1; let mapper = x => {return {property:x}} This throws...
(2) odpowiedzi
2017-03-14 15:03 How to do a groupingBy of groupingBy in java8 with a List attribute inside object »
I have class Activity { int id; ActivityType activityType; } class ActivityType { int id; } class Tournament { int id; List<Ac...
(3) odpowiedzi
2017-03-14 11:03 Application of understanding monad in real world »
I'm studying functional programming in Scala and I learnt term monad. In short monad is: trait M[A] { def flatMap[B](f: A => M[B]): M[B] } def ...
(2) odpowiedzi
2017-03-13 13:03 How to combine functions in another FP? »
I am learning function programming in JavaScript, currently I have the following code. I would like to combine this two functions in another function...
(3) odpowiedzi
2017-03-13 08:03 Refactoring an OOP "decorator" to Free monad structure(s) »
I have a bit of “legacy” Scala code (Java-like), which does a bit of data access. There’s a decorator which tracks usage of the DAO methods (col...
(2) odpowiedzi
2017-03-13 05:03 How can you combine elements of a list in sets of 3 in Haskell? »
I have a list of strings describing entities like this ["prop1", "prop2", "prop3", "prop1", "prop2", "prop3", ... ] Where prop1-3 are the propertie...
(3) odpowiedzi
2017-03-12 20:03 Is there a way to make a button in a Racket web application call a function defined within the file? »
I would like to know if it's possible to create a button that calls a function such as (define example (print "Hello")) when a user clicks a button - ...
(1) odpowiedzi
2017-03-12 15:03 Create n local bindings »
Say we have something like this: ;list L of n procedure definitions, where a procedure definition is a list in form: ;<name> <body> ;for...
(1) odpowiedzi
2017-03-12 11:03 How does this `++` implementation by `foldr` work? »
I am learning Haskell with programming in haskell from Channel 9 Lectures. In chapter 7, the professor implemented his own ++ operator using foldr by ...
(1) odpowiedzi
2017-03-11 20:03 How to map with scala constructor »
I'm working on the functional programming in Scala Coursera course; and I'm working on the exercise about Huffman coding trees. Here's the code repre...
(1) odpowiedzi
2017-03-11 12:03 Functional Programming: is foldLeft is the parent method of all functional methods such as foldRight, map, filter »
I'm learning Scala and a new comer in Functional Programming world. I see that most of all methods such as foldRight, map, filter, reduce ... always c...
(3) odpowiedzi
2017-03-11 09:03 Is there any equivalent of placeholder in Elm? »
Is it possible to write the function in the following way: find_parts: String -> List String -> List String ...
(2) odpowiedzi
2017-03-10 20:03 Scala Future not entering onComplete() »
I am trying to grab the value from a snippet of code that results in a Future, but when I run through the code, it turns out that it never enters the ...
(2) odpowiedzi
2017-03-10 16:03 using std::bind with std::reference_wrapper::get »
I'm trying to use std::bind to call std::reference_wrapper::get but I can't get it to compile. I'm sure I'm overlooking something obvious but the comp...
(1) odpowiedzi
2017-03-10 16:03 How to combine two java8 stream operations - one terminal and one lazy - into a single operation? »
I'm doing some "algebra" of Java 8's streams, that is, I'm trying to code a simple operation Op that takes two streams as inputs and yields another st...
(4) odpowiedzi
2017-03-09 13:03 how can I pass argument (names) to a function factory? »
I need to build a lot of functions with lots of different arguments, though they otherwise share a lot of code and structure. To avoid duplication, I...
(1) odpowiedzi
2017-03-09 12:03 Longest common suffix »
I I would like to find the longest common suffix of two strings in Scala. def longestSuffix(s1: String, s2: String) = { val it = (s1.reverseIterat...
(3) odpowiedzi
2017-03-09 12:03 How to time scala map functions in an aggregative fashion? »
I am having a hard to come up with a solution to time individual functions in a Scala map operation. Let's say I have the following line in my code: ...
(3) odpowiedzi
2017-03-08 14:03 Improve this code by eliminating nested for cycles »
The R package corrplot contains, among the other stuff, this nifty function cor.mtest <- function(mat, conf.level = 0.95){ mat <- as.matrix(m...
(0) odpowiedzi
2017-03-08 00:03 Can this code be refactored to a more functional programming style using hof/compose/currying/partial application/monads? »
I've just started learning about functional programming and I'm trying to put into practice what I've learned. I've got this code below and I just don...
(1) odpowiedzi
2017-03-08 00:03 Clojure: Simplifying Logical Expressions Using Several Arguments »
I am new to Clojure and attempting to write a program that is supposed to simplify logical expressions. For example: (or x false) => x (or true x)...
(1) odpowiedzi
2017-03-07 23:03 Trying to use functionals to create single-apparition list from given list Racket »
I am trying to create a list which only contains the first apparition of each given image , using functionals and a check function . define (check L ...
(0) odpowiedzi
2017-03-07 22:03 OCaml type-system subtlety: polymorphism, pointfree reverse, and nested lists »
If I define a reverse function likeso: let reverse = let rec helper out = function | [] -> out | a :: l -> helper (a :: out) l in h...
(1) odpowiedzi