-
Notifications
You must be signed in to change notification settings - Fork 18
Convert isempty to C++ #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For now it's a direct copy of the original C code, with a nodiscard added to be on the safe side.
* Replace `A` with `array` * Use trailing return types
About the first point: Generally the functions often have commented the corresponding j phrase, if not Line 816 in de91efc
|
That makes more sense than the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🙏 just a file rename / function rename and then we will 🚢 it
verbs/vsb.c | ||
verbs/vx.c | ||
verbs/vz.c | ||
verbs/monadic/isempty.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verbs/monadic/isempty.cpp | |
verbs/monadic/is_empty.cpp |
* @return boolean jtrue or jfalse | ||
*/ | ||
[[nodiscard]] auto | ||
jtisempty(J jt, array w) -> array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jtisempty(J jt, array w) -> array { | |
is_empty(J jt, array w) -> array { |
/** | ||
* @brief `0 e. $` IsEmpty | ||
* @param jt JST (J Syntax Tree) | ||
* @param w Input aray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a typo
* @param w Input aray | |
* @param w Input array |
A branch I had around. It's pretty much a direct copy from the C function, with a few remarks:
jteps
, which confuses me a lot. I'm not even sure why it does this.AN
to something more descriptive, similar to theis_sparse
function. However, this macro is used for assignment as well (seemake_array
), so I just left the C macro here. I think the consistency here is more important.