Dyalog APL: Difference between revisions

Jump to navigation Jump to search
10,518 bytes added ,  11:27, 21 July 2020
m
no edit summary
(Internal types)
mNo edit summary
(35 intermediate revisions by 3 users not shown)
Line 3: Line 3:
| index origin            = 0 or 1
| index origin            = 0 or 1
| function styles          = [[tradfn]], [[dfn]], [[tacit]]
| function styles          = [[tradfn]], [[dfn]], [[tacit]]
| numeric types            = complex floats, decimal float
| numeric types            = [[complex]] floats, [[decimal float]]s
| unicode support          = full
| unicode support          = full
| released                = 1983
| released                = 1983
| developer                = [[Dyalog Ltd.]]
| developer                = [[Dyalog Ltd.]]
| latest release version  = 17.1 / 2019
| latest release version  = 18.0 / 2020
| implementation languages = [[wikipedia:C (programming language)|C]], [[wikipedia:C++|C++]], APL
| implementation languages = [[wikipedia:C (programming language)|C]], [[wikipedia:C++|C++]], APL
| platforms                = x86, x86_64, IBM POWER, ARM32
| platforms                = x86, x86_64, IBM POWER, ARM32
| operating systems        = Windows, Linux, macOS, AIX
| operating systems        = Windows, Linux, macOS, AIX
| license                  = Free for personal use / Proprietary commercial software
| license                  = Free for personal use / Proprietary commercial software
| website                  = [https://www.dyalog.com/dyalog/index.htm dyalog.com/dyalog/index.htm]
| website                  = [https://www.dyalog.com/dyalog/index.htm dyalog.com]
| download                = [https://www.dyalog.com/download-zone.htm Non-commercial download]
| download                = [https://www.dyalog.com/download-zone.htm Non-commercial download]
| forum                    = [https://forums.dyalog.com/ Dyalog Forums]
| file ext                = .dws, .dse, .dcf, .dyalog, .dyapp, .apl, .apla, .aplf, .aplo, .apln, .aplc, .apli
| file ext                = .dws, .dse, .dcf, .dyalog, .dyapp, .apl, .apla, .aplf, .aplo, .apln, .aplc, .apli
| documentation            = [https://docs.dyalog.com/ Documentation Centre]
| documentation            = [https://docs.dyalog.com/ Documentation Centre]
| influenced by            = [[APL2]], [[J]], [[SHARP APL]], [[wikipedia:Scheme (programming language)|Scheme]], [[wikipedia:C_Sharp_(programming_language)|C#]]
| influenced by            = [[NARS]], [[APL2]], [[J]], [[SHARP APL]], [[wikipedia:Scheme (programming language)|Scheme]], [[wikipedia:C_Sharp_(programming_language)|C#]]
| influenced              = [[NARS2000]], [[GNU APL]], [[ngn/apl]], [[dzaima/APL]], [[APL\iv]]
| influenced              = [[NARS2000]], [[GNU APL]], [[ngn/apl]], [[dzaima/APL]], [[APL\iv]]
| run online              = [https://tryapl.org/ TryAPL]
| run online              = [https://tryapl.org/ TryAPL]
}}
}}
'''Dyalog APL''', or simply '''Dyalog''', is a modern APL in the [[APL2]] tradition, first released by British company [[Dyalog Ltd.|Dyadic Systems Ltd.]] (now Dyalog Ltd.) in 1983 for the Zylog Z80 processor (the name ''Dyalog'' is a portmanteau of ''Dyadic'' and ''Zylog''). Dyalog supports several platforms and interfaces with many languages and runtimes including native [[wikipedia:Shared library|shared libraries]], [[.NET]], the [[wikipedia:Java virtual machine|JVM]], [[wikipedia:R (programming language)|R]], and [[wikipedia:Python (programming language)|Python]]. It is actively developed and has introduced many new primitives and concepts to array programming. Major categories of features introduced to APL by Dyalog are [[tacit]] programming by allowing named [[derived function]]s and later [[train]]s, lexically-scoped functional programming using [[dfn]]s, [[namespace]]s and [[object-oriented programming]], and the addition of [[leading axis theory]] and the [[Rank operator]] to the [[nested array model|nested array]] paradigm.
:''"Dyalog" redirects here. For the company, see [[Dyalog Ltd.]]''
<!-- :''For the chat bot, see [[APL Orchard#Chat bot]].'' -->
'''Dyalog APL''', or simply '''Dyalog''', is a [[Nested array model|nested]] APL based on [[NARS]] and [[APL2]], first released by British company [[Dyalog Ltd.|Dyadic Systems Ltd.]] (now Dyalog Ltd.) in 1983 for the [[wikipedia:Zilog Z8000|Zilog Z8000]] processor. (The name ''Dyalog'' is a portmanteau of ''Dyadic'' and ''Zilog''). Continuously developed since, Dyalog has added support for many programming paradigms including [[object-oriented programming]] based on [[.NET]], [[wikipedia:Lisp (programming language)|Lisp]]-style lexically scoped anonymous functions ([[dfn]]s), and [[Leading axis theory|leading axis]] and [[tacit programming]] support based on [[J]]. It supports several platforms and interoperability between them, and interfaces with other languages and runtimes including native [[wikipedia:Shared library|shared libraries]], [[.NET]], the [[wikipedia:Java virtual machine|JVM]], [[wikipedia:R (programming language)|R]], and [[wikipedia:Python (programming language)|Python]].


In 1995, two Dyalog developers—[[John Scholes]] and [[Peter Donnelly]]—were awarded the [[Iverson Award]] for their work on the interpreter. [[Gitte Christensen]] and [[Morten Kromberg]] were joint recipients of the Iverson Award in 2016.
Although it initially received very little commercial interest, Dyalog has steadily grown in prominence and in the 2010s has been the basis of several new APL dialects including [[ngn/apl]], [[APL\iv]], and [[dzaima/APL]]. Even in APLs not derived from Dyalog such as [[GNU APL]] and [[NARS2000]], [[dfn]]-style function syntax has become common, and Dyalog has also popularised [[SHARP APL]] and [[J]] innovations such as the [[Rank operator]] and [[train]]s among nested APLs.
 
== History ==
{{Main|Dyalog Ltd.}}
Work on Dyalog was begun in 1981 by APL consulting company [[Dyadic Systems]], which by that time had grown to support about 15 employees. In partnership with [[wikipedia:Zilog|Zilog]] UK, Dyadic developed an interpreter using the [[wikipedia:C (programming language)|C]] programming language for the [[wikipedia:Zilog Z8000|Zilog Z8000]]'s [[wikipedia:UNIX|UNIX]] operating system—both obscure technologies at the time. Dyadic employees [[John Scholes]] and [[Geoff Streeter]] worked full-time on the implementation, while David Crossley managed its development as a part-time role. Initially aiming to produce something like [[SHARP APL]], they eventually chose a [[Nested array model|nested]] model rather than adding [[box]]es to the [[flat array model]] like SHARP, and drew most design decisions from [[STSC]]'s experimental [[NARS]] dialect and the material available at the time regarding [[IBM]]'s plans for [[APL2]].<ref name="taylor">Stephen Taylor. [http://archive.vector.org.uk/art10013790 "How we got here"]. [[Vector journal]] Volume 23 special supplement "Dyalog at 25". 2008-09.</ref>
 
Released at [[APL83]], Dyalog sold very few copies due to the lack of interest in either Unix or the nested array model. Subsequent sales were also limited, with only a single licence sold through Zilog partly due to the Z8000's limited popularity. Supported by Dyadic's APL consulting and later by sales of Unix hardware, Scholes and Streeter continued work on Dyalog by porting it to a wide variety of Unix systems in response to requests from users; in 1995, Scholes was awarded the [[Iverson Award]] jointly with [[Peter Donnelly]] for his work on the Dyalog interpreter. Although it continued to run significant losses every year, Dyalog slowly acquired users during the 1980s, including current client [[wikipedia:SimCorp|SimCorp]]. In 1991, Dyadic hired [[John Daintree]] to begin work on the <source lang=apl inline>⎕WC</source> graphical user interface for [[wikipedia:Microsoft Windows|Microsoft Windows]]; Dyalog for Windows debuted at [[APL92]] and quickly become Dyalog's main platform.<ref name="taylor"/>
 
In 1996, John Scholes introduced a new form of functional definition to Dyalog based on his studies of the functional programming language [[wikipedia:Scheme (programming language)|Scheme]], which he called [[dfn]]s, for "direct functions". Rarely used for many years, dfns have become a common APL feature, with many newer APLs removing traditional [[defined function]]s from the language in favour of dfns. Another major addition to the language began in 2000, when John Daintree was invited to participate in the design of Microsoft's [[.NET]]. Based on this work, and the [[namespace]]s which he had added to the language in 1994, Daintree developed an [[Object-oriented programming|object]] model for Dyalog, which was released in 2006. These efforts also led to the new language called [[APL#]], which was first released in 2010 but abandoned in 2012 when Microsoft deprecated [[wikipedia:Microsoft Silverlight|Silverlight]].
 
In the 2010s, Dyalog development began to focus on performance, which had been improved out of necessity in early releases but had not been a major focus. In 2010 Dyalog Ltd. hired [[Jay Foad]], a compiler developer who initially created a bytecode compiler for APL and later improved performance in other ways, and served as CTO from 2016 until his departure in 2019. In 2011 the company hired [[Roger Hui]], developer of [[J]], and in 2016 it also hired J programmer and language implementor [[Marshall Lochbaum]]. Both developers improved performance of Dyalog's primitives on flat arrays, and brought concepts such as the [[Rank operator]], [[train]]s, and composition operators [[Atop]] and [[Over]] from J to APL.
 
The Dyalog interpreter has also incorporated significant components written in APL in the 2000s and 2010s. [[Dan Baronet]], hired in 2006, introduced the SALT (Simple APL Library Toolkit) system to distribute APL code, and [[user command]]s based on it, in [[Dyalog APL 12.0|version 12.0]] in 2008. Work on APL components of Dyalog has also been done by [[Brian Becker]] and [[Adám Brudzewsky]]. Brudzewsky, hired in 2015, has also driven the adoption of new functionality such as [[Nest]] and [[array notation]] in Dyalog.
 
== Platforms ==
Besides for working out-of-the-box on Windows, macOS, and AIX, Dyalog APL runs on many Linuxes. However, to function, some require additional action beyond simple installation. As of 2019-05-15, the necessary actions for versions 16.0, 17.0, and 17.1 are:
{| class=wikitable
! Distribution    !! Action
|-
|Debian 8.2, 9.8, 9.9 || no pre-reqs
|-
|Fedora 29, 30        || <code>dnf install ncurses-compat-libs</code>
|-
|Linux Mint 18.0, 19.0|| no pre-reqs
|-
|openSUSE 15.0        || <code>zypper install libncurses5</code>
|-
|CentOS/RedHat 6      || not supported for 17.1 as glibc is at too low a level
|-
|CentOS/RedHat 7      || no pre-reqs
|-
|RedHat 8            || <code>rpm -Uvh ncurses-compat-libs</code>  (note: RH8 would not install in a VM)
|-
|Ubuntu 16.04, 18.04  || no pre-reqs
|-
|Ubuntu 19.04        || <code>apt-get install libtinfo5</code>
|}


== Versions ==
== Versions ==
Line 77: Line 116:
|                            10.1    || 2004 || July      || Multiple arguments in [[tradfn]] headers, thread tokens, 64-bit component files, value tips
|                            10.1    || 2004 || July      || Multiple arguments in [[tradfn]] headers, thread tokens, 64-bit component files, value tips
|-
|-
|                           11.0     || 2006 || October  || [[Object-oriented programming]] (classes, objects, interfaces) modelled after [[wikipedia:C-Sharp_|C#]], [[Squad indexing|Index]] (<source lang=apl inline>⌷</source>), [[Power operator]] (<source lang=apl inline>⍣</source>), [[GCD]] (<source lang=apl inline>∨</source>), [[LCM]] (<source lang=apl inline>∧</source>)
| [[Dyalog_APL_versions#11.0|11.0]]  || 2006 || October  || [[Object-oriented programming]] (classes, objects, interfaces) modelled after [[wikipedia:C-Sharp_|C#]], [[Squad indexing|Index]] (<source lang=apl inline>⌷</source>), [[Power operator]] (<source lang=apl inline>⍣</source>), [[GCD]] (<source lang=apl inline>∨</source>), [[LCM]] (<source lang=apl inline>∧</source>)
|-
|-
|                           12.0     || 2008 || August    || [[Unicode]] support (<source lang=apl inline>⎕AVU</source>, <source lang=apl inline>⎕UCS</source>), <source lang=apl inline>⎕FCOPY</source>, <source lang=apl inline>⎕FPROPS</source>
| [[Dyalog_APL_versions#12.0|12.0]]  || 2008 || August    || [[Unicode]] support (<source lang=apl inline>⎕AVU</source>, <source lang=apl inline>⎕UCS</source>), <source lang=apl inline>⎕FCOPY</source>, <source lang=apl inline>⎕FPROPS</source>
|-
|-
|                           12.1     || 2009 || November  || [[I-Beam]] (<source lang=apl inline>⌶</source>), [[Table]] (<source lang=apl inline>⍪</source>), <source lang=apl inline>⎕XML</source>, <source lang=apl inline>⎕FCHK</source>, [[User command]]s
| [[Dyalog_APL_versions#12.1|12.1]]  || 2009 || November  || [[I-beam]] (<source lang=apl inline>⌶</source>), [[Table]] (<source lang=apl inline>⍪</source>), <source lang=apl inline>⎕XML</source>, <source lang=apl inline>⎕FCHK</source>, [[User command]]s
|-
|-
|                           13.0     || 2011 || April    || [[Left]] (<source lang=apl inline>⊣</source>), [[Right]] (<source lang=apl inline>⊢</source>), [[Variant]] (<source lang=apl inline>⍠</source>), <source lang=apl inline>⎕OPT</source>, <source lang=apl inline>⎕R</source>, <source lang=apl inline>⎕S</source>, <source lang=apl inline>⎕PROFILE</source>, <source lang=apl inline>⎕RSI</source>, [[complex number]] and [[decimal float]] support, short arguments for [[Take]], [[Drop]], and [[Squad indexing|Index]] (<source lang=apl inline>↑</source>, <source lang=apl inline>↓</source>, <source lang=apl inline>⌷</source>)
| [[Dyalog_APL_versions#13.0|13.0]]  || 2011 || April    || [[Left]] (<source lang=apl inline>⊣</source>), [[Right]] (<source lang=apl inline>⊢</source>), [[Variant]] (<source lang=apl inline>⍠</source>), <source lang=apl inline>⎕OPT</source>, <source lang=apl inline>⎕R</source>, <source lang=apl inline>⎕S</source>, <source lang=apl inline>⎕PROFILE</source>, <source lang=apl inline>⎕RSI</source>, [[complex number]] and [[decimal float]] support, short arguments for [[Take]], [[Drop]], and [[Squad indexing|Index]] (<source lang=apl inline>↑</source>, <source lang=apl inline>↓</source>, <source lang=apl inline>⌷</source>)
|-
|-
|                           13.1     || 2012 || April    || <source lang=apl inline>⎕DMX</source>, <source lang=apl inline>⎕FHIST</source>
| [[Dyalog_APL_versions#13.1|13.1]]  || 2012 || April    || <source lang=apl inline>⎕DMX</source>, <source lang=apl inline>⎕FHIST</source>
|-
|-
|                           13.2     || 2013 || January  || Array [[Editor]]
| [[Dyalog_APL_versions#13.2|13.2]]  || 2013 || January  || Array [[Editor]]
|-
|-
| [[Dyalog_APL_versions#14.0|14.0]]  || 2014 || June      || [[Train]]s, [[Tally]] (<source lang=apl inline>≢</source>), [[Key]] (<source lang=apl inline>⌸</source>), [[Rank operator]] (<source lang=apl inline>⍤</source>), multi-threading with [[future]]s and [[isolate]]s
| [[Dyalog_APL_versions#14.0|14.0]]  || 2014 || June      || [[Train]]s, [[Tally]] (<source lang=apl inline>≢</source>), [[Key]] (<source lang=apl inline>⌸</source>), [[Rank operator]] (<source lang=apl inline>⍤</source>), [[High-rank set functions|high-rank]] [[Index Of]], multi-threading with [[future]]s and [[isolate]]s
|-
|-
| [[Dyalog_APL_versions#14.1|14.1]]  || 2015 || June      || <source lang=apl inline>:Disposable</source> [[.NET]] objects and resources, gesture support, many new I-beams
| [[Dyalog_APL_versions#14.1|14.1]]  || 2015 || June      || <source lang=apl inline>:Disposable</source> [[.NET]] objects and resources, gesture support, many new I-beams
Line 97: Line 136:
| [[Dyalog_APL_versions#16.0|16.0]]  || 2017 || June      || [[At]] (<source lang=apl inline>@</source>), [[Interval Index]] (<source lang=apl inline>⍸</source>), [[Where]] (<source lang=apl inline>⍸</source>), [[Nest]] (<source lang=apl inline>⊆</source>), [[Partition]] (<source lang=apl inline>⊆</source>), [[Stencil]] (<source lang=apl inline>⌺</source>), <source lang=apl inline>⎕JSON</source>, <source lang=apl inline>⎕CSV</source>
| [[Dyalog_APL_versions#16.0|16.0]]  || 2017 || June      || [[At]] (<source lang=apl inline>@</source>), [[Interval Index]] (<source lang=apl inline>⍸</source>), [[Where]] (<source lang=apl inline>⍸</source>), [[Nest]] (<source lang=apl inline>⊆</source>), [[Partition]] (<source lang=apl inline>⊆</source>), [[Stencil]] (<source lang=apl inline>⌺</source>), <source lang=apl inline>⎕JSON</source>, <source lang=apl inline>⎕CSV</source>
|-
|-
| [[Dyalog_APL_versions#17.0|17.0]]  || 2018 || July      || <source lang=apl inline>⎕NCOPY</source>, <source lang=apl inline>⎕NMOVE</source>
| [[Dyalog_APL_versions#17.0|17.0]]  || 2018 || July      || <source lang=apl inline>⎕NCOPY</source>, <source lang=apl inline>⎕NMOVE</source>, [[total array ordering]], high-rank [[Unique]]
|-
|-
| [[Dyalog_APL_versions#17.1|17.1]]  || 2019 || October  || Duplicates in [[Interval Index]] (<source lang=apl inline>⍸</source>) look-up array
| [[Dyalog_APL_versions#17.1|17.1]]  || 2019 || October  || Duplicates in [[Interval Index]] (<source lang=apl inline>⍸</source>) look-up array
|-
|-
| [[Dyalog_APL_versions#18.0|18.0]]  ||colspan=2| Unreleased || [[Atop]] (<source lang=apl inline>⍤</source>), [[Over]] (<source lang=apl inline>⍥</source>), [[Constant]] (<source lang=apl inline>⍨</source>), [[Unique Mask]] (<source lang=apl inline>≠</source>), duplicates from [[Where]] (<source lang=apl inline>⍸</source>), empty partitions from [[Partitioned Enclose]] (<source lang=apl inline>⊂</source>), multi-line session input, date-time conversion, case folding/mapping (<source lang=apl inline>⎕C</source>)
| [[Dyalog_APL_versions#18.0|18.0]]  || 2020 || June      || [[Atop]] (<source lang=apl inline>⍤</source>), [[Over]] (<source lang=apl inline>⍥</source>), [[Constant]] (<source lang=apl inline>⍨</source>), [[Unique Mask]] (<source lang=apl inline>≠</source>), duplicates from [[Where]] (<source lang=apl inline>⍸</source>), empty partitions from [[Partitioned Enclose]] (<source lang=apl inline>⊂</source>), date-time conversion (<source lang=apl inline>⎕DT</source>), case folding/mapping (<source lang=apl inline>⎕C</source>), launching with text source file, [[.NET]] Core support
|}
|}


Line 115: Line 154:
| <source lang=apl inline>-</source> || [[Negate]]            || [[Minus]]
| <source lang=apl inline>-</source> || [[Negate]]            || [[Minus]]
|-
|-
| <source lang=apl inline>×</source> || [[Signum]]           || [[Times]]
| <source lang=apl inline>×</source> || [[Direction]]         || [[Times]]
|-
|-
| <source lang=apl inline>÷</source> || [[Reciprocal]]        || [[Divide]]
| <source lang=apl inline>÷</source> || [[Reciprocal]]        || [[Divide]]
Line 135: Line 174:
| <source lang=apl inline>~</source> || [[Not]]              || [[Without]]
| <source lang=apl inline>~</source> || [[Not]]              || [[Without]]
|-
|-
| <source lang=apl inline>?</source> || [[Roll]]              || [[Query]]
| <source lang=apl inline>?</source> || [[Roll]]              || [[Deal]]
|-
|-
| <source lang=apl inline>∧</source> ||                      || [[And]]
| <source lang=apl inline>∧</source> ||                      || [[And]]
Line 169: Line 208:
| <source lang=apl inline>⍉</source> ||colspan=2| [[Transpose]]
| <source lang=apl inline>⍉</source> ||colspan=2| [[Transpose]]
|-
|-
| <source lang=apl inline>↑</source> || [[Mix]]/[[Disclose]] || [[Take]]
| <source lang=apl inline>↑</source> || [[Mix]]/[[First]]     || [[Take]]
|-
|-
| <source lang=apl inline>↓</source> || [[Split]]            || [[Drop]]
| <source lang=apl inline>↓</source> || [[Split]]            || [[Drop]]
Line 179: Line 218:
| <source lang=apl inline>∊</source> || [[Enlist]]/[[Type]]  || [[Membership]]
| <source lang=apl inline>∊</source> || [[Enlist]]/[[Type]]  || [[Membership]]
|-
|-
| <source lang=apl inline>⊃</source> || [[Disclose]]/[[Mix]] || [[Pick]]
| <source lang=apl inline>⊃</source> || [[First]]/[[Mix]]     || [[Pick]]
|-
|-
| <source lang=apl inline>/</source> ||                      || [[Replicate]]
| <source lang=apl inline>/</source> ||                      || [[Replicate]]
Line 221: Line 260:
| <source lang=apl inline>⌹</source> || [[Matrix Inverse]]    || [[Matrix Divide]]
| <source lang=apl inline>⌹</source> || [[Matrix Inverse]]    || [[Matrix Divide]]
|-
|-
| <source lang=apl inline>⌷</source> || [[Materialise]]      || [[Squad Indexing]]
| <source lang=apl inline>⌷</source> || [[Materialise]]      || [[Index (function)|Index]]
|}
|}


Line 243: Line 282:
| <source lang=apl inline>A⍨</source>  ||colspan=2| [[Constant]]
| <source lang=apl inline>A⍨</source>  ||colspan=2| [[Constant]]
|-
|-
| <source lang=apl inline>f⍣v</source>  ||colspan=2| [[Power]]
| <source lang=apl inline>f⍣v</source>  ||colspan=2| [[Power (operator)|Power]]
|-
|-
| <source lang=apl inline>f.g</source>  ||                    || [[Inner Product]]
| <source lang=apl inline>f.g</source>  ||                    || [[Inner Product]]
Line 255: Line 294:
| <source lang=apl inline>f∘g</source>  ||colspan=2| [[Beside]]
| <source lang=apl inline>f∘g</source>  ||colspan=2| [[Beside]]
|-
|-
| <source lang=apl inline>f⍤B</source>  ||colspan=2| [[Rank]]
| <source lang=apl inline>f⍤B</source>  ||colspan=2| [[Rank operator|Rank]]
|-
|-
| <source lang=apl inline>f⍤g</source>  ||colspan=2| [[Atop]]
| <source lang=apl inline>f⍤g</source>  ||colspan=2| [[Atop]]
Line 269: Line 308:
| <source lang=apl inline>f⌺B</source>  || [[Stencil]]        ||
| <source lang=apl inline>f⌺B</source>  || [[Stencil]]        ||
|-
|-
| <source lang=apl inline>A⌶</source>  ||colspan=2| [[I-Beam]]
| <source lang=apl inline>A⌶</source>  ||colspan=2| [[I-beam]]
|-
|-
| <source lang=apl inline>f&</source>  ||colspan=2| [[Spawn]]
| <source lang=apl inline>f&</source>  ||colspan=2| [[Spawn]]
Line 277: Line 316:


== Implementation ==
== Implementation ==
Dyalog APL is implemented primarily in [[wikipedia:C (programming language)|C]] with some parts implemented in [[wikipedia:C++|C++]] in order to use [[wikipedia:C++#Templates|templates]]. C [[wikipedia:Intrinsic function|intrinsics]] are used to access instruction set extensions. Some architecture-specific [[wikipedia:Assembly language|assembly]], both compiled separately and inline from C, is used for functionality like [[wikipedia:Status register|exception flags]] which is not easily accessible in C. Prior to [[Dyalog APL versions#17.0|version 17.0]], assembly was also used for vectorized arithmetic. In 17.0, this code was replaced by a new C++ implementation.


=== Internal types ===
=== Internal types ===
Line 287: Line 328:
* 8-byte [[wikipedia:IEEE 754|double]]
* 8-byte [[wikipedia:IEEE 754|double]]
* 16-byte [[complex]] (one double for each component)
* 16-byte [[complex]] (one double for each component)
* 16-byte decimal float ([[wikipedia:Binary integer decimal|BID]] or [[wikipedia:Densely packed decimal|DPD]])
* 16-byte decimal float "decf" ([[wikipedia:Binary integer decimal|BID]] or [[wikipedia:Densely packed decimal|DPD]])
 
[[Character]] encodings differ for classic and unicode interpreters: classic interpreters use a custom 1-byte encoding for all characters, and are limited to a 256-character set, while characters in unicode interpreters are 1-, 2-, or 4-byte unsigned unicode [[wikipedia:code point|code point]] values.
 
[[Nested]] and [[mixed array]]s (that is, [[pointer array]]s) are always stored as arrays of pointers, while [[simple array|simple]] numeric or character arrays are always stored using one of the above types. For both numbers and characters, an array may be represented using any type that can contain all the values. The interpreter may reduce the type of an array to the minimum possible ("squeeze" the array) during execution.
 
Because there is no [[complex]] representation using decimal floats for the components, arrays containing both decimal floats and complex numbers have no common representation. Dyalog converts such arrays to complex numbers, resulting in a loss of precision for decf elements.
 
=== Instruction set usage ===
 
Dyalog makes heavy use of [[vector instructions]] on all platforms, as well as other special instruction sets primarily on x86. Instruction set availability is checked at runtime, so that the minimum required instruction set remains low:
* For 32-bit x86, only [[wikipedia:SSE2|SSE2]] is required.
* For x86_64, there is no minimum requirement as every processor supports SSE2. SSE4.1 is required on macOS as all x86 Apple machines support this instruction set.
* For ARM32, there is no minimum requirement.
* As of version 17.1, POWER7 and above are supported. Support for older systems is dropped because Dyalog compiles separate binaries for each POWER architecture.
 
In Dyalog 17.0, the code for vectorized [[scalar function]]s was unified and extended to allow Intel [[wikipedia:AVX2|AVX2]] and ARM NEON in addition to Intel [[wikipedia:SSE2|SSE2]] and [[wikipedia:SSE4.1|SSE4.1]], and AltiVec VMX for IBM POWER. This code is also used for operations involving the scalar dyadics [[Plus]], [[Minus]], [[Times]], [[Divide]], [[Maximum]], [[Minimum]], and [[comparison function]]s, as well as some functions derived from operators applied to these functions, such as the [[Outer Product]] and [[Inner Product]].


Character encodings differ for classic and unicode interpreters: classic interpreters use a custom 1-byte encoding for all characters, and are limited to a 256-character set, while unicode characters are 1-, 2-, or 4-byte unsigned [[wikipedia:code point|code point]] values.
Dyalog also uses many other x86 extensions:
* Since at least [[Dyalog APL versions#12.1|12.1]], [[wikipedia:SSE2|SSE2]] is used for [[scalar dyadic]]s.
* Since [[Dyalog APL versions#17.0|17.0]], [[wikipedia:AVX2|AVX2]] is used for scalar dyadics if available.
* Since [[Dyalog APL versions#14.1|14.1]], [[wikipedia:SSE4.1|SSE4.1]] is used for [[Minimum]] and [[Maximum]], and finding the range of an array. [[wikipedia:AVX2|AVX2]] can also be used for these purposes in [[Dyalog APL versions#18.0|18.0]].
* Since [[Dyalog APL versions#17.0|17.0]], [[wikipedia:SSSE3|SSSE3]] is used primarily for the shuffle instruction for permuting arrays and searching small lookup tables.
* Since [[Dyalog APL versions#14.0|14.0]], [[wikipedia:SSE4.2|SSE4.2]] POPCNT is used to sum Boolean arrays.
* Since [[Dyalog APL versions#14.0|14.0]], [[wikipedia:SSE4.2|SSE4.2]] CRC32 is used to compute fast hash functions.
* Since [[Dyalog APL versions#15.0|15.0]], [[wikipedia:BMI2|BMI2]] is used for Boolean matrix transpose. Since [[Dyalog APL versions#16.0|16.0]], it is used for Boolean [[Compress]] and [[Expand]], and several [[structural function]]s on Boolean arrays.
* Since [[Dyalog APL versions#18.0|18.0]], [[wikipedia:CLMUL instruction set|CLMUL]] is used for [[xor]] [[reduction]]s and [[scan]]s.
* Since [[Dyalog APL versions#18.0|18.0]], [[wikipedia:FMA instruction set|FMA3]] is used to implement [[Divide|division]] by a [[singleton]].
 
It also uses the POWER8 [https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/vec_gbb.html gather-bits-by-bytes] instruction, which is equivalent to transposing an 8x8 bit matrix for [[Boolean]] [[Transpose]] since version 15.0 (expanded in applicability in 16.0) and the fused multiply-add instruction for division like x86 FMA3 in 18.0.


== External links ==
== External links ==
Line 297: Line 365:
* [https://dyalog.com Download]
* [https://dyalog.com Download]


{{APL dialects}}
== References ==
<references/>
 
{{APL dialects}}[[Category:Dyalog APL| ]][[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]][[Category:.NET]]

Navigation menu