Why do we need a method to determine if a stack is empty?
>>1
Context, numb-nuts? Comprende? Now give me 20 push-ups and a reworded question.
>>2
context: stack implementation
why not? makes things clearer.
Can anyone explain to me what side-effects are?
I read about them in wikipedia, but I'm still kinda confused.
Are they bad, good, why do we care about them? A nice little practical example would be much appreciated.
They must have some side effects or they would never interact with the anything outside of themselves. You just side IO was a side effect.
Well... you don't really need a print statement, the result of whatever function you evaluate in the repl will just be returned to the interpreter and printed. But yeah, for a practical language, you need IO.
>>8
For a practical language, you need a lot more than just IO.
You need a system that allows side effects (look at monads in haskell)
Also, C doesn't have actual IO. It's all file streams writing/reading.
You can make all read calls to return EOF, and all write calls to return success without doing anything.
Replace fopen() calls with NULL macros, etc etc, and your implementation would still be valid. Not practical, but C allows it.
How do I define a CSS rule for an HTML element with just an id and not a class?
>Why do we need a method to determine if a stack is empty?
Otherwise the program might allow the user to try to take another element out, which might make the program end up in weird memory locations that it shouldn't be.
>Why do we need a method to determine if a stack is empty?
Otherwise the program might allow the user to try to take another element out, which might make the program end up in weird memory locations that it shouldn't be.
>>12
well, that was easy.
#id { text-decoration: blink; }
Run in the Python interpreter:
>>> 2 / (2.0+3)
0.40000000000000002
How did the .00000000000000002 get into that float?