7 ms·
I believe he is referencing the fact that the map_single function calls itself.
by davidstump 11y ago
I believe he is referencing the fact that the map_single function calls itself.
- zzalpha 11y agoGah, indeed it does! I pored over that code to find it and it was right there... The post still seems to be more about pattern matching than recursion, but at least recursion is in there somewhere!
- segmondy 11y agoActually, you are correct. There is no recursion. It's perform pattern matching, the functions might have the same name, but it's not recursive, because they are different functions. Let's pretend we can alias these functions using AS def map_single({:ok, res}) AS fun1 def map_single({:cols_and_first, cols, first_row}) AS fun2 def map_single({:zipped, list}) AS fun3 def map_single({:error, err}) AS fun4 Notice how it's called. fun1 calls fun2 fun2 calls fun3 fun4 to be recursive, a function must call itself or another function that calls it. neither of this is true. What the article is talking about is pattern matching.
- zzalpha 11y agoYup you're right. I thought they were mutually recursive but they're not.