Nota bene

NB

I was looking at the J programming language yesterday and I was amused to see that it uses “NB.” to mark the rest of a line of source code as a comment, just like # in Python or // in C++. This makes comments in J look like comments in English prose.

“NB” abbreviates the Latin phrase nota bene meaning “note well.” It’s been used to mark side notes in English for about three centuries.

Most programming languages couldn’t use “NB” or “NB.” as a comment marker because it would inconsistent with conventions for identifiers, but J’s unconventional code syntax allows it to use conventional English notation for comments.

Why J?

I was looking at J because I have a project looking at its younger sister Remora. As described in this paper,

Remora is a higher-order, rank-polymorphic array-processing programming language, in the same general class of languages as APL and J. It is intended for writing programs to be executed on parallel hardware.

J keeps the array-oriented core of APL but drops its infamous symbols. Remora syntax is even closer to the mainstream, being written like a Lisp. (Some might object that Lisp isn’t mainstream, but it sure is compared to APL or J.)

APL comment symbol

Learning about J’s comment marker made me curious what its APL counterpart was. APL had custom symbols for everything, including comments. Comments began with ⍝ (U+235D), the idea being that the symbol looked like a lamp, giving light to the poor soul mentally parsing code.

U+235D APL FUNCTIONAL SYMBOL UP SHOE JOT

The full name for the lamp symbol is “APL FUNCTIONAL SYMBOL UP SHOE JOT.” Since this section of code is explicitly for APL symbols, why not call the symbol  COMMENT or LAMP rather than UP SHOE JOT?

I suppose the comment symbol looks like the bottom of a shoe. There’s also a symbol ⍦ (U+2366) [1] with the name “APL FUNCTIONAL SYMBOL DOWN SHOE STILE”

APL FUNCTIONAL SYMBOL DOWN SHOE STILE

and so “up” and “down” must refer to the orientation of the part of the symbol that looks like ∩ and ∪. But what about “jot” and “stile”?

A jot is a small character. The name is related to the Greek letter iota (ι) and the Hebrew letter yod (י). But if ∩ and ∪ are a shoe, the “jot” is a fairly large circle. Does “jot” have some other meaning?

A “stile” is a step or a rung, as in a turnstile. I suppose the vertical bar on top of ∪ is a stile.

Related posts

[1] What is this character for in APL? Unicode includes it as an APL symbol, but it’s not included in Wikipedia’s list of APL symbols.

4 thoughts on “Nota bene

  1. APL originally ran on an IBM system that used IBM 2741 terminals for its user interface. (This was in the 1960s.) The 2741 was a computer-controlled Selectric typewriter. Its typeface could be changed using interchangeable spherical “typeballs”. There was a special APL typeball, but there weren’t nearly enough characters to support the whole APL character set, so many characters were made by overstriking two (or more!) primitive characters. The Unicode name of the comment symbol describes the characters it was composed from. The names Unicode uses for the primitive characters are idiosyncratic at best. (But so was APL.)

  2. @Tom: Thanks. I looked back at the list of Unicode APL symbols and I see what you’re talking about. Shoe, jot, and stile are components that are combined with other components.

    @John: Awesome connection to American Gothic. :)

  3. Unicode (usually) describes the symbol (including what is is composed of) rather than its usage, hence “up shoe jot” rather than “lamp” or “comment”. Btw, the diameter of the shoe should really match the toe end of the shoe so the lines overlap. See https://abrudz.github.io/SAX2 and https://abrudz.github.io/APL386 for good APL fonts.

    ⍦ is used in the NARS2000 implementation of APL for multi-set functions, see http://wiki.nars2000.org/index.php?title=Multisets#Multiset_Derived_Functions

Leave a Reply

Your email address will not be published.