95 questions
1
vote
2
answers
134
views
Seeking for help illustrate this Y-combinator Python implementation [closed]
I once read this Python implementation of Y-combinator in a legacy code deposit:
def Y_combinator(f):
return (lambda x: f(lambda *args: x(x)(*args)))(
lambda x: f(lambda *args: x(x)(*args))...
0
votes
2
answers
173
views
How could this Y' be the same as this Y combinator itself?
I see this in wiki:
Y' = SSK(S(K(SS(S(SSK))))K)
And I understand why it corresponds to this lambda expression Y' = (λab.aba) (λab.a(bab))
But I don't know how can this be the same as X = λa.(λx.xx)(...
2
votes
1
answer
326
views
How Can Lisp be defined in terms of y combinator?
I'm watching a lecture SICP 7A and struggling to understand "Define Lisp as Y combinator (time 1:16:15 )"
I think I understood that expt ( calculating exponential of a number like x^n ) can ...
0
votes
2
answers
346
views
What is (Y Y), the Y-combinator applied to itself?
In Chapter 9 of The Little Schemer, the authors introduce the Y-combinator and the penultimate question asks: "What is (Y Y)". They answer: "Who knows, but it works very hard."
I ...
0
votes
0
answers
77
views
Trying to setup y combinator using C# delegate type
I am trying to write Y combinator as C# delegate so I can understand the types but I am failing. I appreciate any help or hint.
Rec<T> Y<T>(ToRec<T> f)
{
Rec<T> nested(Rec&...
2
votes
1
answer
649
views
How can I implement Y-Combinator with FnMut in Rust?
I found a implementation of Y-Combinator which supports Fn. However I want to have a version of FnMut.
However, FnMut can not be wrapped into Rc, so I wrap them in Rc<RefCell>. The following ...
1
vote
0
answers
125
views
Beta Reduction steps on Y combinator
I am new to studying Lambda Calculus as part of my CompSci degree. In the course material (this is not a graded assignment no worries!) the following beta reduction came up:
𝜆𝑓.𝑊𝑊 →𝛽 𝜆𝑓.𝑓(𝑊𝑊)...
3
votes
2
answers
119
views
Strip `FALSE` prefix from Boolean list using the y-combinator? Stumped
Given a list, e.g. (f: f FALSE (g: g FALSE (h: h TRUE FALSE))), write an operator that removes all leading FALSEs and returns only the tail that starts with TRUE. For this example the operator should ...
1
vote
2
answers
155
views
Self-reference in function definition
In this explanation of Y-combinator (https://mvanier.livejournal.com/2897.html),
(define almost-factorial
(lambda (f)
(lambda (n)
(if (= n 0)
1
(* n (f (- n ...
2
votes
2
answers
104
views
How do I manage declarations that require template parameters derived from recursive functors/lambdas?
I am attempting to build a clean and neat implementation of recursive-capable lambda self-scoping (which is basically a Y-combinator although I think technically not quite). It's a journey that's ...
5
votes
2
answers
653
views
Why does Visual Studio compile this function correctly without optimisation, but incorrectly with optimisation?
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 operates ...
2
votes
1
answer
233
views
Why does this Y Combinator using code fail to compile?
I've been reading about combinators for three days now and I finally started writing them in code (more like copying stuff from places and making sense of things).
Here's some code that I'm trying to ...
3
votes
1
answer
505
views
Y combinator in elisp
We can define a recursive function, factorial as an example, by YCombinator as follows
;;; elisp
;;; This code works. Thanks to
;;; https://www.diegoberrocal.com/blog/2015/10/12/y-combinator-in-emacs-...
0
votes
0
answers
97
views
Implementing the Y-Combinator in Swift
I was watching this talk by Jim Weirich: https://www.youtube.com/watch?v=FITJMJjASUs about implementing the Y-Combinator in Ruby, and following along in Swift.
I eventually got to this function, ...
0
votes
1
answer
232
views
Is the Y Combinator a left fold or a right fold?
The Y combinator (from the wikipedia article) is defined as:
Y = \f.(\x.f(x x)) (\x.f(x x))
so when we call Y on g:
Y g = (\f.(\x.f(x x)) (\x.f(x x))) g
= (\x.g(x x)) (\x.g(x x))
= g((\x.g(x x)) ...