Data dodania Pytanie
2016-12-24 12:12 Nested functions performance (F#) »
Are there any performance issues with nested functions in F#? If I have a function which is called on every item in an array, and this function has n...
(1) odpowiedzi
2016-12-24 07:12 How can I search through a 2D array without for loops? »
I have a Vec<Vec<char>> and I want to find all the x,y positions of a specific character, let's say 'x'. I can use a double for loop with ...
(1) odpowiedzi
2016-12-23 21:12 How can I write the factorial function with reduce and range? »
function range(start, end) { var acc = []; for (var i = start; i < end; i++) { acc.push(i); } return acc; } Using the range function ...
(5) odpowiedzi
2016-12-23 08:12 Converting functors (F[A] => G[A]) in Scala (cats or scalaz) »
Is there a typeclass in Cats or Scalaz that converts between different container types? For example Option ~> Try Try ~> Future Try ~> Either Opti...
(1) odpowiedzi
2016-12-23 07:12 How does Scala return in function »
I implemented to find max value in the list. I know that in Scala, You don't have to use 'return', just drop it. So I wrote like this, def max(xs: L...
(2) odpowiedzi
2016-12-22 23:12 r remove outliers from a list of data.frames and make a new list of data.frames? »
I have a List of 6 in a data.frame It has 3 columns: id, T_C, Sales T_C is TEST or CONTROL Someone helped me here and I learned how to find the me...
(1) odpowiedzi
2016-12-22 17:12 Warning on mutable Java variables in Eclipse »
I'm interested in moving toward more functional constructs in Java, and was wondering if there was a way in Eclipse to have it warn if I have mutable ...
(1) odpowiedzi
2016-12-22 16:12 Haskell getting value of Either from Get monad »
I am a Haskell noob feeling stuck on a rather simple function I am attempting to perform. Ultimately my goal is to read a strict ByteString, use the ...
(1) odpowiedzi
2016-12-21 23:12 How can I map list.__contains__? »
I'm trying to map the list.__contains__, but am getting the following error In [31]: map(list.__contains__(3), [[1,2],[1,3]]) -----------------------...
(1) odpowiedzi
2016-12-21 17:12 Why don't more languages use an immutable model like Clojures? »
Most of my understanding of how clojure handles immutables comes from this. This seems really clever to me; it makes things like copying and changing ...
(1) odpowiedzi
2016-12-21 15:12 Why does not Clojure allow us to write functions unordered? »
One of the things that I don't like in Clojure is that I need to define functions in order like this: (defn a [] 1) (defn b [] (+ 1 (a))) If Clo...
(1) odpowiedzi
2016-12-20 17:12 repl/source function does not work in Clojure »
I'm trying with files not REPL. Here is my clj file: tests.my-clj-file.clj (ns tests.my-clj-file (:require [clojure.repl :as repl])) (defn m...
(2) odpowiedzi
2016-12-20 10:12 What special rules does the scala compiler have for the unit type within the type system »
The Unit gets special handling by the compiler when generating byte code because it's analogous to void on the jvm. But conceptually as a type within ...
(3) odpowiedzi
2016-12-20 08:12 Coursera Scala SBT submission issues »
I am a current student at the EPFL functional programming in SCALA course on coursera. I have successfully passed the first course by submitting my as...
(0) odpowiedzi
2016-12-19 23:12 How does lazy-evaluation allow for greater modularization? »
In his article "Why Functional Programming Matters," John Hughes argues that "Lazy evaluation is perhaps the most powerful tool for modularization in ...
(1) odpowiedzi
2016-12-19 23:12 How to force a compile time function's argument to be of a specific type in Scala? »
Is there a way to force setting compile type of a function argument to an expected type defined in a function's signature when we only known that obje...
(1) odpowiedzi
2016-12-19 08:12 Why is the following scala experimental code not working? »
I'm trying to define a generic add function to numeric values: def add[A](x:A, y:A): A = { x + y } console:16: error: type mismatch; found : ...
(2) odpowiedzi
2016-12-18 18:12 Common lisp workin with list »
my task is to count all element within a list, which have duplicates, eg ( 2 2 (3 3) 4 (3)) will result in 2 (because only 2 and 3 have duplicates) Se...
(1) odpowiedzi
2016-12-18 17:12 Rank-1 Type requires Rank2Types extension »
Haskell wiki page on Rank-N-Types tells that this type forall a . a -> (forall b . b -> a) has Rank 1. I believe in this fact and it seems qu...
(1) odpowiedzi
2016-12-18 09:12 java 8 - declare method to use in map, and pass the value to the method later on »
I want to be able to declare methods in map to use up-front BUT, specify the parameter to pass to the function NOT when declaring the map and implemen...
(2) odpowiedzi
2016-12-18 06:12 Is it possible to chain Lodash Array methods with es6 Array methods »
I want to chain Lodash Array methods interchangeably with ES6 Array methods without using _chain and in a Functional Programming style. I want to do ...
(1) odpowiedzi
2016-12-17 16:12 Scala: Higher order function to return the union of sets »
I am working on the following scala higher order function: def after(M: Set[Expression], n: String): Set[Set[Expression]] = { M.map((expr: Expression...
(1) odpowiedzi
2016-12-16 15:12 Remove properties from the object with value equal to zero »
removeZero({ a: 0, b: 1, c: -1 }) output: removeZero({ b: 1, c: -1 }) I'm trying to write a function in the functional programming approach which ...
(3) odpowiedzi
2016-12-16 10:12 Functional programming alternative to buffering recursive foreach loop output »
I want to turn an associative array $a = array("key0" => array("key1" => "val0", "key2" => "val1"), "key3" => "val2") into a string $s = "...
(2) odpowiedzi
2016-12-16 06:12 How does fun.call work when the value of thisArg provided for the call to fun is a Function.prototype object? »
Below are two ways of defining methods on objects created with the new keyword. I'm attempting to compare the workings and effects of each. 1) A func...
(3) odpowiedzi
2016-12-15 13:12 Array.prototype.Map - C# IEnumerable Equivalent »
I can't figure out on how to map a list of string in c#, can I have something similar this js: var items = [12, 23, 14, 15, 65, 66, 33]; var ids ...
(1) odpowiedzi
2016-12-15 11:12 How do I compare two ASCII strings in Coq? »
I want to compare two ASCII strings s1 and s2 in Coq. It seems like the standard library contains no functions for this purpose? What is the canonic...
(2) odpowiedzi
2016-12-15 02:12 Racket interface & file input/output »
I'm creating an application that displays a GUI, where there's a simple text editor and few buttons. I'd like that once the text is written in the edi...
(0) odpowiedzi
2016-12-14 22:12 How to check for empty list in pure (untyped) lambda calculus in DrRacket? »
I'm trying to build lists in pure lambda calculus (actually Binary Trees masquerading as lists (in the form of [Root, [Left SubTree], [Right SubTree]]...
(1) odpowiedzi
2016-12-14 19:12 How to do this in a functional way in JavaScript using Lodash? »
I'm new to functional programming and I'm trying to refactor my code to have no side-effect. let keywords = _.get(content, '[0].keywords', []); keyw...
(1) odpowiedzi
2016-12-14 09:12 Scala version of Ramda's 'when' »
I often come across situations where I have an object which I'd like to modify only if a certain condition is true. Something like the following: if ...
(0) odpowiedzi
2016-12-13 23:12 How do you sum numbers in a list of structs? (Racket) »
I'm trying to sum all integers in a list of structs using a recursive function but cannot for the life of me figure it out. (struct number (int)) (d...
(2) odpowiedzi
2016-12-13 23:12 How to implement linear flow with IO and Either functors in funcitonal programming with javascript? »
Result: linear flow like getFile(filename).map(parseJson).map(doOtherThings)... When I'm using Either itself everything is nice and easy function do...
(1) odpowiedzi
2016-12-13 21:12 Is there an elegant way to chain join() after a foreach()? »
I am trying to write something like this: DOMElement .innerHTML .toLowerCase() .split(' ') .forEach(function(word) { return word.charAt(0).toU...
(1) odpowiedzi
2016-12-13 13:12 Idiomatic Scala for nested loop »
I am trying to write idiomatic scala code to loop through two lists of lists, and to generate a new list containing only the differences of the two li...
(2) odpowiedzi