codereport / jsource

J Language Source Code. Livestream links ⬇️
https://www.youtube.com/playlist?list=PLVFrD1dmDdvfVhYLU_iKkV67X9XqCJLWe
Other
38 stars 20 forks source link

Convert isempty to C++ #208

Open herwinw opened 3 years ago

herwinw commented 3 years ago

A branch I had around. It's pretty much a direct copy from the C function, with a few remarks:

juntuu commented 3 years ago

About the first point: jteps(jt, needle, haystack) implements x e. y which is "member in". So in english, for sparse array jtisempty checks if zero is in the shape of the array (as the comment also says in j).

Generally the functions often have commented the corresponding j phrase, if not t.c is good place to check for primitives. Here for example jtrazein is the monadic case, and jteps is dyadic case of e.. https://github.com/codereport/jsource/blob/de91efce021f9e184113527d01a1e3bb373b3079/jsrc/t.c#L816 (and j nuvoc to see what the primitive does)

herwinw commented 3 years ago

That makes more sense than the epsilon how I read it