Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Please, focus on my question. I would like to understand this code
what is the meaning of "acmer"?
haha like an acmer :)
Technically, it's more like passing by a const reference and rebinding the reference.
Agreed again about understanding the difference between call by reference or call by value :) The point I tried to make was that in an dynamic language you should be careful about the assumption that the method input is indeed a primitive type.
Not really an issue in code like this Kata of course. Unless somebody built a class that overloads & and >> :D
AFAIK functions in every dynamic language always receives a fresh value for primitive types. It only happens in the like of C/C++/C#/Rust via explicitly passed by reference (by
&
/ref
), and they're the complete opposite of a dynamic language.It's nothing "extra careful", you should obtain the knowledge to know how they behave so you can put your effort on worrying about things that actually matter instead ;-)
Agreed that it doesn't affect the outer scope's value.
However, I would argue that in a dynamically typed language, one should be extra careful about this.
Not for primitive types as they're always passed by value.
This one modifies the input variable. Isn't that considered bad practice?
It is bad practice to create a list in the sum function. A generator will not allocate memory. Also, I find x and y to be better names for points in this, i.e. math, domain.
Using package not in the standard python library like numpy, to test others is not very good.
I think we come here to train language , not the special library.
thanks. i really like list comprehensions and generator expressions so i wanted to apply them to this case.
Nice! I love one liners. Expecially when they are an upgrade with no downsides like this one.
Can you explain please what this decorator do?
Loading more items...