Data dodania Pytanie
2017-02-23 17:02 How do I decorate a partially applied function in Python 3? »
I created a decorator factory that is parameterized by a custom logging function like so: def _log_error(logger): def decorator(f): @wrap...
(2) odpowiedzi
2017-02-23 13:02 Haskell, print modified list values with map »
I have written the following code, which should take a list of values and print only the values > average, modifying them as val - avg. For example...
(1) odpowiedzi
2017-02-22 21:02 Functional programming and DOM manipulation »
How is most "pure" way to manipulate DOM in script written in "functional" way. For example if I simply need to change element width should I use ty...
(1) odpowiedzi
2017-02-22 14:02 Can it be proved that call-by-need has the minimal asymptotic time complexity among all reduction strategies? »
When I read the Church Rosser II Theorem here Theorem (Church Rosser II) If there is one terminating reduction, then outermost reduction will...
(2) odpowiedzi
2017-02-22 14:02 Get next value on a map? »
I'm trying to compare element to next element in a collection. For example : let array: [(Double, String)]= [(2.3, "ok"), ...
(4) odpowiedzi
2017-02-21 18:02 How to implement Haskell's FRP Behavior type in Javascript? »
I'd like to understand the original meaning of functional reactive programming in Haskell and how it differs from the actual application of FRP in Jav...
(0) odpowiedzi
2017-02-21 18:02 Nondestructive setf? »
Common Lisp seems to go to great lengths to provide both nondestructive functions (like subst & remove) and destructive functions and modify macro...
(2) odpowiedzi
2017-02-21 03:02 Agda: Product of even numbers is even »
I am pretty new to Agda. I am working on a question from the assignment. I have got most of it but there is one goal on which i am stuck. data Arith ...
(3) odpowiedzi
2017-02-20 18:02 Javascript functional programming - Should I write functions that force currying, or use _.curry when calling instead? »
Example: Version 1: const foo = (arg1) => { return (arg2) => { return (arg3) => { return arg1 + arg2 + arg3; } } } // ca...
(1) odpowiedzi
2017-02-20 15:02 Clean functional way to break out of a sequence loop »
I have a sequential process with an optional exit condition. One way to write the algorithms is like this let mutable more = true for slot = startSlo...
(2) odpowiedzi
2017-02-20 11:02 How to make illegal values unrepresentable? »
A method of design in Functional Programming is making illegal states unrepresentable. I always see this being accomplished with the structure of type...
(5) odpowiedzi
2017-02-19 16:02 What are the advantages of Promises over CPS and the Continuation Functor/Monad? »
ES6 Promises ES6 Promises are finite state machines and thus require complex implementations. Beyond that the Promise/A+ spec comes with a lot of rou...
(1) odpowiedzi
2017-02-19 10:02 Java 8, anonymous recursive nested method »
My goal is to migrate the method getAllFields into init by re writing it as an anonymous function, I know it's quite possible using functional program...
(2) odpowiedzi
2017-02-19 10:02 How exactly works the register() method of Laravel ServiceProvider? »
I am pretty new in PHP and Laravel. I am following this tutorial to add reCAPTCHA support to a page inside my Laravel applicatin: http://tutsnare.com...
(1) odpowiedzi
2017-02-18 22:02 Generalizing DivisibleBy in type-level programming with Scala »
I'm trying to generalize a divisible-by relation in Scala using type level programming. This is my Nat number definitions: trait Nat { type plus[N&...
(1) odpowiedzi
2017-02-18 18:02 F# tree-building function causes stack overflow in Xamarin Studio »
I'm trying to build up some rules in a tree structure, with logic gates i.e. and, not, or as well as conditions, e.g. property x equals value y. I wro...
(1) odpowiedzi
2017-02-18 18:02 Why is .array necessary after .group to use .sort? »
Having the following piece of code: import std.algorithm : filter, canFind, map, splitter, group, sort; import std.stdio : File, writefln; import std...
(1) odpowiedzi
2017-02-17 21:02 Functional way to find a pair of integers, which sum to X, in a sorted array »
This is a follow-up to my previous question. Suppose I want to find a pair of integers, which sum to a given number x, in a given sorted array. The we...
(4) odpowiedzi
2017-02-17 09:02 How to judge whether a list is a sub sequence of another with java8 stream? »
For example, I have a long list [1, 2, 3, ..., 10], and a short one [1, 3, 6], then I can tell that the short one is the subsequence of another. On th...
(5) odpowiedzi
2017-02-17 04:02 Evaluation of where clause in cyclic lists »
In Thinking Functionally in Haskell (p 213), we're shown two versions of a cyclic list. One evaluates in quadratic time: iterate3 f x = x:map f (iter...
(2) odpowiedzi
2017-02-16 16:02 java8 stream style for retrieving a inner part of map through a field list? »
For example, given a map like below: { "k1": { "k2": { "k3": { "k4": "v" } } } } and a field list ["k1","k2","k3"],...
(2) odpowiedzi
2017-02-16 14:02 Scala way of applying function to list and getting highest result with input »
best_acc = 0 for split in split_candidates: acc = self.get_split_score(t_series_distances, split) if acc > best_acc: best_acc = acc...
(1) odpowiedzi
2017-02-16 12:02 How to traverse array from both left to right and from right to left? »
Suppose I have an imperative algorithm that keeps two indices left and right and moves them from left to right and from right to left var left = 0 v...
(3) odpowiedzi
2017-02-15 23:02 Partially applying <*> with zip »
I started to look at some Haskell code and found: foo :: ([a] -> [b]) -> [a] -> [(a, b)] let foo = (<*>) zip I don't understand how ...
(1) odpowiedzi
2017-02-15 20:02 Swap two array elements in a functional way »
I'm trying to swap 2 elements within an array in a functional way in javascript (es6) let arr = [1,2,3,4,5,6] let result = swap(arr, 1, 2) // input: ...
(6) odpowiedzi
2017-02-15 18:02 java8 stream style to convert a key-value list to a map? »
I want to convert a list like [k1, v1, k2, v2] to a map like {k1: v1, k2: v2}. The original code is: List<Object> params = Arrays.asList("k1", ...
(2) odpowiedzi
2017-02-14 22:02 How to reduce/transform an array of objects to result in the aggregate sum of each property (lodash ideally) »
I have an array of nutrition object that look something like this: [ { calories: {total: 0, fat: 0}, vitamins: {a: {total: 0, retinol: 0}, ...
(4) odpowiedzi
2017-02-14 10:02 How to use javascript reduce function for objects in an array to get string values »
I have an array of objects from which I would like to get names. I am trying to use reduce for that but the problem is that reduce returns the first ...
(5) odpowiedzi
2017-02-14 09:02 Can we deconstruct arbitrary data constructors? »
In Haskell, or any other programming language supporting pattern matching, can we achieve the following: Given a data constructor e.g. Left :: a -&gt...
(1) odpowiedzi
2017-02-13 22:02 What is an appropriate type for smart contracts? »
I'm wondering what is the best way to express smart contracts in typed languages such as Haskell or Idris (so you could, for example, compile it to ru...
(0) odpowiedzi
2017-02-13 08:02 Use attributes for value tuples »
In C# 7.0, .NET introduces a new return value tuple types (functional programming), so instead of: [NotNull] WrapperUser Lookup(int id) I'd like to...
(0) odpowiedzi
2017-02-13 00:02 Can't change/establish root binding of: [some-def] with set in Clojure »
I could not set my dynamic var's value to new one. (def *pop* true) (set! *pop* false) => IllegalStateException Can't change/establish root bind...
(2) odpowiedzi
2017-02-12 14:02 What does it mean that functional languages provide explicit data structure representations? »
I'm read chapter 1.13 AN INTRODUCTION TO FUNCTIONAL PROGRAMMING THROUGH LAMBDA CALCULUS and see it. What is the "explicit data structure representatio...
(1) odpowiedzi
2017-02-12 13:02 How to make a map from array of object? »
Each object has a 'id' property, and I want to make a 'id' => object map. This is easy via Guava in java world. How to do it in PHP easily? e.g. func...
(1) odpowiedzi
2017-02-12 05:02 How to understand the execution of this Haskell program? »
While I was studying the foldr function in Haskell I came across this program and I am not able to figure out how it is executing. mylength :: [ Int ...
(1) odpowiedzi