Data dodania Pytanie
2017-11-28 17:11 Active pattern - Check list for consecutive elements »
So as a school assignment, I have to write a partial active pattern which recognizes a poker hand, for example: let (|FullHouse|_|) (x: (string * str...
(1) odpowiedzi
2017-11-28 16:11 Map application in scheme »
I am trying to understand procedure application and computation order in scheme. I have the following code: (map map (list map) (list (list list)) '(...
(1) odpowiedzi
2017-11-27 18:11 andmap in Haskell? »
In Racket, there is a really useful built in function andmap that lets see if a function evaluates to true on every element of a given list, as follow...
(2) odpowiedzi
2017-11-27 14:11 Why does my function composition implemented by reduce returns a closure? »
I want to derive a composition function for n-functions from reduce/fold, but it doesn't work as expected: $id = function ($x) { return $x; }; $co...
(2) odpowiedzi
2017-11-27 09:11 Convert array of objects to one Object using ramda.js »
I have an array: var a = [ {id: 1, val: 'a'}, {id: 2, val: 'b'}, {id: 3, val: 'c'}, {id: 4, val: 'd'}, ] And I want to get transfor...
(6) odpowiedzi
2017-11-26 23:11 Using `.of` Constructor on Sanctuary Maybe »
I'm working through a tutorial on functional programming that shows the following code example using the sanctuary.js library: var S = require('sanct...
(2) odpowiedzi
2017-11-26 16:11 Higher Order Function invocation strange behavior »
I have been playing with the code above and still don't know why is it behaving like this: function myforEach(arr, func){ for(var i=0; i<arr.le...
(2) odpowiedzi
2017-11-26 11:11 Search in the list of integers, one of the longest ordered subsets (not necessarily consecutive) ordered by growth »
Function, which finds in the list of integers one of the longest ordered increments of subscripts (not necessarily consecutive) numbers. Example: •...
(3) odpowiedzi
2017-11-25 21:11 How to Split string in f# without taking out the caracter used to split »
I'm trying to take a string like "hello world : bye world" and get ["hello world"; ":" ;"bye world"]. ...
(1) odpowiedzi
2017-11-25 17:11 functional parallelism and laziness in Scala »
Background I have been reading the book Functional Programming in Scala, and have some questions regarding the content in Chapter 7: Purely functiona...
(1) odpowiedzi
2017-11-25 08:11 Does the WHNF reduction in Haskell happen at Compile time? »
AFAIU the object file generated by Haskell compiler should be machine code. So does that object file have a representation of the original AST and red...
(1) odpowiedzi
2017-11-24 16:11 Java Pair to Constructor Reference »
I've got a List of org.apache.commons.lang3.tuple.Pairs and I want to map over them such that the resulting object accepts the two elements in the pai...
(2) odpowiedzi
2017-11-24 15:11 How can i know my FSharpPowerPack version? »
Im trying to compile some files with this MakeFile : FSPPHOME=/opt/FSharpPowerPack-4.5.0.0 FSC=fsharpc all: Program.exe SqlLexer.fs: SqlLexer...
(0) odpowiedzi
2017-11-24 02:11 Tagless final: How to create values at runtime? »
The common "initial" representation of ASTs involves building a tree with sum types. My understanding of the tagless final approach is that it involve...
(0) odpowiedzi
2017-11-23 17:11 Pattern matching with logic? »
I wonder if there is a way to do something like this (x, y < 0, z) with y < 0 There are three cases in my example y = 0, y < 0 and else. I...
(1) odpowiedzi
2017-11-23 10:11 Writing the function "once" in Elixir »
I'm coming to Elixir from primarily a Javascript background. in JS, it's possible to write a higher order function "once" which returns a function th...
(3) odpowiedzi
2017-11-23 06:11 What is the difference between generative and structural recursion? »
What is the difference between generative and structural recursion in Racket? ...
(1) odpowiedzi
2017-11-22 19:11 How to replace an element in a specific position of a list? »
I want to replace an element in a specific position of a list. I have this so far: (define alon (list 1 2 3 4 5 6 7 8 9 10)) (define pos (list 3 6 9)...
(1) odpowiedzi
2017-11-22 13:11 What are the differences between imperative and functional programming languages? »
What is the definitive answer regarding the differences between imperative languages and functional (a sub-set of declarative) programming languages, ...
(1) odpowiedzi
2017-11-22 04:11 Debug in ES6 short-hand notation - filter, map, reject or reduce »
How can I place console.log in filter, map, reduce or reject using ES6 short-hand? words.filter(word => word.length > 6); ES6 Version ...
(3) odpowiedzi
2017-11-21 19:11 Dr. Racket, help getting element from a list »
I am working on a finite state machine in Dr. Racket, and need some help extracting the next state in my transition function. Right now, I am not che...
(1) odpowiedzi
2017-11-21 18:11 Lazy compose Observables »
Say I have this Observable<A> getA() { return Observable.just(new A()); } Observable<C> getC() { // ... some expensive call return...
(1) odpowiedzi
2017-11-21 08:11 Why no `()` operator for objects? »
Lambdas (and procs) in Ruby are just objects with a call method, as in any OO language with functional programming glued on as an afterthought. There ...
(1) odpowiedzi
2017-11-20 09:11 How to define an alias in Agda's type delaration? »
My code: law : ∀ a x → ((suc a) * (suc a) ÷ (suc a) ⟨ x ⟩) →ℕ ≡ (suc a , refl) law a x = refl I think there's too many suc a and I w...
(1) odpowiedzi
2017-11-20 01:11 No var or breakable: How to "break" when a predicate is met, in an array traversal? »
How would I write this programming logic into a functional method signature? I am attempting to loop/traverse an array until a condition is met, then ...
(2) odpowiedzi
2017-11-20 00:11 Elegant Array.multipick(?) implementation »
I'd like to implement something akin to imaginary Array.multipick: Array.multipick : choosers:('a -> bool) [] -> array:'a [] -> 'a [] Inte...
(2) odpowiedzi
2017-11-19 18:11 Scala compiler does not infer type properly »
I am reading Chapter 6 of Functional Programming in Scala. I've approached the last exercise of the Chapter (i.e.: 6.11) and it makes me doubtful abou...
(1) odpowiedzi
2017-11-19 11:11 How to pass a function as predicate to another function, When name of the predicate function is received at RunTime? »
I receive the name of the function to be used as biPredicate at runtime. I want to pass around this biPredicate and evaluate, basically filter to get ...
(1) odpowiedzi
2017-11-19 00:11 What are functions with "memory"? »
I'm trying to understand what functions with "memory" are. An example would be this: ;; add : number -> (number -> number) ;; to create a funct...
(1) odpowiedzi
2017-11-18 23:11 Move through list and keep state »
I am trying to transform this pseudocode into Haskell: function whatever(list) int somestate foreach list as item if item === 1 ...
(4) odpowiedzi
2017-11-18 22:11 Modifying list elements during streaming. Good or bad? »
Following is java8 snippet uses "transformEmployeeNameToUpperCase" function to transform employee name to uppercase. List<Employee> employeesSt...
(2) odpowiedzi
2017-11-18 16:11 How to compose two Flows side-by-side? »
Is there an Akka streams combinator for doing the following (or something to that effect)? (Let's call it and for now.) (flow1: Flow[I, O, Mat]).and[...
(1) odpowiedzi
2017-11-18 14:11 How to use functional programming to iterate and find maximum product of five consecutive numbers in a list? »
I have to use functional programming to implement the following function takes in a list of numbers from 0 to 9. The goal is to find the five consecut...
(8) odpowiedzi
2017-11-18 11:11 Functional programming: list conditional branching/filtering (Javascript) »
I'm from an imperative programming background (Java) and starting to try understand FP concepts better. In particular conditional branching/filtering ...
(3) odpowiedzi
2017-11-17 13:11 How to implement this foldl0 function without helper method? »
I have following code: function foldr0(list, func) { if (list.length == 0) { return 0; } else { return func(list[0], foldr0(list.slice(1)...
(3) odpowiedzi