You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Frequently, we need to check if the word at the top of the stack is "empty" (i.e., consists of all zeros). There are several ways of doing this and it would be good to have a single canonical way so that people don't have to reinvent the wheel. Here is one proposal:
#! Inputs: [WORD, ...]
#! Outputs: [is_empty, ...]
export.is_empty_word
eq.0 swap eq.0 and swap eq.0 and swap eq.0 and
end
This would require 10 cycles.
We could also provide a version of this which does not drop the word from the stack.
This could probably go into the sys module of the standard library.
The text was updated successfully, but these errors were encountered:
Seems like we already have is_empty_word procedure in std::utils module - but it works slightly differently from the above (it does not drop the word) and is also not documented.
I think we should rename the current is_empty_word into something like is_empty_word_cloned and add is_empty_word with the above implementation (alternatively, we can keep the current name and the new one could be called is_empty_word_dropped).
We should also document std::utils module or maybe move these procedures to std::sys module (and also document them).
Frequently, we need to check if the word at the top of the stack is "empty" (i.e., consists of all zeros). There are several ways of doing this and it would be good to have a single canonical way so that people don't have to reinvent the wheel. Here is one proposal:
This would require 10 cycles.
We could also provide a version of this which does not drop the word from the stack.
This could probably go into the
sys
module of the standard library.The text was updated successfully, but these errors were encountered: