I've got a specific type that uses a #bound approach but I'd like to write some general folds (using e.g. algebra families) instead of duplicating the "traversal" code.
I might have done the categorical approach (functor categories instead of algebra families) before, but that has limitations and I think I lost the code.
I posted a review of the book "Recursion via Pascal" by Jeffrey S. Rohl (1984), an overlooked little gem I recently discovered. It's one of the few books entirely devoted to recursion which, as a Lisper, gets me interested.
Many people say that #Rust is very hard to #prototype with or to #refactor. This couldn't be further from the truth! It is the exact opposite!
Let me share with you one of the most profound experiences I had with #RustLang on a casual sunday - a thread 🧵
I'm currently rewriting my #transpiler from #nom to #chumsky and until now everything has turned out great so far, until I've hit the following road block:
Implementing parsers by using #parser functions that have indirect #recursion.
Currently in the process of rewriting my #transpiler from #nom v4.2 to #chumsky v1.0.0-alpha.6 🤓
It is a lot of fun so far, but I have to say these type signatures are wild!😄
I'm still struggling with it far more than I'd like, but I guess it is just a matter of time until intuition kicks in and it will become more and more natural.
Exciting project ahead!🙂
I'm even able to parse string literals with escape sequences - something I haven't even achieved with nom!
One concept (among others!) I haven't learned yet, but will run into, is #recursion in chumsky. I know, there are good docs on it - it's just something I haven't gotten to yet.
All in all, I'm very happy with chumsky so far. Kudos to its maintainers! 🙂 🎩
Has anyone ever crafted a #TowersOfHanoi set without the sticks that works well? I'm specifically interested in one where it's immensely difficult to stack a larger disk atop a smaller one. #Recursion#Algorithms#CSEducation
#recursion is such a weird concept, but once you start to grasp it, it is rather simple, not saying I've grasped it, lol but this #python function to reverse a list wasn't too difficult for me to come up with!
numbers = [1, 2, 3, 4]
def reverse(arr, ans=[]):
if len(arr) == 0:
return ans
ans.append(arr.pop())
return reverse(arr, ans)
"A frequently missed feature of PEGs is left #recursion, which is commonly used in Context-Free Grammars (#CFGs) to encode left-associative operations. We present a simple conservative extension to the semantics of #PEGs that gives useful meaning to direct and indirect left-recursive rules, and show that our extensions make it easy to express left-recursive idioms from CFGs in PEGs, with similar results."