Some years ago at a J conference I gave a talk comparing J with 
Mathematica. One of the things I considered was the number of built-in 
objects.

One of the points I made, which really riled Ken Iverson, was that (at 
that time) the number of such objects was not really all that different 
between Mathematica and J. And to arrive at that conclusion, I counted 
the objects in quite a different way from what you did.

Two of my points were:

(1) The verb "o." should _not_ be counted as just one such object. 
Rather, it should be counted as around 24 separate objects. After all, 
you have to pair the verb with a left argument, and each left argument 
provides a different "function" in the mathematical sense. It is no more 
correct to claim that "1 & o." and "2 & o." are just special cases of 
the same creature as it would be to claim that Mathematica's Sin and Cos 
are special cases of the same creature. In particular, you still need to 
remember in the case of J that the left argument 1 provides the sine 
function and 2 the cosine function -- which is no more (human) memory 
taxing that to remember that Sin is the sine function whereas Cos is the 
cosine function: the names of the underlying entities with Mathematica 
just differ in the prefix "co".

(2) Each J verb (and other parts of speech) that has both a monadic and 
a dyadic use should be counted as (at least) two separate objects, 
despite being represented by a single symbol. For example "<." is Floor 
when used monadically but Lesser Of when used dyadically; and these two 
underlying functions, however closely related they may be, are 
nonetheless different functions.

By my count at that time, the numbers of primitives in the two languages 
were of the same order of magnitude, or even closer.

(Today, the situation would be different, though: as each successive 
version of Mathematica is released, more and more functions that used to 
be in standard add-on packages are now available directly in the kernel.)

In any case, counting such objects is at best a truly first-order 
approximation to the complexity of a programming language -- for the 
user. Especially for novices, what may matter a whole lot more is how 
similar function names or symbols are to mathematical or other terms 
they already know. In the same way that it may be easier to learn French 
if you know another Romance language (or Latin) than to learn Russian.


On 8/4/11 12:54 PM, [email protected] wrote:

Date: Thu, 4 Aug 2011 11:13:06 -0400
From: Devon McCormick <[email protected]>
Subject: [Jprogramming] The size of J
To: J-programming forum <[email protected]>,
        [email protected]
Message-ID:
        <CAGdEmpG+S=nsrryq8cjgbtku0jnsi2ar0sdwxmusyjcqhs+...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi  -

I was reading a section in "Patterns of Software" by Richard P. Gabriel in
which he talks about "language size".  This book is one of those annoying
ones in which he seems to argue for many of the strengths of an APL but
never, based on the parts I've read, mentions APL (though he must have known
of it).

In the essay on "Language Size", he talks about how the initial
implementation of Common Lisp
"...was relatively small: 772 defined symbols, including function names,
macro names, global variables, and constants."  Much of this essay builds
the case for a small (but not too small) language being better than a large
one.  He also touches on the usefulness of arrays, in a way.

In any case, here's my count for the size of J7:

Vocabulary page: (*/10 4 3)-6
Foreign#:   0  1 2 3 4 5  6 7 8  9 11 13 15 18 128
Foreigns: +/3 20 7 7 6 7 11 5 3 42  1 21  5  7   6

Total: +/114 151  NB. Basic vocabulary symbols + foreigns.

    +/114 114 151  NB. monads and dyads - assumes all have both forms, 
but...
379
    _24 NB. not both monadic and dyadic - above letters on Vocabulary 
page...
    _22 NB. not both - letters and numerals

NB. Total:
    +/114 114 151 _24 _22  NB. monads and dyads and foreigns - univalents
333

So, 333 semantic tokens in total, by my count.

-- 
Murray Eisenberg                     [email protected]
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to