NIAL - PowerPoint PPT Presentation

About This Presentation
Title:

NIAL

Description:

Invented in 1981 by Michael Jenkins of Queen's University in Kingston, Ontario ... NIAL is an acronym for Nested Interactive Array Language, but is also a ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 23
Provided by: NKU
Learn more at: https://www.nku.edu
Category:
Tags: nial | acronym

less

Transcript and Presenter's Notes

Title: NIAL


1
NIAL
  • Nested Interactive Array Language
  • Dennis Brown
  • Northern Kentucky University
  • CSC 507 November 2005

2
Origins of NIAL
  • Based on nested array theory developed by Dr.
    Trenchard More, Jr.
  • Invented in 1981 by Michael Jenkins of Queens
    University in Kingston, Ontario
  • Influenced by APL and Lisp
  • NIAL is an acronym for Nested Interactive Array
    Language, but is also a reference to Njals Saga
    (a Nordic legend)

3
APL vs. NIAL
  • APL was invented in 1962
  • Very efficient for some types of calculation, but
    required a special character set

4
APL vs. NIAL (cont.)
  • NIAL uses keywords instead of symbols, so no
    custom keyboard is required
  • For example, ? (rho) in APL becomes reshape in
    NIAL
  • NIAL also adds control structures (from
    imperative languages) that APL did not have
  • The original version of APL did not support
    nested arrays

5
NIAL Data Types
  • Numbers
  • integers
  • floating points
  • booleans (l, o, True, False)
  • Characters
  • X, v, 3
  • Lists
  • 3 C 5 (strand notation)
  • 3 C 5
  • (empty list)
  • Strings
  • abc
  • a b c
  • Phrases
  • dog
  • phrase dog
  • Faults
  • ?conform

6
Strings vs. Phrases
  • A string is a list
  • first abc ? a last abc ? c
  • A phrase is atomic
  • first abc ? abc last abc ? abc

7
Lists Examples
  • sum 2 3 4
  • 9
  • sum 2 3 4
  • 2 3 4
  • sum (2 3 4) (1 2 3)
  • 3 5 7
  • each sum (2 3 4) (1 2 3)
  • 9 6
  • x y z 5 6 7
  • assigns 5 to x, 6 to y, 7 to z
  • 1 2 3 2
  • 2 4 6
  • 1 2 3 3 2 1
  • 3 4 3
  • 1 2 3 3 2 1
  • 3 6 9 2 4 6 1 2 3

8
Lisp vs. NIAL
  • (car 1 2 3)
  • 1
  • (cdr 1 2 3)
  • (2 3)
  • (cons 1 (2 3))
  • (1 2 3)
  • first 1 2 3
  • 1
  • rest 1 2 3
  • 2 3
  • hitch 1 (2 3)
  • 1 2 3

9
Tables
  • A table is a multi-dimensional list
  • The reshape function can be used to create a
    table with a specified number of rows and columns
  • 2 3 reshape 1 2 3 4 5 6 7 8
  • 1 2 3
  • 4 5 6
  • 2 3 reshape 1 2 3 4
  • 1 2 3
  • 4 1 2

10
Tables Continued
  • x 3 3 reshape count 9
  • 1 2 3
  • 4 5 6
  • 7 8 9
  • x 2, (row slice)
  • 7 8 9
  • x ,2 (col. slice)
  • 3 6 9
  • x _at_ (1 2)
  • 6
  • post 1 2 3
  • 1
  • 2
  • 3

11
Functions
  • Functions are defined using the syntax is
    operation, followed by the formal parameters,
    and then the function body enclosed in braces
  • Functions are evaluated using right associativity
  • Examples
  • factorial IS OPERATION x count x
  • nthroot IS OPERATION x n power x ( reciprocal n
    )

12
Transformers
  • A transformer changes how functions are applied
  • each is a built-in transformer that applies a
    function to each value of a list
  • each first (abc def) (3 7 8) (z x q)
  • abc 3 z
  • New transformers can be created using IS
    TRANSFORMER
  • Transformers were a novel feature in NIAL, and
    allow the language to support parallel
    architectures efficiently

13
Atlases
  • An atlas is a list of functions that can be
    applied to a data item, producing a list of
    results
  • first, last, reverse a b c
  • a c cba brackets are used because cba is
    a list!
  • , -, , /, quotient 12 7
  • 19 5 84 1.71 1

14
Different Ways of Saying the Same Thing
  • x aeiou
  • x True
  • x 3 4
  • x 3 4
  • x gets 3 4 5
  • x _at_ (0 3)
  • x _at_ (0 3)
  • x a e i o u
  • x l
  • x gets 3 plus 4
  • x gets plus 3 4
  • x 3 times prod 4 5
  • 0 3 choose x
  • x 0, 3

15
IF Statements
  • IF, ELSE, ELSEIF, and ENDIF are supported
  • Comparison operators and boolean operations are
    available
  • IF (x gt 3.4) and (y lt 7) THEN
  • out_of_range True
  • ELSE
  • out_of_range False
  • ENDIF

16
CASE Statements
  • CASE statements allow selection based on a value
    (not necessarily an integer)
  • An optional ELSE clause handles the default case
  • Each non-default case must end with END there
    is no fall-through like in C and Java
  • CASE n FROM
  • 1 value one END
  • 2 value two END
  • ELSE value unknown
  • ENDCASE

17
Loops
  • NIAL supports the three usual types of loops
  • WHILE condition DO expressions ENDWHILE
  • REPEAT expressions UNTIL condition ENDREPEAT
  • FOR variable WITH range DO expressions
    ENDFOR
  • The count function is useful with FOR loops
  • FOR i WITH count 10 DO write(i) ENDFOR
  • It is better to use the EACH transformer, however
  • The EXIT statement can be used to force a loop to
    terminate

18
QNial Interpreter
  • QNial allows NIAL statements to be entered and
    interpreted dynamically
  • Windows version is now available free from NIAL
    Systems (www.nial.com)
  • C source code for QNial is also available free
    of charge

19
QNial in Action
20
The Future of NIAL
  • NIAL has been used in academic research
    (particularly in AI) and at some insurance
    companies, but has declined in popularity since
    the 1980s
  • Newer languages in its niche can do the same
    tasks just as well or better
  • APL version 2
  • J and its successors
  • J is available for free NIAL was very expensive
    until recently
  • NIAL is not easy to integrate with native C
    libraries
  • Best use of NIAL is as a prototyping language

21
References
  • Nial Systems Limited
  • http//www.nial.com
  • Qnial Research Project
  • http//www.qnial.net
  • A Quick Look at Nial, Journal of J/APL
  • http//www.apl.demon.co.uk/aplandj/qnial.html
  • Comparison of array languages, Keith Smillie
  • http//www.cs.ualberta.ca/smillie/ComputerAndMe/P
    art23.html
  • APL programming language, Wikipedia
  • http//en.wikipedia.org/wiki/APL_programming_langu
    age

22
Questions?
Write a Comment
User Comments (0)
About PowerShow.com