Introduction
The first NARS (Nested Arrays Research System) was designed and
implemented in the early 1980s as a testbed for new ideas in APL,
principally with nested arrays. A quarter of a century later,
it's time to try again.
The goal of this effort, as with the last one, is to foster
new ideas about the language and its implementation.
Language ideas include new functions, operators, and
datatypes. To aid in getting your ideas into an implementation,
there will be a mechanism for telling NARS that a userdefined
APL function represents a new primitive function,
operator, or datatype. In order to experiment with your
ideas for new extensions, all you need to know is how to write
APL programs.
Implementation ideas include algorithms to enhance
code space (smaller executable), time space (faster execution
times), or expressibility (clearer and more understandable code).
A goal of the existing implementation is to be open
and easy for others to change so that new ideas may be inserted
smoothly.
Moreover, this project is made available as
Free Software
so, among other things, any developer may pick it up and add new features, and any end user
may use it free of charge.
Language Features
Current Language Features
 ISO/IEC 13751 Extended APL Compliant
 Consistent Extensions to ISO/IEC 13751
 Strand Assignment (e.g., (A B)←1 2 is the same as
A←1 and
B←2)
 Modify Assignment (e.g.,
A+←1 is the same as A←A+1)
 Modify Strand Assignment (e.g.,
(A B)+←1 is the same as
A←A+1 and
B←B+1)
 Function/operator assignment (e.g.,
F←+.× and
F←¨ and
F←∘)
 Sink (monadic ←A
to suppress the display of A)
 Unified index reference, assignment, and modify assignment:
R[L],
R[L]←A,
and R[L]f←A
allow both Reach and Scatter indexing — that is,
 if L⊃R is valid, it is equivalent to
⊃R[⊂L], and
 if L⊃¨⊂R is valid, it is equivalent to
R[L], and
 if L⌷R is valid, it is equivalent to
R[⊃∘.,/L], and
 if L⌷¨⊂R is valid, it is equivalent to
⊂¨R[⊂¨L]
Reach and Scatter indexing may appear together within a single instance of
R[L],
R[L]←A,
and R[L]f←A
 Dyadic operator jot (f∘g) (Compose) (e.g.,
f←,∘⍋∘⍋∘,)
 Axis operator allowed with primitive scalar dyadic functions (e.g.,
1 2+[1] 2 3⍴R)
 Axis operator to primitive scalar dyadic functions may transpose coordinates (e.g.,
(2 3⍴L)+[1 2] 2 3 4⍴R and
(⍉2 3⍴L)+[2 1] 2 3 4⍴R are identical)
 Axis operator to Ravel may transpose coordinates (e.g.,
,[2 1] R and ,[1 2] R
are both valid but, in general, have the same values, but in a different order)
 Axis operator is allowed on the dyadic derived function from the Each operator (e.g.,
(2 3⍴L)⍴¨[1 2] 2 3 4⍴R)
 Axis operator is allowed on userdefined functions/operators (e.g.,
FOO[2 3] R by specifying it in the
function header, as in ∇ Z←FOO[X] R)
 Axis operator is allowed in Anonymous
Functions/Operators/Hyperators
 Axis operator values may be negative.
That is, if the largest allowed value is N,
then the allowable range for axis operator values is
1 ¯1[1]N to N, inclusive
 Strand left and right arguments and result to userdefined
functions/operators along with optional left argument (e.g., ∇
Z←FOO (R_{1} R_{2} R_{3} R_{4}) or, more fully, ∇
(Z_{1} Z_{2})←{L_{1} L_{2} L_{3}} (LO OP2[X] RO) (R_{1} R_{2} R_{3} R_{4}))
 Note that braces are required to surround the left
argument of an ambivalent function as in ∇ Z←{L} FOO R
 The result of a userdefined function/operator may be marked as nondisplayable
by enclosing it in braces, as in ∇ {Z}←FOO R.
If the result part of the header consists of multiple names, either
∇ {Z_{1} Z_{2}}←FOO R or
∇ ({Z_{1} Z_{2}})←FOO R or
∇ {(Z_{1} Z_{2})}←FOO R may be used to mark
the result as nondisplayable
 Userdefined function/operator prototype entry point
(⎕PRO:)
 Userdefined function/operator identity element entry point
(⎕ID:)
 Monadic operator null (f⊙) to aid in
resolving ambiguities with slash/slope as function/operator
(e.g., use (/⊙)/3 4
instead of (/)/3 4)
 Monadic iota (⍳R) extended to negative values. For example, in origin0,
⍳¯3 returns ¯3 ¯2 ¯1
 Monadic iota (⍳R) extended to length > 1 vector right arguments
returns an array of indices whose shape is that of the right argument
(via an internal magic function)
 Dyadic iota (L⍳R) extended to rank > 1 left arguments returns an array
of vector indices to the left argument (via an internal magic function)
 Index reference, assignment, modify assignment, squad, transpose, and pick
(R[L],
R[L]←A,
R[L]f←A,
L⌷R,
L⍉R,
and L⊃R)
are each extended to negative values for L in the same way the axis operator is (see above).
For example,
A,
A[⍳⍴A], and
A[⍳⍴A], and even
A[⍳¯1 1[?(⍴⍴A)⍴2]×⍴A]
are all identical for any array A in either origin
 Monadic and dyadic domino (⌹R and L⌹R)
— matrix inverse/divide extended to use MoorePenrose pseudoinverse algorithm via Singular Value
Decomposition
 Prototypes for all primitive functions and operators
 Jot may be used as either operand to a userdefined operator in which case
the name associated with the jot inside the operator is undefined, that is,
⎕NC on the name returns 0
 Catenate identity function for reduction and inner product
 Control structures on one line or split across multiple lines
(e.g., :for I :in ⍳N ⋄ ... ⋄ :endfor).
A one line control structure may be used in immediate execution mode
 Trains are supported, e.g., avg←(+⌿ ÷ ≢) creates a
function that calculates the average of a numeric vector
 Primitive dyadic function left shoe (L⊂R) (Partitioned Enclose)
 Primitive dyadic function epsilon underbar (L⍷R) (Find)
 Reshape (L⍴R) is extended to allow a nonempty Reshape of an empty in which case the right argument
fill element is used, e.g., 2 3⍴⍬
 Primitive monadic function iota underbar (⍸R) (Indices)
 Primitive dyadic function iota underbar (L⍸R) (Array Lookup)
 Primitive monadic function not equal underbar (≢R) (Tally)
 Primitive dyadic function not equal underbar (L≢R) (Mismatch)
 Primitive monadic function down tack (⊤R) (Type)
 Primitive dyadic operator dieresis circle (L f⍥g R) (Composition)
 Primitive monadic operator (f⍦) (Multiset)
 Primitive dyadic function (L⊆R) (Subset Of)
 Primitive dyadic function (L⊇R) (Superset Of)
 Primitive monadic/dyadic functions (πR) (Prime Decomposition)
and (LπR) (Number Theoretic)
 Primitive dyadic function (L..R) (Sequence)
 Primitive dyadic operator quad colon (f⍠b R and L f⍠b R) (Variant)
 Anonymous Functions/Operators: oneline grouping of one or more statements all enclosed in braces such as {(+⌿⍵)÷≢⍵}
 Primitive dyadic operator f.g R as a monadic derived function (Determinant Operator)
 Primitive dyadic operator dieresisdowntack (f⍡g) as a dyadic derived function (Convolution Operator)
 Primitive monadic function Equal (=R (Dimension))
 Primitive monadic function NotEqual (≠R (Norm))
 Primitive dyadic operator dieresisstar
(f⍣g,
f⍣N, and
f⍣∘) (Power)
 Primitive monadic operator Derivative f∂[X]
 Primitive monadic operator Integral f∫[X]
 System Variables:
 ⎕DT (Distribution Type)
 ⎕FC (Format Control)
 ⎕FPC (Floating Point Control)
 ⎕IC (Indeterminate Control)
 ⎕LR (LeftRight Choice)
 System Functions:
 ⎕A
 ⎕AT
 L ⎕CR R for
L=1 and
2
 ⎕DC
 ⎕DM
 ⎕DR R
 L ⎕DR R for
L=0,
1,
2, and higher
 L ⎕EA R
 ⎕EC R
 ⎕EM
 ⎕ERROR R
 ⎕ES R
 L ⎕ES R
 ⎕ET
 ⎕FMT R
 L ⎕FMT R
 ⎕MF R
 L ⎕MF R
 L ⎕NAPPEND R
 L ⎕NCREATE R
 L ⎕NERASE R
 ⎕NINFO
 ⎕NNAMES
 ⎕NNUMS
 ⎕NREAD R
 L ⎕NRENAME R
 L ⎕NREPLACE R
 L ⎕NRESIZE R
 ⎕NSIZE R
 L ⎕NTIE R
 ⎕NUNTIE R
 ⎕SYSID
 ⎕SYSVER
 ⎕TC and other related ⎕TCxxx
 L ⎕TF R for
L=¯2,
¯1,
1, and
2
 ⎕UCS R
 ⎕VR R
 ⎕WA
 System Commands:
 )CLOSE
 )EDIT
 )EXIT
 )IN
 )INASCII
 )NEWTAB
 )OFF
 )OUT
 )RESET
 System Labels in UserDefined Functions/Operators:
 ⎕ID: (Identity Entry Point)
 ⎕INV: (Inverse Entry Point)
 ⎕MS: (Multiset Entry Point)
 ⎕PRO: (Prototype Entry Point)
 Optional Facilities Included
 Statement Separator (⋄)
 Trace and Stop Control
 Complex Arithmetic
 Optional Facilities Not Included (as yet)
 Facilities Purposely Omitted
Wish List of Language Features
 Primitive functions and operators user extensible via userdefined APL functions
 Primitive dyadic function down tack (L⍕R) with character left argument
(Format By Example)
 Primitive dyadic operator dieresisdel (f⍢g) (Dual)
 Primitive monadic operator stiletilde (f⍭[X]) (Partition)
 Selective assignment (e.g., (1 1⍉M)←0)
Datatypes
Current Datatypes
 1bit Booleans
 2byte Characters (Unicode, that is, UCS2)
 64bit Integers
 64bit Floats (double precision)
 Heterogeneous arrays
 Nested arrays
 APAs (Arithmetic Progression Arrays) (e.g.,
2 3 4⍴⍳24)
 ±Infinity (e.g., ∞ for infinity
and ¯∞ for negative infinity)
 Array predicates (a la Bernecky) for Permutation Vectors
 Rational numbers (e.g., 1r3
and 12345x)
 Variable precision floating point numbers (e.g., 1.234v
and 12v)
 Complex numbers (e.g., 2i3.4
or 2J3.4)
 Quaternion numbers (e.g., 2i3j4ij5
or 2i3j4k5)
 Octonion numbers (e.g., 2i3j4k5l6il7jl8kl9)
 Ball Arithmetic for Real, Complex, Quaternion, and Octonion numbers (e.g.,
3.14159±1E¯30 or 123.45±i2)
Wish List of Datatypes
 Unicode support via multiple character widths
(8, 16, and 32bits) instead of the current 16bit fixed width (UCS2)
 Datatypes user extensible via userdefined APL functions
 Array predicates (a la Bernecky) for other special arrays
Miscellaneous Features
Current Miscellaneous Features
 Workspace size limited only by the available address space
 Multiple workspaces may be open at the same time
and switched between via with the click of a mouse
 Workspaces saved as plain text ASCII files
 All variable names are twobyte characters
(Unicode, that is, UCS2)
 Array rank and dimension limit of 64 bits
 Multilevel Undo in function editing
 Undo buffer saved with function for reuse on next edit
 Fast Boolean reduction (<≤=≥>≠∨⍱∧⍲+)
and scan (<≤=≥>≠∨⍱∧⍲)
along contiguous bits
 Right double click on an editable name brings up the function editor on that name
 Control chars (⎕TCBEL, ⎕TCBS,
⎕TCESC,
⎕TCFF, ⎕TCHT,
⎕TCLF, ⎕TCNL, and
⎕TCNUL) display correctly in simple and nested output
 Out of range numeric assignments to
⎕CT,
⎕FPC,
⎕IC,
⎕IO,
⎕PP,
⎕PW, and
⎕RL are set to the value in the allowable range
nearest the ceiling of the given number. For example, if
⎕FPC is set to 23.7,
that value is rounded up to 53, the smallest value
that system variable may assume
 An empty vector assignment to
⎕CT,
⎕DT,
⎕FC,
⎕FPC,
⎕IC,
⎕IO,
⎕PP,
⎕PW, and
⎕RL is converted to the System or CLEAR WS default value
(selected by User Preference)
 Control structures on one line or split across multiple lines
(e.g., :for I :in ⍳N ⋄ ... ⋄ :endfor)
 Syntax coloring of lines of APL in Function Editor and Session Manager windows
 Ball, Base, Euler, Gamma, Hypercomplex, Pi, and Zeta Point Notation as extensions to Decimal Point and Exponential Point Notations
for entering certain numeric constants
 A Status Window at the bottom of the screen displays various pieces of information about
the cursor position and key states
 Altnnnn may be used to enter arbitrary Unicode characters in decimal. For example,
Alt9735 is a lightning bolt (☇)
 Available as either a 32 or 64bit executable
 Language bar
 Userdefined keyboard layout support (copied with minor changes from APL2)
 Line continuation marker for easier display of long lines —
this also allows comments within a line
Wish List of Miscellaneous Features
 Idiom recognition at tokenization time
At the moment, NARS2000 is available as a 32 or 64bit Windowsbased
executable only, designed to run on Windows 7 and above.
However, thanks to a Translation Layer program such as
Wine,
NARS2000 can run on any operating system that can run Wine (which
includes virtually every Linuxbased system and Mac OS, among others). Note that
Wine is not an emulator, but a layer between the Windows executable
and the nonWindows operating system. In fact, the name Wine is a
recursive acronym
for Wine Is Not an Emulator.
For more details on running NARS2000 on your operating system, see
Platforms
in the Wiki.
Documentation
As with many open source software projects, the documentation for
this project is managed by a Wiki. To see the current
effort, goto the
NARS2000 Wiki.
For information about other APL interpeters and APL in general,
see the APL Wiki
where, among other things, you'll find an excellent APL tutorial.
What It Isn't
 Performance: NARS2000 is not intended to be a high performance
system, other than as a fallout of interesting algorithms.
Any good or bad performance on your favorite benchmark is
purely accidental.
 Commercial Systems: NARS2000 is not intended to compete with
commercial systems.
As such it lacks the features one expects to find in a
commercial system, such as a Windows interface, .NET interface, COM
server, etc., although I've not made any conscious effort to make it
difficult to add such features. These features may be included at some later
time — they just aren't high priority up front. You are, of course,
free to use the program commercially, subject to the license agreement
(see the next section).
Get The Code
For Copyright and Licensing terms of the code, see the
License Agreement.
The code is available in several forms:
 Executable:
Windows only,
but see Platforms to
see how to run this executable under other operating systems.
 Source Code Under Version Control:
 The source may be
viewed,
as well as downloaded, one file at a time, from your browser.
 Or, using a version control program, the source may be
downloaded, one file at a time or the whole lot. In
particular, the source code is maintained on the SourceForge site using
Subversion.
There are various clients which may commmunicate with a Subversion
server depending upon the operating system running on your computer.
For example, if you are running Windows, you may download (for free)
the program Tortoise SVN.
This is one means by which developers may checkout and commit changes to
the code.
Using a version control program, the source code may be viewed using the URL
https://sf.net/p/nars2000/code/HEAD/tree/branches/bsmith/NewTypes/.
If You Want To Help
This project was designed to be extensible by both the end
user (via APL magic functions) as well as by system developers. This is
your chance to add a valuable feature to NARS2000.
The source code is written in a combination of APL (as internal
magic functions) and C, so knowledge of either or both languages
is all you need.
Also, don't forget that documentation is an area in need of
improvement, so if your skills are in writing, your help is needed.
The best way to help is to find an area of the project in which
you'd like to contribute, write up a short description of what you
want to do and submit it to the project via the Discussion Groups.
When you contribute content to the project, your name will be placed in
the List of Contributors.
First time contributors will also need to
assign
copyright of what you contribute to the project, in particular
to the principal author, Bob Smith. This is by no means an attempt
to take credit for what you have contributed — instead, it provides a
single point of reference from a legal standpoint in case the program's copyright
(actually copyleft)
needs to be enforced. See the "assign copyright" link above for why this is
necessary.
Discussion Forum
To facilitate discussion about this project, there is a
forum
available for your use. This forum is for discussion relative to this
project, and is not meant to supplant other forums such as the
comp.lang.apl
newsgroup.
Fonts
The pages on this site were designed to be displayed with an
attractive APL font such as SImPL (Unicode),
APL385 Unicode,
or any of the other Unicode APL fonts (assuming they have all of the
extra
APL glyphs used on this site).
Moreover, your choice of browser can materially affect how the APL
characters appear. Either Firefox or Internet Explorer
(Version 7 or later, only) are good choices.
Changes
Rather than gather email addresses, maintain a mailing list, deal with
privacy issues, etc., I'd prefer that if you are interested in being
notified when new features are documented, that you sign up with
a (free) service that does this such as the one linked to at the bottom
of this page. To be notified when a new version is released, goto the
link at the bottom of the download page.
Author
This project was started by
and is © 20062022, Sudley Place Software. Here's a link to some of my other
APLrelated pages.
NARS2000 © 20062022


Comments or suggestions? Send them to
.
