combinators Questions

1

Solved

While searching for information on Raymond Smullyan's To Mock a Mockingbird, I stumbled upon Stephen Tetley's Haskell code for the basic combinators. I thought it was an interesting idea and decide...
Billiton asked 4/2, 2014 at 19:37

3

Solved

In Real World Haskell, they describe combinators like this: In Haskell, we refer to functions that take other functions as arguments and return new functions as combinators. And then later the...
Antilogy asked 17/11, 2013 at 5:51

3

I'm having trouble interpreting the function signature for foldl. I understand how it works, but I'm not sure how it relates to the signature. I have a few questions about its detail foldr :: (a ...
Hydrology asked 26/10, 2013 at 1:34

5

Solved

I am working through the 20 Intermediate Haskell Exercises at the moment, which is quite a fun exercise. It involves implementing various instances of the typeclasses Functor and Monad (and functio...
Unilobed asked 30/12, 2011 at 16:19

1

Solved

I've been looking into how languages that forbid use-before-def and don't have mutable cells (no set! or setq) can nonetheless provide recursion. I of course ran across the (famous? infamous?) Y co...
Cassatt asked 28/4, 2013 at 0:27

5

Solved

Is there a list of them with examples accessible to a person without extensive category theory knowledge?
Pyongyang asked 28/5, 2009 at 16:51

7

Solved

I wanted to test foldl vs foldr. From what I've seen you should use foldl over foldr when ever you can due to tail reccursion optimization. This makes sense. However, after running this test I am ...
Nevile asked 7/8, 2010 at 7:54

2

Could you please explain the meaning of the expression ((.).(.))? As far as I know (.) has the type (b -> c) -> (a -> b) -> a -> c.
Phenylamine asked 5/2, 2013 at 12:36

2

Solved

I'm trying to define a stack data structure in lambda calculus, using fixed point combinators. I am trying to define two operations, insertion and removal of elements, so, push and pop, but the onl...

2

Solved

I wrote some parser from combinatory library. I want a generic function that transform any size of nest ~ into a list. How to do this ? Here is my example of parser I use (my real parser has a ve...
Theocracy asked 7/3, 2012 at 1:7

1

Solved

;; compute the max of a list of integers (define Y (lambda (w) ((lambda (f) (f f)) (lambda (f) (w (lambda (x) ((f f) x))))))) ((Y (lambda (max) (lambda (l) (cond ((null? l) -1) ((> (...
Arkose asked 28/10, 2012 at 22:9

1

Here's the code (also here): #lang racket (define poorY ((lambda length (lambda (ls) (cond [(null? ls) 0] [else (add1 ((length length) (cdr ls)))]))) (lambda length (lambda (ls) (cond [(n...

1

Solved

Suppose you have three functions of arity 1, 2 and 3 as below: (defn I [x] x) (defn K [x y] x) (defn S [x y z] (x z (y z))) Does clojure have an evaluation function or idiom for evaluating: (I ...
Hic asked 11/8, 2012 at 23:41

2

Solved

So, I've spent a lot of time reading and re-reading the ending of chapter 9 in The Little Schemer, where the applicative Y combinator is developed for the length function. I think my confusion boil...
Pontoon asked 8/5, 2012 at 13:24

2

Solved

Recall that the K combinator is a constant function. It always returns its first argument: Kxy = x for all y In the book To Mock a Mockingbird the author presents an example of an enchanted for...

1

Solved

I now understand the type signature of s (s k): s (s k) :: ((t1 -> t2) -> t1) -> (t1 -> t2) -> t1 And I can create examples that work without error in the Haskell WinGHCi tool: E...
Wilhelmina asked 12/3, 2012 at 9:40

3

Solved

Consider this combinator: S (S K) Apply it to the arguments X Y: S (S K) X Y It contracts to: X Y I converted S (S K) to the corresponding Lambda terms and got this result: (\x y -> x ...

4

Solved

Not infrequently, one wants to implement the <=> (comparison, or "spaceship") operator on a product data type, i.e., a class with multiple fields (all of which (we hope!) already have <=&g...
Butts asked 19/5, 2009 at 12:42

1

Solved

Suppose I have two functions f :: [a] -> b and g :: [a] -> c. I have the following two questions: If I perform (f &&& g) xs where xs :: [a], and if both f and g involve loops, i...
Sowell asked 8/2, 2012 at 10:31

1

Solved

I just found the following lambda calculus expression: (((λ f . (λ x . (f x))) (λ a . a)) (λ b . b)) So that is a function that takes an argument f and returns another function that takes an arg...

2

Solved

In the process of writing a simple RPN calculator, I have the following type aliases: type Stack = List[Double] type Operation = Stack => Option[Stack] ... and I have written a curious-lookin...
Jujube asked 3/1, 2012 at 18:5

2

Solved

I'm struggling with what Super Combinators are: A supercombinator is either a constant, or a combinator which contains only supercombinators as subexpressions. And also with what Constant Appl...
Riverside asked 30/11, 2011 at 18:9

2

This function f accepts an argument list and returns another callable with the same argument list, so that other functions can be applied to it. from operator import add, mul def f(*a, **kw): re...
Headfirst asked 8/11, 2011 at 15:35

1

Solved

What is a combinator?? Is it "a function or definition with no free variables" (as defined on SO)? Or how about this: according to John Hughes in his well-known paper on Arrows, "a combinator is...
Milium asked 23/9, 2011 at 19:26

6

The following pattern appears very frequently in Haskell code. Is there a shorter way to write it? if pred x then Just x else Nothing
Schoolmaster asked 17/9, 2011 at 9:17

© 2022 - 2025 — McMap. All rights reserved.