Essays/English Grammar

From J Wiki
Jump to navigation Jump to search

We trace the use in APL and J of terms from English grammar.


1971

R.H. Lathwell and J.E. Mezei, A Formal Description of APL, Colloque APL, Institut de Recherche d'Informatique et d'Automatique, Rocquencourt, France, 1971-09-09.

Adverb Functions

[Heading of a section on scalar extension, reduction, outer products, and inner products, but the use of the term "adverb" is not otherwise elaborated.]

1972

K.E. Iverson, Algebra: An Algorithmic Treatment, Addison-Wesley, 1972. (Preliminary edition entitled Elementary Algebra published by IBM, 1971.) Section 1.1.

Because algebra is a language, it has many analogies with English. These analogies can be helpful in learning algebra, and they will be noted and explained as they occur. For instance, the integers or counting numbers (1, 2, 3, 4, 5, 6, ...) in algebra correspond to the concrete nouns in English, since they are the basic things we discuss, and perform operations upon. Furthermore, functions in algebra (such as + (plus), - (subtract), and × (times)) correspond to the verbs in English, since they do something to the nouns. Thus, 2+3 means "add 2 to 3" and (2+3)×4 means "add 2 to 3 and then multiply by 4". In fact, the word "function" (as defined, for example, in the American Heritage Dictionary), is descended from an older word meaning, "to execute", or "to perform".

1979

K.E. Iverson, The Role of Operators in APL, APL79 Conference Proceedings, APL Quote Quad, Volume 9, Number 4, 1979-06.

It would be astonishing if a notion so fruitful as the operator did not occur in some form in other languages, both natural and formal. An operator in APL can be conceived as modifying the behavior of a function to which it is applied. If we make the obvious association between a function in APL (which performs some action on its argument) and a verb in a natural language, then an operator corresponds closely to an adverb.

1987

K.E. Iverson, A Dictionary of APL, APL Quote Quad, Volume 18, Number 1, 1987-09. Section II: Grammar.

APL has six grammatical elements:

1. Nouns, such as the numbers 3 and 5.6 , alphabetic characters or literals such as '+' and 'A' and 'a' .

2. Verbs, such as + (addition) and | (magnitude) that act upon nouns to produce results that are also nouns. The nouns to which a particular verb applies are called its arguments (a word adopted in its sense of theme, or subject). A verb may have two distinct (but usually related) meanings according to whether it is applied to one argument (to its right) or two arguments (to its left and right). For example:

   2÷5                    ÷4
.4                     .25

3. Adverbs, such as / , that act upon verbs or nouns. For example, +/ is a (derived) verb called plus across that sums any list of numbers to which it is applied, and ×/ is a verb that yields the product across all elements of a list.

When an adverb applies to a noun rather than to a verb (as in 1 0 2 / to produce a "selection" verb so that 1 0 2 / 5 8 7 yields 5 7 7)  it might well be called an adjective. However, since such production of verbs from nouns is (in English) more commonly performed by a suffix rather than by an adjective (as in deify, reify, and nitrify), we will use the term adverb for all cases.

4. Conjunctions, such as ⍤ and ¨ , which apply to two arguments, as ⌽⍤⍉ (reverse and transpose). The arguments of a conjunction may be either verbs (as in the examples above) or nouns (as in 10¨⍟ , meaning base-ten logarithm).

5. A copula, denoted by the arrow ← , and used to assign a name to a noun, verb, adverb, or conjunction. For example:

   area←4×8
   3+area
35
   sum←+/
   sum 2 3 4
9

The arrow plays the same role as the copulas "is" and "are" in English; it is usually read as "is", as in "area is four times eight" for area←4×8 , and "(the verb) sum is plus across" for sum←+/ .

A name assigned to a noun will be called a pronoun, and one assigned to a verb may be called a proverb (pronounced with a long o as in "pronoun" to distinguish it from the existing English word).

6. Punctuation, provided by paired parentheses that specify the sequence of execution just as they do in elementary algebra. Sentences must appear on separate lines, and no punctuation is used to separate them.

1989-2010

R.K.W. Hui and K.E. Iverson, J Introduction and Dictionary, Jsoftware Inc., 1989-2010. Section II: Grammar.

The following sentences illustrate the six parts of speech:

   fahrenheit=: 50
   (fahrenheit-32)*5%9
10

   prices=: 3 1 4 2
   orders=: 2 0 2 1
   orders * prices
6 0 8 2

   +/orders*prices
16

   +/\1 2 3 4 5
1 3 6 10 15

   bump=: 1&+
   bump prices
4 2 5 3
PARTS of SPEECH
50 fahrenheit Nouns/Pronouns
+ - * % bump Verbs/Proverbs
/ \ Adverbs
& Conjunction
( ) Punctuation
=: Copula

Verbs act upon nouns to produce noun results; the nouns to which a particular verb applies are called its arguments. A verb may have two distinct (but usually related) meanings according to whether it is applied to one argument (to its right), or to two arguments (left and right). For example, 2%5 yields 0.4 , and %5 yields 0.2 .

An adverb acts on a single noun or verb to its left. Thus, +/ is a derived verb (which might be called plus over) that sums an argument list to which it is applied, and */ gives the product of a list. A conjunction applies to two arguments, either nouns or verbs.

Punctuation is provided by parentheses that specify the sequence of execution as in elementary algebra; other punctuation includes  if. do. end. as discussed under Explicit Definition (:) and Control Structures.

The word =: behaves like the copulas "is" and "are" in English, and is read as such, as in "area is 3 times 4" for area=: 3*4 . The name area thus assigned is a pronoun and, as in English, it plays the role of a noun. Similar remarks apply to names assigned to verbs, adverbs, and conjunctions. Entry of a name alone displays its value. Errors are discussed in Section II.J (Errors and Suspension).

1991

R. Bernecky and R.K.W. Hui, Gerunds and Representations, APL91 Conference Proceedings, APL Quote Quad, Volume 21, Number 4, 1991-08.

A gerund is a verbal form that can be used as a noun, as "programming" in "programming is an art". The utility of nouns derived from verbs is also recognized in the realm of programming languages: for example, in C, such forms exist as arrays of "pointers to functions"; and in APL, "function arrays" have been proposed by Bernecky [2], Brown [3], Falkoff [5], Landaeta [15,16], and Piper [17].

We show that gerunds can be viewed as arrays of atomic representations of verbs, in a way consistent with APL syntax and semantics. We then describe derivations of verbs from gerunds, to perform sequencing, selection, iteration, recursion, and parallel computations; and conclude with alternative representations of verbs useful in other contexts. Illustrations are drawn from the J dialect, described in Hui et al. [7] and Iverson [12,13,14].

1991

K.E. Iverson, A Personal View of APL, IBM Systems Journal, Volume 30, Number 4, 1991-12. Section entitled "Terminology".

Although terminology was not among the matters given serious attention at the outset, it will be helpful to adopt some of the later terminology immediately. Because of our common mathematical background, we initially chose mathematical terms. For example, the sentence

b←(+\a)-.×a←2 3 5 7

illustrates certain parts of speech, for which we adopted the mathematical terms shown on the left as follows:

Functions or operators + × - Verbs
Constant (vector) 2 3 5 7 Noun (list)
Variables  a b Pronouns
Operator \ Adverb
Operator . Conjunction
( ) Punctuation
Copula

I now prefer the terms drawn from natural language, as illustrated by the terms shown on the right. Not only are they familiar to a broader audience, but they clarify the purposes of the parts of speech and of certain relations among them:

1. A verb specifies an “action” upon a noun or nouns.

2. An adverb applies to a verb to produce a related verb; thus +\ is the verb “partial sums.”

3. A conjunction applies to two verbs, in the manner of the copulative conjunction and in the phrase “run and hide.”

4. A name such as a or b behaves like a pronoun, serving as a surrogate for any referent linked to it by a copula. The mathematical term variable applied to a name x in the identity (x+1) × (x+3) equals x^2^+4x+3 serves to emphasize that the relation holds for any value of x ,  but the term is often inappropriate for pronouns used in programming.

5. Although numeric lists and tables are commonly used to represent the vectors and matrices of mathematics, the terms list and table are much broader and simpler, and suggest the essential notions better than do the mathematical terms.

6. To avoid ambiguity due to the two uses of the term operator in mathematics (for both a function and a Heaviside operator) I usually use only the terms adverb and conjunction, but continue to use either function or verb, list or vector, and table or matrix, as seems appropriate.

Glossary

Adverb + and * are plus and times; +/ and */ are sum and product. / is an adverb.
Alphabet Characters used: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Conjunction A part of speech that connects things. So, the dot "." in +/ . * connects summation with multiplication to perform matrix multiply.
Copula The copula =. in a=.0 1 2 assigns 0 1 2 to the pronoun a
Dialect J is a dialect of APL. That is, it is a variety of APL, differing in its grammar and alphabet.
Dictionary A reference source with information about the form, function, syntax, and meaning of words. A dictionary of J may be found here.
Gerund A noun derived from a verb, such as the noun "spanking" derived from the verb "to spank". J examples of gerunds may be found here; another definition is here.
Grammar A system of rules or guidelines specifying how parts of a language work together.
Inflection A graphic may be modified by one or more following inflections (a period or colon), as in +. and +: for or and nor.
Locative
Noun Any object or thing which can be acted upon, or "...the basic things we discuss, and perform operations upon."
Parsing
Passive Switching or eliminating the actor in a phrase, for instance "what was said" versus "he said".
Pronoun A type of word that stands in for a larger class of things, like using "they" or "them" to stand for a particular group, or "it" for any number of things.
Proverb
Punctuation
Reflexive
Rhematic Pertaining to the formation of words.
Sentence
Spelling
Syntax
Verb A verb applies to nouns.
Vocabulary The list of primitive words in a language (example).
Word



Contributed by Roger Hui.