Data dodania Pytanie
2017-04-10 15:04 How can I convert this large factorial function to a higher-order function? »
The following code uses a cache object outside of the factorial function. The factorial function itself is large which has too many concerns of findin...
(1) odpowiedzi
2017-04-10 13:04 Why can't Scala Collection fuse transformers? »
I am going to write a high-performance application on Scala and I am trying to figure out best practice for gaining as much performance as possible. D...
(0) odpowiedzi
2017-04-09 13:04 How this 'run once' Javascript function working? »
I took this code from the Functional Programming with JavaScript Using EcmaScript 6 book. This is how the code works. Calling doPayment() multiple ti...
(4) odpowiedzi
2017-04-09 10:04 If scala advocate immutability why it adopted actor model with its mutable nature? »
I am new in scala and actor world. This is what I've learned so far: Scala is functional programming (not purely) and people advice not to use muta...
(3) odpowiedzi
2017-04-09 10:04 Functor for GHC.Generics Comp1 (:.:) »
I'm stuck with Functor instance for composition of other functors in haskell. data Cmps f g x = Cmps {getCmps :: f (g x)} deriving (Eq,Show) -- ins...
(1) odpowiedzi
2017-04-08 18:04 Term to call a function with empty parameter »
In functional programming, what is the correct name to call a function that accepts no arguments? For example: // 2 types of execute functions type F...
(2) odpowiedzi
2017-04-08 13:04 How to use `&` in match expression? »
In Symbol and Operator Reference, the symbol & is used for: Links: Match Expressions Computes the address of a mutable value, for use ...
(1) odpowiedzi
2017-04-08 13:04 Check if number is prime in O(sqrt(n)) in Scala »
When checking if n is a prime number in Scala, the most common solutions is concise one-liner which can be seen in almost all similar questions on SO ...
(1) odpowiedzi
2017-04-07 19:04 Why does F# fail to support extending system type with its type abbreviation? »
For example, if I try to extend int, with int is not the true name of the type, this code will fail: type int with member this.IsEven = this % 2 = 0 ...
(1) odpowiedzi
2017-04-07 15:04 Functional paradigm design »
I have been asked to capture the design of the system that is implemented by applying functional programming principles in C#. Requirements for this a...
(2) odpowiedzi
2017-04-07 02:04 Non type-variable argument in the constraint when using >>= operator »
I have this simple code: module Matrix where matrix :: a -> (Int, Int) -> [[a]] matrix x (width, height) = replicate height (replicate width x...
(1) odpowiedzi
2017-04-06 17:04 Combining Maybe and IO monads for DOM read/write »
I'm trying to cook up a simple example using IO and Maybe monads. The program reads a node from the DOM and writes some innerHTML to it. What I'm hun...
(2) odpowiedzi
2017-04-06 16:04 javaslang List of Tuples2 to Map transormation »
What is the most idiomatic way to transform a Stream<Tuple2<T,U>> into a Map<T,List<U>> with javaslang 2.1.0-alpha? // in...
(2) odpowiedzi
2017-04-06 09:04 F# type obj but I want 'a »
I defined a type type 'a sexp = | E of 'a | T of ( sexp<'a> * sexp<'a> );; Example: ( "this" . (("is" . "a") . ( "s" . "expression")...
(1) odpowiedzi
2017-04-05 22:04 Does Haskell provide a way to map a function to a data member? »
I am a Haskell rookie and I often find myself having to decompose a data with pattern matching only to apply a function to one of its member and then ...
(2) odpowiedzi
2017-04-05 04:04 C# 7 - Why can't I return this awaitable type from an async method? »
Background Try<T> The application I'm working in uses a type Try<T> to handle errors in a functional style. A Try<T> instance repr...
(2) odpowiedzi
2017-04-04 22:04 With functionaljava HList, is there a way to pass each element of an arbitrary HList to a corresponding curried function? »
For example, if i had an HList: HList<A,HList<B,HList<C,HNil>>> list = ... Is there a way to apply each element to a curried funct...
(0) odpowiedzi
2017-04-04 19:04 Using array.exists() in Scala »
I am new to Scala and functional programming. I'm creating a tic-tac-toe game (Day 1 of 'Seven Languages in Seven Weeks' (book)) and I'd like to know ...
(2) odpowiedzi
2017-04-04 16:04 Option type encoding / robustness in Lisp »
(define (nth n lst) (if (= n 1) (car lst) (nth (- n 1) (cdr lst) ))) is an unsafe partial function, n may go out of range. An err...
(4) odpowiedzi
2017-04-03 22:04 languageExt Either and type inferencing »
(Related to my previous question) I'm using the language-ext library in C# and trying to get Tasks returning Either values to compose properly and ha...
(2) odpowiedzi
2017-04-03 09:04 What are the performance pros and cons for using mutation in a struct in Swift »
I have been using some functional program to avoid mutating a struct and there are no clear explanation which approach is best in terms of performance...
(0) odpowiedzi
2017-04-03 07:04 Iterative procedure with nested loops in functional paradigm »
I'm learning functional programming (in Haskell) by re-writing some of my old C++ code. One example I'm working on involves the Floyd-Warshall graph s...
(2) odpowiedzi
2017-04-02 10:04 Functional way to take element in a list until a limit in Scala »
The aim of the method is to take elements in a list until a limit is reached. e.g. I've come up with 2 different implementations def take(l: Lis...
(5) odpowiedzi
2017-04-02 09:04 Adding fields to js objects, in functional way »
I have an array of objects with a set of fields in node.js. Lets say let arr = [ {a:1,b:2}, {a:3,b:6}] I would like to extend all objects and assig...
(3) odpowiedzi
2017-04-02 05:04 How to build up a backtesting program with Mathematica? »
Given a stock {price,vary price} sequence like this: lstPrice={{4.66,-0.05},{4.69,0.03},{4.78,0.09},{4.78,0.},{4.81,0.03},{4.85,0.04},{4.78,-0.07},{5...
(1) odpowiedzi
2017-04-01 23:04 Print a trie in Ocaml »
Every function listed below works as expected. (except the last one) I'm trying to make the to_list work, I want it to return a list of char lists, b...
(2) odpowiedzi
2017-04-01 22:04 Adding a stream of numbers using ReactiveSwift »
New at ReactiveSwift and FRP in general, trying to build a small calculator app to try to get the hang of it and I'm stuck figuring out the reactive w...
(0) odpowiedzi
2017-04-01 15:04 Why does Smalltalk support first class functions, but not other functional features? »
An answer to Is Javascript a Functional Programming Language? said that: Functional programming means that the program is conceptualized as a eval...
(1) odpowiedzi
2017-03-31 20:03 Understanding Elm's Type Signature return types »
I am trying to understand elm's type signatures. What does this function return exactly? It appears to be a function that accepts no arguments and r...
(1) odpowiedzi
2017-03-31 15:03 Scheme using input parameter in inner function »
I'm new to Scheme and to functional programming in general. As part of an exercise, I try to implement a function that that takes a number n and prin...
(2) odpowiedzi
2017-03-31 11:03 Unit testing elixir functions properly »
I'm fairly new to elixir and functional programming in general and I'm struggling to properly unit test functions that are composed of other functions...
(1) odpowiedzi
2017-03-30 18:03 What is the exact difference between Fix and Self on the Calculus of Constructions? »
The Self Types for Dependently Typed Lambda Encodings paper (by Peng Fu and Aaron Stump) proposes self types, which are, supposedly, sufficient to enc...
(1) odpowiedzi
2017-03-30 17:03 Remove first element of a Stream in Java 8 »
I have generated a Stream in Java 8 with Files.walk() method from java.nio library. The problem is that the method includes by default the root path b...
(1) odpowiedzi
2017-03-30 08:03 What is the difference between Reactive Programming and Functional Programming »
I am learning Rxjs, and I just learned two concepts - Reactive Programming and Functional Programming. Are these two concepts the same thing? If not, ...
(0) odpowiedzi
2017-03-29 20:03 Spread Operator with Map and Filter »
I found this interesting problem and wanted to share with you guys. The question is : [...[0,1,...[-1,0,1].map((x)=> x+1)].filter((x)=>x)),7]...
(4) odpowiedzi