Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ target_sources(j PRIVATE
verbs/vsb.c
verbs/vx.c
verbs/vz.c
verbs/monadic/isempty.cpp
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
verbs/monadic/isempty.cpp
verbs/monadic/is_empty.cpp

verbs/monadic/rank.cpp
verbs/monadic/same.cpp
verbs/monadic/shape.cpp
Expand Down
15 changes: 15 additions & 0 deletions jsrc/verbs/monadic/isempty.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "array.hpp"

/** @file */

/**
* @brief `0 e. $` IsEmpty
* @param jt JST (J Syntax Tree)
* @param w Input aray
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a typo

Suggested change
* @param w Input aray
* @param w Input array

* @return boolean jtrue or jfalse
*/
[[nodiscard]] auto
jtisempty(J jt, array w) -> array {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jtisempty(J jt, array w) -> array {
is_empty(J jt, array w) -> array {

if (is_sparse(w)) return jteps(jt, num(0), shape(jt, w));
return AN(w) == 0 ? jtrue : jfalse;
}
6 changes: 0 additions & 6 deletions jsrc/verbs/v.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
/* Verbs */

#include "j.h"

A
jtisempty(J jt, A w) {
if ((AT(w) & SPARSE) != 0) return jteps(jt, num(0), shape(jt, w));
return AN(w) == 0 ? jtrue : jfalse;
} // 0 e. $
A
jtisnotempty(J jt, A w) {
if ((AT(w) & SPARSE) != 0) return jtnot(jt, jteps(jt, num(0), shape(jt, w)));
Expand Down