🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.apl
Article #208

Re: APL structure

#208
From: Lee Dickey
Date: Mon, 02 Jun 1986 16:19
49 lines
2518 bytes
> Could you explain what you mean by this?  What is "direct definition"?

The concept of direct definition of APL functions was invented by
Dr. Kenneth Iverson, the inventor of APL (now working with I.P.Sharp
Associates in Toronto).   There are two general forms of definition.
They are

          fun : expr
          fun : expr_f : cond : expr_t

Direct definition always creates a function that returns a result.  For
the first form, the value of the result is the value of the expression "expr".
For the second form, there are two possibilities, depending on the value of
the condition.  If "cond" is true, the value of the result
is the value of "expr_f".  Otherwise it is the value of "expr_f".

Functions defined either way can be dyadic, monadic, or niladic.
A dyadic function (one with two variables) is defined if both the symbols
"a (alpha) and "w (omega)  are present in the condition or the expressions.
for the variables.  A monadic function (one variable) uses the
"w but  not the "a .   A niladic function (no variables) does not
include either the "a or the "w .

Here are two simple examples, written for a simulator.  The function 
that simulates the Direct Definition is called "ddef" and it accepts
a character string.  (On a system that has real direct definition,
the "ddef '" and "'" are omitted.)

               ddef 'plus: "a  + "w  '
               2 plus 3
          5

Here is the second example.  It shows a uses of the second form,
creating the mathematical FACTORIAL function.

               ddef 'fact : "w  "x  fact "w  -1 : "w  =1 : 1
               fact 1
          1
               fact 3
          6
               fact 4
          24
               fact 5
          120

Here the "x  stands for APL multiplication.  Sorry about the need
for escape sequences.
Both of these example are dyadic; you can have 4 other types, in addition
to the two types given above.
Technical Details
Message-ID: <408@water.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!caip!princeton!allegra!ulysses!burl!clyde!watmath!watnot!water!ljdickey
References: <1477@mmintl.UUCP> <858@bentley.UUCP> <400@water.UUCP> <1517@mmintl.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!caip!princeton!allegra!ulysses!burl!clyde!watmath!watnot!water!ljdickey
From: ljdickey@water.UUCP (Lee Dickey)
Newsgroups: net.lang.apl
Subject: Re: APL structure
Message-ID: <408@water.UUCP>
Date: Mon, 2-Jun-86 12:19:00 EDT
Article-I.D.: water.408
Posted: Mon Jun  2 12:19:00 1986
Date-Received: Wed, 4-Jun-86 07:16:35 EDT
References: <1477@mmintl.UUCP> <858@bentley.UUCP> <400@water.UUCP> <1517@mmintl.UUCP>
Organization: U of Waterloo, Ontario
Lines: 49