NIAL Nested Interactive Array Language Dennis Brown Northern Kentucky University CSC 507 – November 2005.

Slides:



Advertisements
Similar presentations
Arrays.
Advertisements

Control Structures Ranga Rodrigo. Control Structures in Brief C++ or JavaEiffel if-elseif-elseif-else-end caseinspect for, while, do-whilefrom-until-loop-end.
ICE1341 Programming Languages Spring 2005 Lecture #13 Lecture #13 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
Programming with Microsoft Visual Basic th Edition
CS 355 – PROGRAMMING LANGUAGES Dr. X. Apply-to-all A functional form that takes a single function as a parameter and yields a list of values obtained.
PHP Functions and Control Structures. 2 Defining Functions Functions are groups of statements that you can execute as a single unit Function definitions.
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
ECE122 L11: For loops and Arrays March 8, 2007 ECE 122 Engineering Problem Solving with Java Lecture 11 For Loops and Arrays.
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
© The McGraw-Hill Companies, 2006 Chapter 7 Implementing classes.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
CONTROL STATEMENTS Lakhbir Singh(Lect.IT) S.R.S.G.P.C.G. Ludhiana.
Section 3 - Selection and Repetition Constructs. Control Structures 1. Sequence 2. Selection 3. Repetition.
COMP 205 – Week 11 Dr. Chunbo Chu. Intro Lisp stands for “LISt Process” Invented by John McCarthy (1958) Simple data structure (atoms and lists) Heavy.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 l Array Basics l Arrays in Classes and Methods l Programming with Arrays.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Introduction to Python Basics of the Language. Install Python Find the most recent distribution for your computer at:
1 Lisp Functions –Built-in functions –Defining functions –Function Evaluation and Special Forms defun, if Control statements –Conditional if, cond –Repetition.
Functional Programming in Scheme and Lisp. Overview In a functional programming language, functions are first class objects. You can create them, put.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Arrays and 2D Arrays.  A Variable Array stores a set of variables that each have the same name and are all of the same type.  Member/Element – variable.
 2005 Pearson Education, Inc. All rights reserved. 1 Arrays.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
Chapter 8 Chapter 8 Control Structures. Control Structures  A control structure is a control statement and the statements whose execution it controls.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
Expressions and Statements. Expressions Literals and identifiers are expressions More complex expressions are built from simple expressions by the application.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
Chapter 05 (Part III) Control Statements: Part II.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Selection Statements Selection Switch Conditional.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
© ABB University - 1 Revision C E x t e n d e d A u t o m a t i o n S y s t e m x A Chapter 11 Structured Text Course T314.
Statement Level Flow of Control Iteration Structures Copyright © by Curt Hill.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 5A Repetition (Concepts)
RUBY by Ryan Chase.
CSCI 161 Lecture 7 Martin van Bommel. Control Statements Statements that affect the sequence of execution of other statements Normal is sequential May.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
 Control Flow statements ◦ Selection statements ◦ Iteration statements ◦ Jump statements.
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
CS190/295 Programming in Python for Life Sciences: Lecture 6 Instructor: Xiaohui Xie University of California, Irvine.
1 FP Foundations, Scheme In Text: Chapter Chapter 14: FP Foundations, Scheme Mathematical Functions Def: A mathematical function is a mapping of.
JavaScript and Ajax (Control Structures) Week 4 Web site:
Ada, Scheme, R Emory Wingard. Ada History Department of Defense in search of high level language around Requirements drafted for the language.
JAVA Programming (Session 2) “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
1 CSC103: Introduction to Computer and Programming Lecture No 9.
 Python for-statements can be treated the same as for-each loops in Java Syntax: for variable in listOrstring: body statements Example) x = "string"
Today… Preparation for doing Assignment 1. Invoking methods overview. Conditionals and Loops. Winter 2016CMPE212 - Prof. McLeod1.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
1 Outline Review Introduction to LISP Symbols and Numbers Lists Writing LISP Functions LISPWorks.
Functional Programming
CHAPTER 4 REPETITION CONTROL STRUCTURE / LOOPING
Python: Control Structures
Chapter 3 Branching Statements
CS190/295 Programming in Python for Life Sciences: Lecture 6
FP Foundations, Scheme In Text: Chapter 14.
T. Jumana Abu Shmais – AOU - Riyadh
CS 36 – Chapter 11 Functional programming Features Practice
The Java switch Statement
Boolean Expressions to Make Comparisons
Chapter8: Statement-Level Control Structures April 9, 2019
Modern Programming Languages Lecture 18 Fakhar Lodhi
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Presentation transcript:

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

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

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

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

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’

Strings vs. Phrases A string is a list: first ‘abc’  `alast ‘abc’  `c A phrase is atomic: first “abc  “abclast “abc  “abc

Lists – Examples sum – 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 := –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 6 9] [2 4 6] [1 2 3]

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

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 reshape

Tables – Continued x := 3 3 reshape count x | [2,] (row slice) x | [,2] (col. slice) (1 2) 6 post

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 ) }

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

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 –

Different Ways of Saying the Same Thing x := ‘aeiou’ x := True x := x gets 3 * 4 * 5 (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]

IF Statements IF, ELSE, ELSEIF, and ENDIF are supported Comparison operators and boolean operations are available IF (x >= 3.4) and (y < 7) THEN out_of_range := True ELSE out_of_range := False ENDIF

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

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

Q’Nial Interpreter Q’Nial allows NIAL statements to be entered and interpreted dynamically Windows version is now available free from NIAL Systems ( C++ source code for Q’Nial is also available free of charge

Q’Nial in Action

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

References Nial Systems Limited Q’nial Research Project “A Quick Look at Nial,” Journal of J/APL Comparison of array languages, Keith Smillie “APL programming language,” Wikipedia

Questions?