Data dodania Pytanie
2017-03-07 00:03 Functional way to have two toggles that turn each other off »
I have two sets of toggles that need to "uncheck" each other. I'm trying to find a more functional and clever way to go about doing this other than ju...
(0) odpowiedzi
2017-03-06 20:03 Agda: Vector Membership in Stdlib? (And how to learn stdlib in general) »
I'm dealing with strings in Agda, and I've got a vector of them. I need to check if a given string occurs in a vector (as a part of checking if a vari...
(1) odpowiedzi
2017-03-06 16:03 How to wrap a function and pass args and kwargs out of order without raising a TypeError? »
Using the below code as an example: def inner(a, b): return (a, b) def outer(func, *args, **kwargs): return func(*args, **kwargs) When out...
(1) odpowiedzi
2017-03-06 02:03 Ramda group then convert siblings to children »
In ramda.js how can I group and sort a list by a field and then move all but the first item of each group into children of that item? Eg below wher...
(4) odpowiedzi
2017-03-05 22:03 How to implement sum types in dynamically typed languages without pattern matching »
I have only a theoretical idea of Haskell's sum types. And yet I sense that they really matter in Haskell and change the way you model your data in a ...
(2) odpowiedzi
2017-03-05 22:03 Map with Strings as Keys in Agda? »
I'm having some trouble figuring out how to properly make a Map with String keys in Agda. I've got the following: import Data.AVL.IndexedMap Var = S...
(1) odpowiedzi
2017-03-05 16:03 Ramda omit key and value if they both match »
I have an object that contains some data. I’d like to pick out certain keys and then also omit a key and value if they both match. Here’s my objec...
(2) odpowiedzi
2017-03-04 20:03 Scala Monoid[Map[A,B]] »
I'm reading a book with the following: sealed trait Currency case object USD extends Currency ... other currency types case class Money(m: Map[Curre...
(1) odpowiedzi
2017-03-04 17:03 What is the best way to pass generic function that resolves to multiple types »
For the background: It's a variation on functional DI. Following Scott's post I wrote an interpreter. The twist is that my interpreter is generic and ...
(3) odpowiedzi
2017-03-04 08:03 Functional way of finding if string contains substring? »
I am new to Haskell and Functional programming and wondering how nested loops can be implemented using functional recursive iteration. In particular, ...
(1) odpowiedzi
2017-03-03 11:03 Unpack vector into function arguments »
I have a function with four parameters, e.g. fun <- function( x, a, b, c ) { sin( x * a ) * exp( -x * b ) + x * c } I'd like to convert that...
(2) odpowiedzi
2017-03-03 11:03 Can a method with external dependencies on static configuration be considered pure? »
I am having this class. <?php class Helper { private $config; public function __construct(array $config) { $this->config ...
(0) odpowiedzi
2017-03-03 05:03 Implement F# interface via tacit programming »
An idea from tacit programming is to not apply arguments to functions if it can be avoided. Why doesn't F# allow this to compile if functions are fir...
(1) odpowiedzi
2017-03-02 15:03 Function arguments for side effects »
Can I use arguments to keep functions pure? Example: const activateAUser = (user, log) => { const newUser = {...user, active: true}; log("Us...
(4) odpowiedzi
2017-03-02 12:03 Why Do We Need Maybe Monad Over Either Monad »
I was playing around Maybe and Either monad types (Chaining, applying conditional functions according to returned value, also returning error message ...
(3) odpowiedzi
2017-03-02 10:03 How to decorate an existing function or passing function objects in Powershell? »
Lets say I want to save the output of a Powershell command to file. I would do this like ls | out-file "path.txt". I make this call a few times per d...
(1) odpowiedzi
2017-03-01 15:03 Java 8: Type inference fails when mapping objects to method references »
I have an array of objects of classes that extend this abstract class in a variable handlers: public abstract class RequestHandler { public bool...
(0) odpowiedzi
2017-03-01 12:03 Haskell - finding smallest Element in list »
I have a function that gets a List and has to return the smallest Element of it. Unfortunately I keep getting the issue: Parse error in pattern...
(2) odpowiedzi
2017-03-01 10:03 Java8, convert for loop with a condition to lambda »
Java 8. Converting a forEach loop into a lambda expression is understood, at least for me. Converting a for loop based with a condition, in the other...
(2) odpowiedzi
2017-02-28 20:02 multiple filters in a single iteration »
Suppose I have a list of tuples like so: [["type_2" "val_x"] ["type_1" "val_y"] ["type_1" "val_z"]] I'd like to filter them, so that I have two se...
(2) odpowiedzi
2017-02-28 14:02 Haskell - Print tree data: Non-exhaustive patterns in function toList »
I have a tree that is represented by a data structure: data Tree a = Node (Tree a) (Tree a)| Leaf a t1 :: Tree Int t1 = (Node (Node (Leaf 23) (Leaf...
(1) odpowiedzi
2017-02-28 13:02 Can functors or monads respectively be expressed solely with higher order functions? »
I'm attempting to implement functors in Javascript without using container types ([]/{}). Hence, I solely utilize pure higher order functions to const...
(1) odpowiedzi
2017-02-27 22:02 Kotlin function reference »
Let records be stream/collection and extract function which transforms data form an element of such collection. Is there a way in Kotlin to write r...
(2) odpowiedzi
2017-02-27 22:02 Finding the "most" correct value using Java 8 Predicate »
and thanks for checking out my question! I'm having a little trouble wrapping my head around using Streams with multiple predicates being applied in ...
(1) odpowiedzi
2017-02-27 02:02 Why there is no primitive BiConsumer in java 8? »
I am new to Java 8 and I can't find any primitive BiConsumer (IntBiConsumer etc), However There is a ToIntBiFunction which is the primitive specializa...
(1) odpowiedzi
2017-02-26 22:02 mapping and filtering chaining »
The data looks like this [{time: '09:00', 'level':'x3', 'type':'ae'} time: '10:00', 'level':'x6', 'type':'fe'} time: '09:00', 'level':'y3', 'type':'h...
(3) odpowiedzi
2017-02-26 20:02 How do you detect key presses on a Racket web application? »
I've been through the documentation for web-servers and can't find anything on it. Here's my code for a basic web application: #lang racket (requir...
(1) odpowiedzi
2017-02-26 14:02 Should I write code that takes advantage of Intellisense? »
I am starting with F# and made some progress in understanding the syntax. However, I remain unclear about the best way to use F#'s features. In Python...
(2) odpowiedzi
2017-02-25 23:02 haskell parallel programming »
import Data.List genkstrings :: Int -> [String] -> [String] genkstrings k [] = [] genkstrings 1 (s:ss) = [ [c] | c <- s ] ++ genkstrings 1 s...
(0) odpowiedzi
2017-02-25 16:02 In Javascript why can't I replace x => f(f)(x) by f(f)? »
I was trying to implement the Y combinator in Javascript. I managed to implement the following: const y0 = gen => (f => f(f))( f => gen( x ...
(2) odpowiedzi
2017-02-25 00:02 passing a function to a function SML »
Below is SML code to compute a definite integral using the trapezoidal method given input f=unary function, a & b=range to take integral under, an...
(1) odpowiedzi
2017-02-24 23:02 Is Haskell's Laziness Preserved at Compilation? »
So I'm new to this whole functional programming deal. In my recent adventures to learn about Haskell, I've come across a curious question. I'm aware t...
(1) odpowiedzi
2017-02-24 10:02 Error in the implementation of Functor for my datatype »
When I define following Functor for Maybe , it works fine instance Functor Maybe where fmap func Nothing = Nothing fmap func (Ju...
(1) odpowiedzi
2017-02-24 10:02 Scala: common practice for writting foldLeft »
In functional programmming, there are two important methods named foldLeft and foldRight. Here is the implementation of foldRight sealed trait List[+...
(2) odpowiedzi
2017-02-23 18:02 OCaml: How to decode unicode-escape string? »
Given a str as following: let str = "#include \\u003Cunordered_map\\u003E\\u000D\\u000A" How do I decode unicode-escape string into a unicode strin...
(1) odpowiedzi