Theme:
v
APL+Win 15.1
May 19, 2015

The APL+Win v15.1 release is available and recommended for all current APL+Win subscribers. To obtain this release, visit http://www.apl2000.com/software.php and click APL+Win v15.1 Installer.

APL+Win 15.1 Updates:

  1. New System Function: ⎕CN - Character Nested-Array
    The ⎕CN system function can be used to normalize any character argument into a nested vector of character arrays.
    Syntax: res ← ⎕CN array
    Argument: array is an array of characters arrays or scalars.
    Result: result is a nested vector of character arrays.
    Example:
          DISPLAY ('M' ('F', ('C1' (3 3⍴'ABCDEFGHI'))),⊂'abc', ⊂'def')
    .→3-------------------------------.
    ∣   .→3----------..→4------------.∣
    ∣ M ∣   .→2..→--.∣∣         .→3-.∣∣
    ∣ - ∣ F ∣C1∣↓ABC∣∣∣ a  b  c ∣def∣∣∣
    ∣   ∣ - '--'∣DEF∣∣∣ -  -  - '---'∣∣
    ∣   ∣       ∣GHI∣∣'∊-------------'∣
    ∣   ∣       '---'∣                ∣
    ∣   '∊-----------'                ∣
    '∊--------------------------------'
    
          DISPLAY ⎕CN ('M' ('F', ('C1' (3 3⍴'ABCDEFGHI'))),⊂'abc', ⊂'def')
    +→-------------------------------------------+
    ∣ +→+ +→+ +→-+ +→--+ +→--+ +→--+ +→--+ +→--+ ∣
    ∣ ∣M∣ ∣F∣ ∣C1∣ ∣ABC∣ ∣DEF∣ ∣GHI∣ ∣abc∣ ∣def∣ ∣
    ∣ +-+ +-+ +--+ +---+ +---+ +---+ +---+ +---+ ∣
    +∊-------------------------------------------+
  2. New support for syntax color highlighting of matching elements

    This enhancement adds support for syntax color highlighting of matching pairs (opening and closing) of the punctuation marks including single quotes, double quotes, parenthesis, and index brackets in both the session and the function editor and highlighting of control structure block statements that are at the same nesting level and user defined names (including line labels) in the function editor.

    When the caret is adjacent to an opening or closing parenthesis, index bracket, single quote, or double quote, then both the opening and closing matched pair of punctuation marks will be highlighted or similarly distinguished visually. By adjacent we mean that the caret should be immediately to the right or left of the punctuation mark. If there is ambiguity, such as when the caret is between two adjacent punctuation marks, then this highlighting will apply to the punctuation mark on the right of the caret. Highlighting of syntax pairs is not done for elements that occur inside of quoted strings or comments.

    If exactly one such punctuation mark is selected, rather than simply having the cursor adjacent to the punctuation mark, then the corresponding, matching opening or closing punctuation mark will be highlighted as described before, but the selected punctuation mark will be highlighted for normal selected display. If multiple characters are selected, or a single character is selected but it is not one of the paired punctuation marks, then the rules for matched pair highlighting are NOT applied to any character and only normal selection display applies.

    The behavior described above is intended to be similar but not identical to the behavior of Visual Studio 2013. In particular, in Visual Studio, when the caret is to the immediate left of a parenthesis and the immediate right of a user defined name, both the name and the parenthesis and its matching paired parenthesis are highlighted.

    APL+Win will only highlight the element (and its associated matching element(s)) in such cases for the element that it to the immediate right of the caret, not both elements to the left and right of the caret. In Visual Studio, paired syntax elements such as parenthesis, get highlighted even when selection extends past the parenthesis, such as into leading or trailing whitespace or some other characters. APL+Win does not follow their pattern here either. Selection must select only a single character in order for its paired element to be highlighted.

    Highlighting is also done for the keywords of multi-part control structures. For example, when the caret is adjacent to or within an :IF keyword, all corresponding :ELSEIF, :ELSE, :ENDIF, and/or :END keywords that are at the same nesting level as the :IF statement are highlighted. Nested :IF statements at deeper or higher levels of containment are not highlighted. Similarly, if the caret is adjacent to or within the :ELSEIF, :ELSE, :ENDIF, or :END keyword that are part of an :IF statement, the corresponding other elements of the same control structure nesting level will all be highlighted as if the caret were in the :IF statement as described above. Note that inline control structure keywords are not highlighted and also the :IN keyword associated with a :FOR or :FOREACH statement.

    If any part of a highlight-able multi-part control structure keyword such as described above is selected and the selection does not extend before colon at the beginning of the keyword nor past the last character of the keyword, then all matching keywords at the same nesting level will be highlighted as described above. The following multi-part control structures will participate in the highlighting described above. In all cases where structure specific ending keywords such as :ENDIF or :ENDSELECT are listed below, aliases such as :END will be considered surrogates for the fully-qualified ending keyword and will be similarly highlighted. Each line below specifies which keywords are part of each control structure sequence that begin with the first keyword on the line and are followed by some number of the other keywords on the line, ending with the ending keyword or one of its surrogates.

    :IF :ELSEIF :ELSE :ANDIF :ORIF :ENDIF
    :SELECT :CASE :CASELIST :LIKE :ELSE :ENDSELECT
    :WHILE :ENDWHILE
    :WHILE :UNTIL
    :REPEAT :ENDREPEAT
    :REPEAT :UNTIL
    :FOR :ENDFOR
    :FOREACH :ENDFOREACH
    :TRY :CATCHIF :CATCH :CATCHALL :FINALLY :ENDTRY
    :TRYALL :ENDTRYALL
    :TEST :PASS :FAIL :ENDTEST
    :IFDEBUG :ENDIFDEBUG

    Finally, user defined names will be highlighted. If the caret is adjacent to or inside any user defined name then all occurrences of that name in the current function edit session will be highlighted.

    Similarly if any portion of the name is selected and the selection does not extend before the first letter of the name or last character of the name, then all occurrences of that name will be highlighted.

    In all cases when the caret is in an ambiguous position adjacent to (between) two syntax elements (such as between a name and a parenthesis or between two parenthesis) the syntax element on the right will be highlighted along with all other elements that are associated with that element.

    Highlight variable named ccc
    Figure 1: Highlight variable named ccc

    Highlight second pair of parenthesis on line 4
    Figure 2: Highlight second pair of parenthesis on line 4

    Highlight first pair of parenthesis on line 8
    Figure 3: Highlight first pair of parenthesis on line 8

    Highlight the :IF/:END control structure statements on lines 10 - 23
    Figure 4: Highlight the :IF/:END control structure statements on lines 10 - 23

    Highlight the :SELECT/:END control structure statements on lines 12 - 19
    Figure 5: Highlight the :SELECT/:END control structure statements on lines 12 - 19

    Highlight ⎕IO system variable
    Figure 6: Highlight ⎕IO system variable

  3. Updated APL System Colors Dialog

    Match Hilite - the (name of the color to control) syntax coloring choice for how syntax pairing is highlighted. The default is blue on grey.

    Match Hilite color settings
    Figure 7: Match Hilite color settings

  4. New support for collapsing & expanding of comment and control structure elements in the function editor

    Example of expanded code
    Figure 8: Example of expanded code

    The :REGION and :ENDREGION keywords defines the bounds of collapsible regions. The :REGION keyword can have an argument which is free text that is not executed. It is simply used as a label for the region both when the region is expanded and collapsed.

    A new column of "region icons" has been added between the Function Line Markers ("gutter") column (in the Preference dialog) where breakpoints can be set, and the function line number column. This appears in the red rectangle in the figure below. The icons in the region column display a [-] for expanded region that can be collapsed or a [+] for collapsed regions that can be expanded. Clicking on these icons toggles the expanded/collapsed state of the region.

    New gutter region with expanded/collapsed icons
    Figure 9: New gutter region with expanded/collapsed icons

  5. Allow most control block structures such as :IF :ELSEIF :ELSE :ENDIF, :SELECT :CASE :CASE :ELSE :ENDSELECT, etc. to be collapsible.

    Some complex structures such as :IF :ELSEIF ... :ELSE :ENDIF have multiple segments and the topmost statement (the :IF statement) can toggle partial collapse of just the top section of the block (up to the first :ELSEIF or :ELSE) or of the whole block all the way to the :ENDIF. This requires a third icon state which looks like [=] indicating partially collapsed state.

    In addition to the icon to the left of the numbers column, collapsed regions also get painted with an ellipsis "..." enclosed in a box drawn at the end of the first line of the collapsed region.

  6. Allow comment blocks containing more than one comment line to be collapsed.

  7. Modify function definition in workspace so that collapsed state can be saved between edit sessions.

    Region state changes are automatically stored into the workspace without saving the function, if the function has not changed since it was opened or last saved. But region state changes in modified functions are not saved into the workspace until (and unless) the modifications are saved. Region state changes are NOT traced in the undo/redo buffers.

  8. Updated APL System Colors Dialog

    Collapsed Region: the syntax coloring choices for how collapsed regions and their ellipsis block is displayed. These are currently colored the same as local variable names.

    Collapsed Region color settings
    Figure 10: Collapsed Region color settings

  9. ⎕DEF system function supports nested vector of character vectors or scalars

    The ⎕DEF system function has been improved to support an argument that is a nested vector of character vectors or scalars. This is identical to the enhancement to ⎕FX in v15.0. E.g.,

          ⎕DEF 'res←left MyFn right' 'res←left + right' 'res←res,left * right'
    MyFn
  10. New support for Hexadecimal and floating point numbers

    Add support for directly entering hexadecimal integer and floating point numbers in APL+Win.

    A hexadecimal integer is prefixed by 0x or 0X followed by 1-16 hex digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). For example, 0x00100000 is equal to 1048576. Hex numbers with 1-8 digits are ALWAYS integers in APL. They do not overflow into floating point numbers when the high order bit is set. For example, the hex number 0xFFFFFFFF is -1 rather than 4294967295. A hexadecimal float can be prefixed by 0x or 0X followed by 9-16 hex digits or by a 0r or 0R prefix followed by 1-16 hex digits.

    Hex integers can also be specified in binary notation with a 0b or 0B prefix followed by 1-64 binary digits (0 or 1). For example, 0b1111 is 15. In the case of a 0r or 0R prefix, the following 1-16 hex digits are the hex representation of the bit pattern for an IEEE 64-bit float. For example, 0r3FF0000000000000 = 1.0. If less than 16 digits are specified, the value is padded with trailing zeros to 16 hex digits. Thus 0r3FF is the same as 0r3FF0000000000000.

    A relatively easy to read summary of IEEE-754 floating point specification can be found here: http://en.wikipedia.org/wiki/IEEE_754-1985. The formal IEEE-specification can be found here: http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=4610935&filter%3DAND%28p_Publication_Number%3 A4610933%29

    Here are some other examples:

    0x00 = 0
    0x01 = 1
    0xFF = 255
    0xFFFFFFFF = -1
    0x0FFFFFFFF = 4294967295
    0b1100 = 12
    0b11111111 = 255
    0b10101010 = 170
    0r3FF0000000000000 = 1.0
    0r4000000000000000 = 2.0
    0rC000000000000000 = -2.0
    0r4010000000000000 = 4.0
    0r3FE0000000000000 = 0.5
    0r4 = 2.0 Note that 0r4 = 0r4000000000000000
    0rC = -2.0 Note that 0rC = 0rC000000000000000

    Be careful to avoid specifying bit patterns using "R" notation that represent infinities or NaNs. APL+Win does not expect to encounter these and can exhibit unexpected behaviors. For example, you can hang APL+Win by trying to display the value of 0r7FF (positive infinity). This is the reason that 0R notation is not enabled by default. So be especially careful to avoid generating them.

    Example:

          (↑645 ⎕dr 82 ⎕dr 110619 ¯2147483648)
    Could be more directly entered in hex like this (noting the 0x prefix):
          (↑645 ⎕dr 0x0001B01B 0x80000000)
    Or even more directly as a floating point 64-bit hex like this (noting the 0r prefix):
          0r800000000001B01B
          ⎕VI '0xFF'
    1
          ⎕FI '0xFF'
    255
          ⎕DR '0xA'
    82
          ⎕DR 0xA
    323

    NOTE: In order for hex numbers to be accepted in any of these contexts they must be enabled via the [Experimental]EnableHex property. Possible values are 0=disabled; 1=allow 0X and 0B; 2=allow 0R; 3=allow 0X, 0B, or 0R notation. The default is 1. The intention is to eventually eliminate the EnableHex property and have hex value always enabled. It is only used because this is an experimental feature at this time.