Redick
A Common Lisp Library for J / APL Programming
»Home
»r4c
»README
»ChangeLog
»Installation
»Downloads
»Support
»Misc
Table of Contents

A shameless plagiarism of the best book for learning J: "J for C Programmers" by Henry Rich.

1. Introduction

J programs are usually a fifth to a tenth as long as corresponding C programs, and along with that economy of expression comes coding speed.

C is a computer language; it lets you control the things the computer does. J is a language of computation: it lets you describe what needs to be done without getting bogged down in details.

J will take advantage of your skill in grasping the essence of a problem.

J contains a couple of dozen array-processing primitives and a dozen or so very cleverly chosen pipe-fittings that allow those primitives to be connected together to provide the limitless supply of array-processing functions needed for practical programming.

2. Culture Shock

3. Declarations

3.1. Arrays

Array

the only data type

Rank

number of axes

Shape

rank-1 array indicating length of all axes

Atom

may be of type numeric or character. It is rank 0. Its shape is an empty array of rank-1.

3.2. Cells

The best essay for describing the relation betweens cells and rank, "A Fine Line" was written by Dan Bron.

Cell

rank of elements to be operated on.

Frame

the array of cells.

Negative cell rank

used when you know the frame and want the cell to be whatever is left over.

Item

synonomous with -1 cells. The item of an atom is the atom.

3.3. Array-creating Verbs (and their interrogators)

3.3.1. Shape and ShapeOf

Example: Create a datum with shape (rank-1 5)
csi> (Shape 5 2)
#(2 2 2 2 2)
Example: Create another datum with shape (rank-1 5)
csi> (Shape 5 (rank-1 "ab"))
#(#\a #\b #\a #\b #\a
csi> (array->string (Shape 5 (rank-1 "ab")))
"ababa"
Table: Redick data types with rank and shape
Datum Rank Shape
atom 0 '()
list 1 '(m)
table 2 '(m n)
report 3 '(m n p)
empty list 1 0