-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
posts/2020/abstractions/ #1
Comments
Beautiful article written about how concept of abstraction can be explained using simile. Just one more thing, I don't know why you would include unnecessary variables in factorial function because its as simple as- def factorial(fact): Maybe it was intended to be that way to express abstraction but all in all a good one. |
Hey, thanks for going through the post :) The factorial function in the post is a tail-recursive one. I've mentioned the difference in the block below. The last line of the function you have written is Instead, if you pass the value of factorial with each recursive call, and return only the factorial term, language compilers can perform certain optimisations in terms of skipping a reference to this call, as the function would have no more steps to perform. You can read more here: https://www.geeksforgeeks.org/tail-recursion/ |
True, it wouldn't return to the previous callee this way. Thank you for pointing it out. |
The Beauty of Abstraction
Our world is modular, made up of complex things working independently yet together - all perfect examples of abstractions. It is hence important to appreciate its beauty.
https://mohitkarekar.com/posts/2020/abstractions/
The text was updated successfully, but these errors were encountered: