NAME

che

SYNOPSIS

che script {arguments}

DESCRIPTION

che is an implementation D4, an interpreted, interactive, array processing language based on K.Iverson's APL[1]. APL is one of the world's first object oriented languages. D4 is essentially a small subset of APL with UNICODE workspaces, and a UNIX style file system that allows any file to be treated like a byte-vector. The name D4 comes from 4-Dimension which is a translation of MITITISI, a Thai science fiction magazine. The name 'che' comes from the Chinese word for cart, or the Rook in Chinese Chess. The character 车 (che) looks quite different in traditional or simplified Chinese, and it just looks like a weird typo if you don't have UNICODE.

See the file che.doc or d4.doc for more.

COMMAND LINE OPTIONS

che script {options}

All other options must be processed by the script.

The normal startup line is:-

xqsh

xqsh is an installation dependent script, and must be adjusted for different versions of linux and file heirarchies.

INTERPRETOR INTERFACE

Run the interpretor in a Linux terminal window. It is best to have full unicode font support. Gnome-terminal is available on many machines.

INSTALLATION

Download che2011.tgz, etc.tgz

Extract the files in a directory called d4

The tarfile might contain a binary version of che.

If not, then type 'configure'

Compile che.

make -f che.mf

It may be necessary to link the files onto a recognised search path for programs. One possible procedure could be

cd /home/user/bin

ln -s /home/user/d4/cp/che che

ln -s /home/user/d4/cp/xqsh xqsh

D4

Some versions of D4 are meant to work on legacy computers running DOS, WINDOWS or LINUX. In particular a 16-bit version is available (d4t.exe). The first version, written in compiled BASIC, was run at computer show in the Hyatt-Plaza Hotel, in Bangkok, Thailand. The C version was developed in Riyadh, Saudi Arabia. Some of the current source code is unchanged from that time.

The functions of the interpretor and scripts are carefully separated on a 'Need to Know' basis. Keywords have been kept to a minimum, with lower case letters being used for the traditional APL symbols.

The key design objective of the interpretor is to handle real economic and statistical problems arising from globalisation. There is a script which will compute the Banzhaf Power index for European Union voting system, by brute force, faster than C program using Monte-Carlo simulation (http://d4maths.lowtech.org/eu2000.htm).

FULL LIST OF COMMAND LINE OPTIONS

d4x S=val N=val W=val F=val k={value} i={value} script {options}

If no script is available, the program looks for a file called init.afn in the current directory.

The variables N, S, W, F have the following meanings and defaults.

S,s stack size 512

N,n names 512

W,w windows 50

F,f file descriptors 32

K,k if defined, startup in input mode.

Don't try and load init.afn..

I,i if defined supress break-in checking.

For use in batch files.

All other options must be processed by the script.

Recmmended startup lines are:-

xqsh options Linux

dsh options Linux

d4x filename options DOS/WINDOWS

The only way to see whether there are undocumented options is too look at the C source code.

NOTES ON THE INTERPRETOR INTERFACE

It is possible to invoke an interpretor (./che, ./d4x) from the keyboard. This is not recommended unless you are altering the source code, recompiling and testing. Even then you should not need to do this unless you made serious and irrecoverable errors. If you try to run che or d4x as stand alone programs, without a script, then you are likely just see rain or snow in the terminal window.

The interpretor may revert to raw input mode in case of errors while running a script. It is much more convenient to run a script which traps errors and runs a UNIX lookalike shell with aliases and command line history. The interpretor is designed to scan for functions and data definitions in any text file. It would be easy to adapt the binary, or even a startup script to scan any file type whatsoever.

The script xqsh starts off with #!/usr/bin/che.

D4 scripts share some features with Python: spaces and line breaks are important. The interpretor reads functions and data from the script and then attempts to run the first non commented line. Blank lines separate objects. Objects themselves may contain blank lines if they are defined as "here documents" as in Perl or the Bourne Shell. The use of tab characters in scripts is depreciated.

Unlike most other languages the line input routine consists of a built in editor. This requires the user to have access to a DOS prompt or a Linux terminal. Keyboard layout and character composition are handled via tables kept by the interpretor. The editor can handle both Hebrew from right to left and English from left to right.

Scripts can handle standard arguments by methods similar to most others: positional arguments are represented by $0, $1, $2... and name=value pairs are treated by putting the names and values in the main symbol table. Most scripts were meant to run exactly the same on Windows and Linux. The D-shell scripts are supposed to detect the environment and define the appropriate functions and aliases.

There is no need to have a binary sych as 'che' to run scripts. A competant programmer could emulate the interpretor via java-script, java, perl, python or visual basic.

The interpretor handles math error signals and the interrupt (break-in) key.

FILES AND DIRECTORIES

These are in different places for different installations.

che Interpretor file

xqsh Ascii file for local startup script.

dsh.afn D-shell script and commonly required objects.

test.afn Alternative D-shell

d4s.lst Current aliases

*.d4f various packages

If che and xqsh are placed in /usr/bin the D4 may be used for CGI scripts.

Alert: The interpretor's file functions will fail if a file name contains embedded spaces.

ENVIRONMENT VARIABLES

These are passed to the script in a virtual array called $ENVP[].

WINDOWS INSTALLATION

Get DNA.EXE (or RNA.EXE) and CSRC.TGZ for DOS/WINDOWS. DNA.EXE and RNA.EXE are self extractors. Source code for the DOS/WINDOWS d shell self extractor can be found in che2001.tgz at 'co/xtar.c' A compiled version of xtar.c can be found at the beginning of DNA.EXE or RNA.EXE. The last time the author tried running DNA.EXE was in a Beijing cybercafe during 2008. It still worked. Best not to run this stuff on your own main computer unless you run it under quarantine in a newly created directory. DNA and RNA do not see long filenames.

AUTHOR

Tony Goddard

email: tony@lowtech.org

info: 447944764312

[1] Kenneth Iverson trained as an economist. He invented APL in the 1950s. The most important features of APL included vector and tensor operations on numbers. Iverson's work is particularly important in the development of intereactive computing. APL preceded BASIC as a language designed to help non computer specialists get results quickly from the computer via an intereactive terminal. At that time many terminals were hard copy terminals so the brevity of the APL notation was a distinct advantage.

AUTHOR

Tony Goddard

email: ?lamthecat@yahoo.com ?=h

info: 447944764312

INTERNET RESOURCES

http://d4maths.lowtech.org

LICENCING


Copyright 2011 Tony Goddard.
Licenced under the Free Documentation Licence.