Does automatic returning affect performance?
There’s a bunch of languages that automatically return the last value in a function (mostly functional) like Ruby, Haskell, Lisp, etc.
Why can’t we write nested shorthand functions in Clojure?
I tried to evaluate a Clojure expression with nested shorthand functions today, and it wouldn’t let me.
Returning status code where one of many errors could have occured
I’m developing a PHP login component which includes functions to manipulate the User object, such as $User->changePassword(string $old, string $new)
What I need some advice with is how to return a status, as the function can either succeed (no further information needs to be given) or fail (and the calling code needs to know why, for example incorrect password, database problem etc.)
Why store a function inside a python dictionary?
I’m a python beginner, and I just learned a technique involving dictionaries and functions. The syntax is easy and it seems like a trivial thing, but my python senses are tingling. Something tells me this is a deep and very pythonic concept and I’m not quite grasping its importance. Can someone put a name to this technique and explain how/why it’s useful?
Is it a good idea to provide different function signatures that do the same thing?
Here is a C++ class that gets constructed with three values.
How can “hash functions” be used to implement hash maps at all?
My understandment is that hash maps allow us to link, say, a string, to certain memory location. But if every string were to be linked to a unique place in memory it would need a huge block of empty memory. I don’t get it.
Why is Today() an example of an impure function?
It seems like, when reading something like this Wikipedia article about “pure functions”, they list Today()
as an example of an impure function but it seems pretty pure to me. Is it because there is no formal input argument? Why is the actual time of day not treated as the “input to the function” in which case if you gave it the same input, i.e. executed today()
twice at the same time, or traveled back in time to execute it again (maybe a hypothetical 🙂 ), the output would be the same time. Today()
never gives you a random number. it always gives you the time of day.
Why Java does not allow function definitions to be present outside of the class?
Unlike C++, in Java, we cannot have just function declarations in the class and definitions outside of the class. Why is it so?
Renaming long named method in C# [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for […]
LOOP-computable functions
I was just reading a chapter about LOOP-computable functions and I have the following question: Is it possible to numerate every LOOP program with an algorithm?