5 ms·
recursion is compressing the domain so small it eats itself, crafting a small set of function is mirroring this, kinda like grammars I don't think this means a
by CyberDildonics 3y ago
recursion is compressing the domain so small it eats itself, crafting a small set of function is mirroring this, kinda like grammars
I don't think this means anything. At best it's a completely abstract claim with nothing backing it up. It isn't "compressing a domain" to do iteration differently.
afaik map and fold were defined recursively
Fundamentally they are useful because the do the iteration for you. Internally it doesn't matter if the iteration is done in a roundabout way with recursion, they aren't about recursion and don't really have anything to do with them, just because some language decides to do iteration with recursion.
that was what i was pointing at, iterators are not encapsulated enough
You keep saying iterators, I keep saying iteration, but the only difference here is that the recursive version hides the accumulation in the arguments on the function. There isn't any more encapsulation, just a variable moved into the function argument. The brevity is from haskell's type deduction, not recursion.
- agumonkey 3y agoGrammars are not iteration concepts. Map doesn't do iteration. It's not about Haskell.
- CyberDildonics 3y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... https://www.geeksforgeeks.org/python-map-function/ https://www.geeksforgeeks.org/python-map-function/ The whole point of map is that it does the iteration for you and you pass it a function. Iteration is literally the reason it exists.
- agumonkey 3y agomap predates javascript and python by decades
- CyberDildonics 3y agoWhat does that have to do with the fact that map iterates over a data structure?
- agumonkey 3y agoYou can't rely on how these languages describe mapping. Map doesn't simply iterate (that would be forEach), it creates another piece of information containing f(a) for all a in the input sequence. What would iterating over a tree yields ? what would mapping over a tree yields ? how do you define the latter ?
- CyberDildonics 3y agoYou can't rely on how these languages describe mapping. Says who? You didn't back this claim up with anything. Map doesn't simply iterate No one has ever said it 'only' iterates, you hallucinated this claim. The whole point that I've made is that just because a language like haskell uses recursion for iteration, it doesn't mean iteration and recursion are the same thing or that things that iterate have anything to do with recursion.
- agumonkey 3y ago> Says who? You didn't back this claim up with anything. Why would I need to back that up ? > No one has ever said it 'only' iterates, you hallucinated this claim. The whole point that I've made is that just because a language like haskell uses recursion for iteration, it doesn't mean iteration and recursion are the same thing or that things that iterate have anything to do with recursion. Why the mention of haskell all the time ? I'm not even talking about statically typed languages here. The original conversation was about the intellectual benefits of recursion, not iteration == recursion. Recursion is a way to think about problems that I find more general, precise, creative and economical I tried to convey why, I'm not the most precise but this is getting nowhere. Feel free to enjoy your life.
- 3y ago