7 ms·
I found it extremely confusing. It sets a challenge as a rhetorical tool, but then completely fails to honour the challenge through the bulk of the explanation
by the_other 3mo ago
I found it extremely confusing.
It sets a challenge as a rhetorical tool, but then completely fails to honour the challenge through the bulk of the explanation.
- don’t use recursion: spends multiple paragraphs implying that a function calling itself isn’t recursion
- don’t use declaration: ignoring that defining arguments to a function is declaration
I’m not saying the article is “wrong”. But I thunk I’d have preferred a plain intro to lambda calculus.
(Writing this as someone who has struggled to learn “real” functional programming the few times I’ve tried over the past 20+ years, but who very much likes using RxJS and the functional flavour of lodash and wishes I could see deeper into that black hole.)
- p4bl0 3mo agoSo it's as confusing as I thought to do it that way. I wasn't sure if I thought so because I'm already familiar with all these concepts or because this introduction is indeed convoluted. Thanks for taking the time to reply!
- mrkeen 3mo ago> don’t use recursion: spends multiple paragraphs implying that a function calling itself isn’t recursion It did the opposite. It wrote many paragraphs of code and threw each one out as soon as recursion showed up.
- the_other 3mo agoI’ll re-read it, because clearly I don’t get it. And I’d like to. My first two attempts made it seem like it was building on a function calling itself, with itself as an argument (so that it can call itself). I’m not sure how that isn’t recursion, and I didn’t read it as throwing away those approaches. But, as I say, I’ll re-read it…
- sayyadirfanali 3mo agoauthor here. the idea is to see how the Y and Z combinators come out relatively naturally given an extremely constrained context with no loops, no recursion, no bindings. the article is intentionally structured as a sequence of failed attempts that progressively reveal which phenomenon is still responsible for the recursive behaviour. in the article, i define recursion narrowly as "... call the function `fact` from inside the definition of the function `fact`". you're right that `factgen` is also not recursive but it is also rejected, but for a different reason: self-reference. declarations are banned precisely because they give a function a "name" that can be referenced later. please note that the solution which uses Z combinator (given at the end) grows from `(x => x(x))(x => x(x))`, which is NOT self-referential. it achieves self-replication by literally rewriting the content of the function twice, which is different from self-referential recursion of `factgen`. hope that clears some of the confusion.
- the_other 3mo agoThanks for replying. I think I missed the significance of your narrowed definition of recursion, and didn't apply it the way you intended when I read the article. I admit to my bad reading. I went on to discuss your article with an LLM and used the experiences I've had _using_ some functional approaches in JS to help it give me a tutorial on the combinators, to try to better understand your article and the underlying principles. I "mostly get it" now, but I will have to go over it a couple more times. You shared a thought-provoking article, even if I didn't immediately get your intended lesson out of it.