Data dodania Pytanie
2017-07-17 19:07 Decidable equality in Agda with less than n^2 cases? »
I've got a datatype for the AST of a programming langauge that I'd like to reason about, but there are about 10 different constructors for the AST. d...
(0) odpowiedzi
2017-07-17 07:07 Chain onto native Javascript functions »
tl;dr: How can I chain onto Javascript's map() with my own function? Like - stuff.map(i => i.key).avg() where avg() is my own function to comp...
(5) odpowiedzi
2017-07-16 22:07 How to create lazy combinations »
My question is very simple, how do I make this code lazy: /* input: [ [1, 2], [3, 4], [5, 6] ] output: [ [1, 3, 5], [1, 3, 6], ...
(2) odpowiedzi
2017-07-16 16:07 Mapping over an array of objects without affecting all object fields »
I have an array of objects which I need to parse in some way. The objects have a set of common fields and some optional fields that aren't present in ...
(6) odpowiedzi
2017-07-16 00:07 Uppercase an array of strings with Ramda »
I'm trying to use Ramda to make a point free function to uppercase an array of strings, but I'm new to this and it isn't working out. const list = ['...
(1) odpowiedzi
2017-07-14 17:07 Immutable.JS filter a collection in a deeply nested Collection filterIn »
I'am using Immutable.JS and try to filter a list which is nested in a parent collection, without using a variable. Here an example with cars collecti...
(0) odpowiedzi
2017-07-14 16:07 Java 8 Functional Programming - Passing function along with its argument »
I have a question on Java 8 Functional Programming. I am trying to achieve something using functional programming, and need some guidance on how to do...
(3) odpowiedzi
2017-07-14 04:07 Why doesn't this Idris snippet typecheck without an explicit type? »
I'm just getting started learning Idris, and I'm working through the book Type Driven Development with Idris. One of the example exercises from the se...
(2) odpowiedzi
2017-07-13 17:07 Why nested FlatMaps could blow up the stack in Scala? »
I am learning the Trampoline trick in Scala by reading this paper Stackless Scala with Free Monad, by Rúnar Bjarnason. But I got stuck in section 4.3...
(1) odpowiedzi
2017-07-13 13:07 What is the typed hole exploration development style? »
While doing the CIS194 (Spring of 2013) homework 10, I got stuck with Applicative instance of a Parser type. I seek help from Google, an I came across...
(1) odpowiedzi
2017-07-13 07:07 Storing user input information in functional programming (Erlang) using only immutable variables »
As a beginner in Erlang, I am working my way through the Programming Erlang book (2nd ed). I have a very hard time grasping how to store and periodica...
(2) odpowiedzi
2017-07-12 19:07 Scala generic function with parsing object »
I need a function like this (sorry I need null) def foo[T](json: JsonElement): T = json match { case x: JsonObject => gson.fromJson(x, classOf[T...
(2) odpowiedzi
2017-07-12 11:07 Is functional programming a type of declarative programming? »
I am aware that declarative programming just passes the input and expects the output without stating the procedure how it is done. In functional progr...
(1) odpowiedzi
2017-07-12 00:07 Haskell alternative class and empty function for guards »
Lets say I have the following ADT, data Properties a = Property String a deriving (Show,Eq) I have made the following instances for it, inst...
(1) odpowiedzi
2017-07-11 20:07 Possible to flow-annotate a point-free function? »
Given these types: type Bar = number; type Foo = { bar: Bar, }; And this point-free conversion function fooToBar: import { prop } from 'ramda'; ...
(1) odpowiedzi
2017-07-11 20:07 How to compose two functions together into 1 using FP's compose() javascript? »
How can I compose two functions together into 1 using FP's compose() here's live code: https://repl.it/JXMl/1 I have 3 pure functions: // groups By ...
(2) odpowiedzi
2017-07-11 17:07 How to combine Curry() with Vectorize()? »
Consider the following function: addAmount <- function(x, amount) { stopifnot(length(x) == 1) return(x + amount) } It can be used to add som...
(1) odpowiedzi
2017-07-10 23:07 Does "Lifting" in functional programming follows strict rules? »
I have looked into "lifting" q/a's, examples it seemed to me lift function is just like any transformation function that changes the shape (like monad...
(1) odpowiedzi
2017-07-10 19:07 Passing a function as an argument - lambda expression error? »
I am trying to create a function that accepts a list and a function as parameters and applies that function to each element in the List. Here is my at...
(2) odpowiedzi
2017-07-10 19:07 how to rescursively deep merge an array of objects »
I want to merge two arrays of objects. Those objects have the same structure, but one of them is missing the hide property. I want to copy the value o...
(2) odpowiedzi
2017-07-09 00:07 What is an Algebraic Data Type (ADT)? »
I have heard people talking a lot about Algebraic Data Types (not to be confused with "Abstract Data Types") in functional programming. All I know is ...
(0) odpowiedzi
2017-07-08 16:07 Map a collection using a predicate and two functions »
While trying to write code in a functional style, I often encounter the scenario where I want to map one collection or stream to another using two fun...
(1) odpowiedzi
2017-07-08 09:07 for loop with print in functional programming style python »
How can I change the following program in Python to functional style? from itertools import permutations for p in permutations(range(1, int(input()) ...
(1) odpowiedzi
2017-07-08 05:07 How does a programming language support both functional and object oriented programming? »
From https://stackoverflow.com/a/44981969/156458 There are two common approaches for a language to support both functional and object oriented p...
(1) odpowiedzi
2017-07-07 16:07 How to declare a function as a variable in Kotlin »
So I am trying to create a listener in Kotlin. I just want to pass a method that will be executed latter in my code. Like this: override fun setButto...
(2) odpowiedzi
2017-07-07 13:07 How do I extend this mergeWords function to any number of strings? »
Following is the mergeWords function. mergeWords [] [] = [] mergeWords [] (y:ys) = y:'\n':(mergeWords [] ys) mergeWords (x:xs) [] = x:'\n':(mergeWord...
(2) odpowiedzi
2017-07-07 09:07 Memoization of member function of Kotlin data class »
In the following Kotlin example, I'd like to "memoize" (cache the result of) the member function matches: import java.util.regex.Pattern data class ...
(2) odpowiedzi
2017-07-06 13:07 Why isn't the pattern in this code exhaustive? »
splitWith :: (a -> Bool) -> [a] -> [[a]] splitWith f [] = [] splitWith f list = pre : (splitWith f suf) where (pre, suf) = break f list ...
(2) odpowiedzi
2017-07-06 12:07 Converting the result of Func<T, IConvertible> to int in a lambda expression »
I am abstracting a bit of code, and ran into an issue with casting the result of a Func to an integer for comparison. I have a function: public sta...
(2) odpowiedzi
2017-07-06 09:07 Scala tuple function composition »
Let's say we have a 3 functions with Tuple3 result: def foo(a: String, b: String, c: String): (String, String, String) = { (s"foo_$a", s"foo_$b", s...
(3) odpowiedzi
2017-07-05 19:07 Is it possible to analyze, at compile time, when a map-like structure can be mutated in-place? »
For simplicity, suppose we extend the lambda calculus with a primitive for maps with string keys. We add two operations: set map key val and get map k...
(0) odpowiedzi
2017-07-05 16:07 Scala: Making higher kinded type with some generic type »
For example I have defined a Monad Trait like this: trait Monad[F[_]] { def unit[T](a: => T): F[T] def flatMap[A, B](fa: F[A])(f: A => F[B]...
(1) odpowiedzi
2017-07-05 05:07 How does a list comprehension in python avoid side effects? »
from python documentation : We can calculate the list of squares without any side effects using: squares = [x**2 for x in range(10)] My question ...
(0) odpowiedzi
2017-07-04 16:07 SML Common type for different structures »
I am implementing sets in Standard ML. Currently it looks like this: signature SET = sig type t type 'a set ... val map : ('a -> t...
(1) odpowiedzi
2017-07-04 15:07 Functional Programming style growing array loop »
What is the smartest way to iterate over an array that grows during iteration in javascript? I want to iterate over all added elemets, even elements a...
(3) odpowiedzi