Update
This commit is contained in:
parent
9c9ff9934c
commit
a179d394ea
14 changed files with 1823 additions and 1811 deletions
|
@ -218,7 +218,8 @@ Bear in mind the main purpose of this quiz is for you to test your understanding
|
|||
111. What happens in [Forth](forth.md) when you try to define a word with the same name as another already existing word? Will the old word be deleted? Or is this forbidden to do? Also say why.
|
||||
112. What's the difference between [lazy](lazy.md) and strict evaluation? Show simple example.
|
||||
113. Write code in [Brainfuck](brainfuck.md) that copies the value in current cell to the cell on to the right, while KEEPING the value in current cell. Of course you may use another temporary cell to do this.
|
||||
114. Did you enjoy this quiz?
|
||||
114. What's the first sentence of the lyrics of the [Free Software](free_software.md) Song by [Richard Stallman](rms.md)?
|
||||
115. Did you enjoy this quiz?
|
||||
|
||||
### Answers
|
||||
|
||||
|
@ -336,7 +337,8 @@ sin(x) / cos(x) - log2(2) = tg(x) - 1*, so we get *tg(x) >= 1*. So that will hol
|
|||
111. It can be done (and it's useful), the new word will shadow the old one -- i.e. invoking the word will execute the latest word of that name -- but the old word will still exist in the dictionary, so that if the new word is deleted the old one becomes accessible again. This is because the dictionary is searched from the newest entries to the oldest (it's usually a linked list starting with the latest defined word).
|
||||
112. They're both strategies for evaluating [expressions](expression.md): lazy (also *by need*) evaluates an argument ONLY once it's actually needed, while strict evaluation evaluates all arguments, even if some might not be needed. Example: let's have a function `or3(a,b,c)` which performs logical OR of three values; under strict evaluation all *a*, *b* and *c* will be evaluated and then logical OR will be performed; under lazy evaluation the function may first evaluate one argument, let's say *a*, and if it ends up being TRUE, there is no need to further evaluate *b* and *c* (the result is already known to be TRUE), so they won't be evaluated.
|
||||
113. For example `[->+>+<<]>>[-<<+>>]<<`: first we copy the current cell into TWO cells to the right -- one of them is used as a temporary cell; after this we use another loop to copy the value from the temporary cell back to the original location that we zeroes during the first copying.
|
||||
114. yes
|
||||
114. "Join us now and share the software."
|
||||
115. yes
|
||||
|
||||
## Other
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue