Skip to content

Technical Correspondence (Mitchison, Piper, Jackson)

Vector 3:3, page 104

programming techniques system interfaces

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 104

Watch Your Step

From Neil Mitchison, 17 July 1986

Dear Editor,

I enclose a submission for the ‘Watch Your Step’ competition. I am afraid that at present I have no facilities for printing APL, so I have had to write out the function in longhand. However I hope that will not give Dave Ziemann too many problems. I have tested the function on Version 2.2 of Siemens APL, running on a Siemens mainframe (which is in fact a 360 lookalike).

I think the code is fairly explanatory; while the number of lines could be reduced, it would be at the expense of clarity, in my opinion. The same goes for reducing the number of local variables.

Obviously the problem would be trivial in a nested-arrays version.

Yours sincerely,

Neil Mitchison
[address omitted]

(Editor: Thanks for your letter Neil, and thanks also for colouring the zeroes pink in your entry – it would otherwise have been quite difficult to distinguish them from the letter Os in your local variable names! The result of the Watch Your Step competition appears later in this issue.)

APL2 bugs

From David Piper, 10 October 1986

Dear Editor,

Some APL2 bugs to add to your (no doubt extensive) collection. All the below encountered in APL2 1.2.

  1. EDITOR 2

    Inserting lines after line 7. Lines N.1, N.3, N.5, N.6 and N.8 are fine . . . but try N.2, N.4, N.7 and N.9, and the result is a definition error. The more digits after the decimal point, the more confusing the rules get. See listing 1 for an illustration.

  2. Assember Function DAN

    Bug or design feature? Adjacent delimiters do not result in items of zero length – the items are omitted (listing 2).

  3. APL WSID

    Command of the APL2/TSO interface returns a three row array, first row contains the WSID, the second the time stamp of the last save and the third the userid of the perpetrator of the said )SAVE. If an object is copied from another WS, the time stamp and userid are changed to that of the WS from which the object was copied (listing 3).

  4. APL QUIET

    Command of the APL2/TSO interface is documented as stopping output to the terminal until a prompt for input is issued or immediate execution mode is re-entered. APL errors and STOP messages turn the quiet mode off (listing 4).

At the current rate of discovery, more next time!

Yours sincerely,

D.B. Piper
Rainham, Kent.

Listing 1. Editor 2 Definition Error

[⍝]∇ TEST.2  ⍴: 8 14
[0]   TEST
[1]   SOME TEST TEXT
[2]   SOME TEST TEXT
[3]   SOME TEST TEXT
[4]   SOME TEST TEXT
[5]   SOME TEST TEXT
[6]   SOME TEST TEXT
[7]   SOME TEST TEXT
[8]   SOME TEST TEXT
[7.1] THIS LINE WILL BE OK
DEFN ERROR
      [7.2] THIS WILL GIVE DEFN ERROR

Listing 2. Assembler function DAN

      )CLEAR
CLEAR WS
      3 11 ⎕NA 'DAN'
1
      )COPY 1 DISPLAY DISPLAYG
SAVED 6.06.1986  8.59.09 (GMT)
      ⍴¨ '/' DAN 'ITEM1/ITEM2//ITEM?'
 5  5  5
      ⍝ THE NULL ITEM IS EXCLUDED
      3 11 ⎕NA 'CAN'
1
      ⍴¨ ('/'≠'ITEM1/ITEM2//ITEM?') CAN 'ITEM1/ITEM2//ITEM?'
 5  5  0  5
      ⍝ THE NULL ITEM IS INCLUDED

Listing 3. APL WSID being corrupted

      )LOAD TESTING
SAVED 28.07.1986  9.25.57 (GMT)
      )HOST APL WSID
TESTING
28.07.1986 09.25.57
V500003
TSO(0)
      )COPY ROB1
SAVED 22.09.1986 10.26.39 (GMT)
      )HOST APL WSID
TESTING
22.09.1986 10.26.39
V500015
TSO(0)

Listing 4. APL QUIET turned off by stop message

      ∇TEST[⎕]∇
    ∇
[0]   TEST
[1]   ⎕←'BEFORE QUIET'
[2]   RC←∆TSO 'APL QUIET'
[3]   RC←RC,∆STACK¨'''IN STACK''' ')WSID' '→⎕LC'
[4]   ⎕←'AFTER STACK CMD, BEFORE STACK RUN'
[5]   S∆TEST←10
[6]  10:S∆TEST←⍳0
[7]   ⎕←'AFTER STACK RUN'
[8]  ⍝ The only message generated by this function should be:
[9]  ⍝ BEFORE QUIET          (from line 1).
    ∇ 2.10.1986 12.10.58 (GMT)
      TEST                 ⍝ NOTE: Comments added after execution.
BEFORE QUIET               ⍝ ← This message is OK
                           ⍝ ← Where does this line come from?
TEST[6]                    ⍝ ← Quiet has been turned off
IN STACK                   ⍝ ← Stack is run
IS CLEAR WS
AFTER STACK RUN            ⍝ ← Function restarts
      RC
 0  0  0  0

And some more!

From Colin Jackson, 10 October 1986

Dear Sir,

I have noticed the following odd behaviour of APL2 release 2, running under VM:

(A B) ← 1 2

assigns 1 to A and 2 to B as expected. However,

(A (B C) D) ← 1 (2 3) 4

sets A to 1, B to 2 3, C to 4, and leaves D undefined. Maybe a SYNTAX ERROR would be better!

Yours sincerely,

Colin Jackson
Cocking and Drury Ltd
16 Berkeley Street
London W1X 5AE

(Editor: VECTOR will publish details of any other APL bugs that our readers discover, so do let us know of any nasties you find. Surely APL2 can’t be the only APL system with bugs in it?)