A Quick Look at Nial

I first became aware of Nial at APL84, the language has been visible in the APL-J context ever since, but seems to have taken a rather low profile and I regret that it has taken so long for me take even this much notice.

The basis of Nial is the array theory of Trenchard More, a body of work which underpins APL2 nested arrays.

Availability and Other Commercial Stuff

Basically there are two levels of Nial software; Q'Nial is the 'bare' Nial language (with appropriate programmer interfaces) while Nial Tools is a more complex RAD environment which lays particular emphasis on building Web-based applications. At this time I have just looked at Q'Nial.

You can download an evaluation copy from Nial Systems; this is good for 60 days; Nial is available for Unix and Macintosh platforms as well as Windows. The full version is priced at around USD800 and Nial Tools substantially more.

Nial Systems also offers consulting and custom application development.

The Programmer's Interface

When you launch Nial you see an MDI interface with one interpreter child window open; after making a few trial entries it might look something like this:

Some interesting features here:

Nial for the APL Programmer

Blindingly obvious from the very outset that Nial is a place where APL programmers can be comfortable (or at least the sort of APL programmer who cares about ideas and concepts rather than embarking on a religious crusade about symbol sets and fonts.

Create a variable:

	mymatrix is 3 4 reshape count 12
mymatrix
1 2 3 4
5 6 7 8
9 10 11 12

Naturally, array entries may themselves be arrays:

     mymatrix @ (2 1) := 2 3 reshape count 6
+-+-----+--+--+
|1| 2| 3| 4|
+-+-----+--+--+
|5| 6| 7| 8|
+-+-----+--+--+
|9|1 2 3|11|12|
| |4 5 6| | |
+-+-----+--+--+

And we can mix numeric with character data:

     mymatrix @ (1 2) := 'bananas'
+-+-----+-------+--+
|1| 2| 3| 4|
+-+-----+-------+--+
|5| 6|bananas| 8|
+-+-----+-------+--+
|9|1 2 3| 11|12|
| |4 5 6| | |
+-+-----+-------+--+

Create some operations:

	add1 is +
add2 is op a w{a+w}
average IS OPERATION Numbers (+ Numbers / tally Numbers )
	2 add1 3
5

Operations are essentially the same as APL functions; notice here that (of course) the possibility of a conflict between the names you want (try) to use and the reserved words which are inherent to Nial.:

	times is *
(fault '?name already defined: TIMES IS <***> * ')

Create a transformer:

	twice is transformer f(f f)
twice 1 2 3 + 1 2 3
3 6 9

Transformers are the Nial analogue of APL operators.

This is all exceptionally comfortable; nested arrays, functions, operators; the only thing we should remember is that Nial was here a long time ago - this is not a 'new language derived from APL'. You might be more accurate to think of nested-array APL as a 'new language derived from Nial'.

Other Language Features

Every 'general-purpose' language reflects some sort of application bias, and this becomes particularly true when we look at the intrinsics of an array language; the features which would typically be implemented for scalar languages through run-time libraries but which are made available directly as language features. Nial lays heavy emphasis on drawing specific features from Lisp and intrinsic set operations. You can see all of these by working through the included tutorial.

Nial contains control structures: if case while for repeat exit; probably a sufficient set. Those of us who have been using J or one of the APL interpreters which have control structures available appreciate how their intelligent use adds clarity to our writing (while worrying about how they might be misused by the less array-aware).

Facilities for user interaction within applications are quite primitive; readscreen, writescreen, writechar and clearscreen all doing the obvious things. There is a documented setcursor, but I failed to be able to use it. Clearly a Nial application at this level would not rate highly against the all-devouring GUI application which people are accustomed to using. It is not absolutely clear where this places Nial; we obviously don't want to attempt to write marketable applications in Nial alone.

Given Nial Systems' obvious interest in Nial parts as the RAD basis for Web-based applications it is instructive to look at their online demonstrations; because here we see Nial sitting as a CGI tool in a framework of HTML pages. Acting, if you like, as an alternative to Perl. I haven't looked at this any deeper, but clearly if the marketing goal is to live in the land occupied by CGI forms, Perl and the over-hyped Java this is a quite different scenario from positioning Nial as a universal application development tool.

The essential (assumed) simple file tools are available - but a trifle finicky until one gets used to them:

	fnum := open "g:\temp\afile.txt "r
3
fnum
3
a := readfile fnum
abc
b:=readfile fnum
defg
close fnum

Sequential and random-access files are supported; note that random-access files contain strings rather than arbitrary arrays.

Again we can see that in a context such as Web applications more sophisticated data-access routines could be available.

Summary

The world of programming languages is (or ought to be) overdue for a radical rethink; the tedious and unimaginative arguments over syntactic differences between essentially the same (unimaginative) rollcall of features surely can't be perpetuated. Unless, of course, program language 'theorists' (the tenured post-holders of CSE 'higher' education) manage to keep their stranglehold over innovative thinking. It never fails to surprise me that writing thousands of lines of (aptly-titled) code to create yet another variation on a GUI button can be a paid activity.

Data is only (really) interesting as an aggregate commodity, one record at a time doesn't cut it, and array programming languages are the key to being able to solve business problems in a cost-effective manner. Nial is there with APL and J in epitomising both the good and the bad of array programming.

One thing that Nial does very well is to present a 'human' face to arrays; the 'funny symbols' case against APL is missing, the austerity of J is avoided. It is easy to imagine Nial being used to teach nested array theory. The problem, of course, is that this isn't 'enough'. It isn't enough to persuade the average computer science student (or application programmer) that this lets them build interesting applications. What everybody wants these days is a glamorous GUI; they expect to write 'Hello World' in fabulous Technicolor preferable with sound effects.

I have felt for some time that 'the future' for APL and all its varied relations is to act as the processing engine hitched up to an interface-builder like Visual Basic or Delphi; this lets us generate a symbiosis in which we do what we do well (data manipulation) and the folks who build tools like Delphi have the task of keeping pace with whatever Microsoft (or whoever) deems to be "user interface of the month". Think, for example, of Office97 flat buttons. Should we really expect the quite small crowd of APL (J, Nial) interpreter builders to put their resource into adding flat button objects rather than, say, speeding up dyadic transpose? I think not.

This leaves Nial, as I have seen it so far, somewhat exposed. There's no clear way of hooking Nial into another context, although it rather looks as though Nial Tools may offer a solution (at a non-trivial purchase price). If you want an array programming language (possibly for personal use) it seems as good as any. I would certainly be as happy stranded on a desert island with only Nial for entertainment as with any other APL or J implementation. If I'd been told that the only way off the island was to write for-sale application programs I'd be a bit worried.

Take a look, the download's free; you get sixty days. Even if Nial doesn't get you hooked, it surely contains some things which will improve your APL - or give you more things to say "why don't you?" to your favourite vendor about.


This page last updated 17 March 2013 (repaired links)

Dick Bowman 1997-2013


Return to the J\APL Contents Page