y-combinator Questions
4
Solved
This is a implementation of the Y-combinator in Scala:
scala> def Y[T](func: (T => T) => (T => T)): (T => T) = func(Y(func))(_:T)
Y: [T](func: (T => T) => (T => T))T => ...
Waterfall asked 13/1, 2016 at 19:43
17
Solved
A regular function can contain a call to itself in its definition, no problem. I can't figure out how to do it with a lambda function though for the simple reason that the lambda function has no na...
Thence asked 26/1, 2009 at 22:42
5
Solved
In almost all examples, a y-combinator in ML-type languages is written like this:
let rec y f x = f (y f) x
let factorial = y (fun f -> function 0 -> 1 | n -> n * f(n - 1))
This works a...
Slocum asked 4/1, 2010 at 9:23
2
Solved
I'm doing some experimenting with y-combinator-like lambda wrapping (although they're not actually strictly-speaking y-combinators, I know), and I've encountered a very odd problem. My code operate...
Brasilein asked 4/2, 2021 at 17:54
5
Solved
Is it possible to write the Y Combinator in Haskell?
It seems like it would have an infinitely recursive type.
Y :: f -> b -> c
where f :: (f -> b -> c)
or something. Even a simple s...
Carlile asked 25/11, 2010 at 3:6
3
Solved
This is the usual definition of the fixed-point combinator in Haskell:
fix :: (a -> a) -> a
fix f = let x = f x in x
On https://wiki.haskell.org/Prime_numbers, they define a different fixe...
Plage asked 11/12, 2018 at 0:45
2
Solved
I would like to understand in mint detail please how we managed to get from the lambda calculus expression of Y-combinator :
Y = λf.(λx.f (x x)) (λx.f (x x))
to the following implementation (in ...
Icarian asked 27/11, 2018 at 2:31
4
I believe I understand mathematically the idea of Y-combinator: it returns the fixed point of a given functional F, thus f = Y(F) where f satisfies f == F(f).
But I don't understand how it does t...
Ambala asked 8/5, 2016 at 15:39
2
Solved
I am currently, going through this article on Y-combinator by Mike Vanier.
Along the way of Y-combinator derivation, this code:
(define (part-factorial self)
(lambda (n)
(if (= n 0)
1
(* n ((...
Moorland asked 21/3, 2018 at 11:1
2
Solved
In the book The little schemer, we find this function that only supports lists with length smaller than or equal to 1:
(((lambda (mk-length) ; A.
(mk-length mk-length))
(lambda (mk-length)
(la...
Penelopa asked 3/4, 2015 at 16:22
2
Solved
In The Little Schemer book, in Chapter 9, while building a length function for arbitrary long input, the following is suggested (on pages 170-171), that in the following code snippet (from page 168...
Bubble asked 29/12, 2017 at 6:49
2
I'm trying to learn lambda calculus and Scheme Lisp. The tutorial on lambda calculus can be found here http://www.inf.fu-berlin.de/lehre/WS03/alpi/lambda.pdf.
The problem I'm facing is I don't kno...
Pinnule asked 29/8, 2017 at 5:28
1
Solved
I know I can write the y-combinator in SML like this:
First declare a new datatype to bypass the type mismatch due to circularity.
datatype 'a mu = Roll of ('a mu -> 'a)
val unroll = fn Roll x ...
Cavalryman asked 19/11, 2016 at 0:24
1
Solved
Y - Combinator
I've been trying to learn about Y - Combinators (an explanation on that would be lovely as well) and came across an example from this wiki. An in depth explanation on the subject...
Ancipital asked 11/8, 2016 at 17:18
1
Solved
I am really new to scheme functional programming. I recently came across Y-combinator function in lambda calculus, something like this Y ≡ (λy.(λx.y(xx))(λx.y(xx))). I wanted to implement it in sch...
Liquidate asked 26/5, 2016 at 19:21
1
Solved
While building a small lambda-based metaprogramming library, I had the necessity of using recursion in a C++14 generic lambda, to implement a left-fold.
My own solution was passing the lambda itse...
Binary asked 24/2, 2016 at 17:26
5
Solved
I've been reading a bit lately about functional programming and I am trying to grok the Y-Combinator. I understand that you can use the Y-Combinator to effectively implement recursion in a language...
Dannie asked 15/5, 2009 at 15:54
1
Solved
I hope you all to be fine. I'm implementing the fixed-point Y-combinator in Harbour and I'm having some troubles with it. Well, the Y-combinator can be defined by the lambda-calculus as:
Y = (λh.λ...
Jenifferjenilee asked 16/3, 2015 at 17:5
1
Solved
I'm trying to figure out how to write recursive functions (e.g. factorial, although my functions are much more complicated) in one line. To do this, I thought of using the Lambda Calculus' Y combin...
Hypabyssal asked 4/8, 2015 at 21:31
7
Solved
Is there some way to "wrap" a recursive function via a higher-order function, so that the recursive call is also wrapped? (e.g. to log the arguments to the function on each call.)
For example, sup...
Deem asked 5/1, 2014 at 13:10
2
Solved
I am new to the world of fixed-point combinators and I guess they are used to recurse on anonymous lambdas, but I haven't really got to use them, or even been able to wrap my head around them compl...
Battlefield asked 7/4, 2013 at 6:38
3
Is there a fixed point combinator for creating tuples of mutually recursive functions? I.e. I'm looking for something like the Y-Combinator but which takes multiple "recursive"* functions, and will...
Feigned asked 4/2, 2011 at 14:29
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
2
Solved
I have a function which computes a fixed point in terms of iterate:
equivalenceClosure :: (Ord a) => Relation a -> Relation a
equivalenceClosure = fst . List.head -- "guaranteed" to exist
...
Audriaaudrie asked 9/6, 2011 at 22:52
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...
Boyla asked 24/12, 2012 at 0:58
1 Next >
© 2022 - 2024 — McMap. All rights reserved.