Dyalog APL: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
(Created page with "Dyalog APL was first released by British company Dyalog Ltd. in 1983 and, as of 2018, is available for AIX, Linux (including on the Raspberry Pi), macOS and Microsoft Wind...")
 
 
(108 intermediate revisions by 8 users not shown)
Line 1: Line 1:
Dyalog APL was first released by British company [[Dyalog]] Ltd. in 1983 and, as of 2018, is available for AIX, Linux (including on the Raspberry Pi), macOS and Microsoft Windows platforms. It is based on [[APL2]], with extensions to support object-oriented programming and functional programming. Licences are free for personal/non-commercial use.
{{Infobox array language
| logo                    = [[File:Dyalog icon.png|width:]]
| array model              = [[nested array model|nested]]
| index origin            = 0 or 1
| function styles          = [[tradfn]], [[dfn]], [[tacit]]
| numeric types            = [[complex]] floats, [[decimal float]]s
| unicode support          = full
| released                = 1983
| developer                = [[Dyalog Ltd.]]
| latest release version  = 18.2 / 2022
| implementation languages = [[wikipedia:C (programming language)|C]], [[wikipedia:C++|C++]], APL
| platforms                = x86, x86_64, IBM POWER, ARM32
| operating systems        = Windows, Linux, macOS, AIX
| license                  = Free for personal use / Proprietary commercial software
| website                  = [https://www.dyalog.com/dyalog/index.htm dyalog.com]
| 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
| documentation            = [https://docs.dyalog.com/ Documentation Centre]
| influenced by            = [[NARS]], [[APL2]], [[J]], [[SHARP APL]], [[wikipedia:Scheme (programming language)|Scheme]], [[wikipedia:C_Sharp_(programming_language)|C#]]
| influenced              = [[NARS2000]], [[GNU APL]], [[APL-sharp|APL#]], [[ngn/apl]], [[April]], [[Co-dfns]], [[BQN]]
| run online              = [https://tryapl.org/ TryAPL]
}}
:''"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 of the development team - [[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]], [[dzaima/APL]], and [[April]]. 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.


The most important extensions to the original APL language include:
== History ==
:''See also: [[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>


* 1983: Nested arrays: Any element of an array can be another array (APL2)
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 <syntaxhighlight lang=apl inline>⎕WC</syntaxhighlight> 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"/>
* 1990: Namespaces
 
* 1995: [[Control structures|Keywords]] (If/Then/Else, Repeat/Until, exception handling, and so on)
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". 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 to deliver a Windows GUI API and an interface to COM/OLE, Daintree developed an [[Object-oriented programming|object]] model for Dyalog, based on concepts from [[wikipedia:C_Sharp_(programming_language)|C#]] and [[wikipedia:Visual Basic|Visual Basic]].
* 1996: Functional programming: [[dfns]] provide lexical scope and [[lambda-style expressions|Dfns]]
 
* 2006: [[Object orientated programming]], allowing integration with OO frameworks and Microsoft .NET
In 2005, Dyadic transferred management to CEO [[Gitte Christensen]] and CTO [[Morten Kromberg]], and sold ownership of the company to a group of investors including their company Insight Systems. With this arrangement, the development team at Dyalog grew rapidly. Dfns were promoted as "mainstream" APL features, with the result that many newer APLs only support dfns, abandoning traditional [[defined function]]s completely. Daintree's work on objects resulted in the addition of full object oriented programming capabilities to Dyalog APL in 2006. The influence of the Microsoft's .NET Framework also led to a project to create a new language called [[APL#]], prototypes of which were released in 2010. The project was abandoned in 2012 when Microsoft deprecated [[wikipedia:Microsoft Silverlight|Silverlight]].
* 2014: Point-free or &quot;[[tacit|Train]]&quot; syntax similar to that in the J programming language
 
* 2014: Futures and isolates for [[parallel programming|Parallel computing]]
In addition to functional and object oriented language features, Dyalog APL folded concepts and features from the [[SHARP APL]] and [[J]] side of the APL family tree back into what fundamentally remains a dialect of APL2. In 2011 the company hired [[Roger Hui]], developer of J, and in 2016 it also hired J programmer and language implementer [[Marshall Lochbaum]]. Both developers improved performance of Dyalog's primitives on flat arrays, and brought concepts such as the [[Rank (operator)|Rank operator]], [[trains]], and [[Function composition|composition operators]], namely [[Atop]] and [[Over]], from J to APL.
 
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. Hui and Lochbaum also improved performance of Dyalog's primitives on [[Simple array|flat arrays]].
 
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 ==
 
{{Main|Dyalog APL versions}}
 
Dyalog lists historical versions, along with release notes since 14.0, on [https://www.dyalog.com/dyalog/dyalog-versions.htm its website]. Its early history is recounted in more detail by [[Pete Donnelly]] in [https://www.dyalog.com/uploads/files/apl50/Dyalog%20APL%20A%20Personal%20History.pdf Dyalog APL: A Personal History (pdf)].
 
{|class=wikitable
! Number                              !! Year !! Month    !! Features
|-
|                            1      || 1983 || April    || (Zilog S8000 only)
|-
|                            2      || 1984 ||          || (Many more platforms)
|-
|                            3.0    || 1985 ||          || (More platforms) Rectangular display of arrays
|-
|                            4.0    || 1986 || October  || User-defined operators, [[function assignment]] (including for [[derived function]]s), <syntaxhighlight lang=apl inline>⎕MONITOR</syntaxhighlight>
|-
|                            5.0    || 1987 || April    || Nested array editor
|-
|                            5.1    || 1988 || April    || (first version for DOS) User-defined input/output tables, <syntaxhighlight lang=apl inline>⎕SM</syntaxhighlight> and <syntaxhighlight lang=apl inline>⎕SR</syntaxhighlight>, windowed editor/tracer, interface to GSS/CGI
|-
|                            5.2    || 1990 || January  || Naked trace
|-
|                            6.0    || 1990 || April    || GUI IDE
|-
|                            6.1    || 1990 || October  || <syntaxhighlight lang=apl inline>⎕ED</syntaxhighlight>
|-
|                            6.2.1  || 1992 || July      || (first version for Windows) <syntaxhighlight lang=apl inline>⎕WC</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕DQ</syntaxhighlight>, etc.
|-
|                            6.3.1  || 1993 || April    || <syntaxhighlight lang=apl inline>⎕NA</syntaxhighlight>, graphical, clipboard and printer objects
|-
|                            7.0.1  || 1994 || August    || Namespaces, additional GUI objects
|-
|                            7.1    || 1995 || May      || <syntaxhighlight lang=apl inline>⎕CS</syntaxhighlight>, GUI objects as namespaces, greater [[APL2]] compatibility
|-
|                            8.0    || 1996 || May      || [[Control structure|Keywords]] (<syntaxhighlight lang=apl inline>:If</syntaxhighlight>/<syntaxhighlight lang=apl inline>:Else</syntaxhighlight>, <syntaxhighlight lang=apl inline>:Repeat</syntaxhighlight>/<syntaxhighlight lang=apl inline>:Until</syntaxhighlight>, <syntaxhighlight lang=apl inline>:Trap</syntaxhighlight>, and so on), <syntaxhighlight lang=apl inline>⎕PATH</syntaxhighlight>, additional GUI objects, OLE
|-
|                            8.1    || 1997 || March    || [[dfn]]s with [[lexical scope]], syntax colouring, TCPSocket object, OLE client/server, automatic file tie numbers
|-
|                            8.2    || 1999 || January  || [[Windowed Reduction]] and [[scalar function]]s with [[Function axis|axis]] (from [[APL2]]), Threading with [[Spawn]] (<syntaxhighlight lang=apl inline>&</syntaxhighlight>), ActiveX, <syntaxhighlight lang=apl inline>:With</syntaxhighlight>, additional GUI objects
|-
|                            9.0    || 2000 || September || [[Namespace]] [[reference]]s (instead of [[string]] names) and dot syntax, context-sensitive help (F1), aditional GUI objects with animation
|-
|                            9.0.1  || 2001 || January  || (Windows CE) Pocket APL
|-
|                            9.0.2  || 2002 || January  || [[.NET]] support
|-
|                            9.5    || 2002 || September ||
|-
| [[Dyalog_APL_versions#10.0|10.0]]  || 2003 || March    || <syntaxhighlight lang=apl inline>⎕NULL</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕MAP</syntaxhighlight> (mapped files), [[idiom recognition]], retained hash tables, [[.NET]] support built-in, run-time workspace as .exe, auto-completion, mapped
|-
| [[Dyalog_APL_versions#10.1|10.1]]  || 2004 || July      || Multiple arguments in [[tradfn]] headers, thread tokens, 64-bit component files, value tips
|-
| [[Dyalog_APL_versions#11.0|11.0]]  || 2006 || October  || [[Object-oriented programming]] (classes, objects, interfaces) modelled after [[wikipedia:C-Sharp_|C#]], [[Squad indexing|Index]] (<syntaxhighlight lang=apl inline>⌷</syntaxhighlight>), [[Power operator]] (<syntaxhighlight lang=apl inline>⍣</syntaxhighlight>), [[GCD]] (<syntaxhighlight lang=apl inline>∨</syntaxhighlight>), [[LCM]] (<syntaxhighlight lang=apl inline>∧</syntaxhighlight>)
|-
| [[Dyalog_APL_versions#12.0|12.0]]  || 2008 || August    || [[Unicode]] support (<syntaxhighlight lang=apl inline>⎕AVU</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕UCS</syntaxhighlight>), <syntaxhighlight lang=apl inline>⎕FCOPY</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕FPROPS</syntaxhighlight>
|-
| [[Dyalog_APL_versions#12.1|12.1]]  || 2009 || November  || [[I-beam]] (<syntaxhighlight lang=apl inline>⌶</syntaxhighlight>), [[Table]] (<syntaxhighlight lang=apl inline>⍪</syntaxhighlight>), <syntaxhighlight lang=apl inline>⎕XML</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕FCHK</syntaxhighlight>, [[User command]]s
|-
| [[Dyalog_APL_versions#13.0|13.0]]  || 2011 || April    || [[Left]] (<syntaxhighlight lang=apl inline>⊣</syntaxhighlight>), [[Right]] (<syntaxhighlight lang=apl inline>⊢</syntaxhighlight>), [[Variant]] (<syntaxhighlight lang=apl inline>⍠</syntaxhighlight>), <syntaxhighlight lang=apl inline>⎕OPT</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕R</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕S</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕PROFILE</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕RSI</syntaxhighlight>, [[complex number]] and [[decimal float]] support, short arguments for [[Take]], [[Drop]], and [[Squad indexing|Index]] (<syntaxhighlight lang=apl inline>↑</syntaxhighlight>, <syntaxhighlight lang=apl inline>↓</syntaxhighlight>, <syntaxhighlight lang=apl inline>⌷</syntaxhighlight>)
|-
| [[Dyalog_APL_versions#13.1|13.1]]  || 2012 || April    || <syntaxhighlight lang=apl inline>⎕DMX</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕FHIST</syntaxhighlight>
|-
| [[Dyalog_APL_versions#13.2|13.2]]  || 2013 || January  || Array [[Editor]]
|-
| [[Dyalog_APL_versions#14.0|14.0]]  || 2014 || June      || [[Train]]s, [[Tally]] (<syntaxhighlight lang=apl inline>≢</syntaxhighlight>), [[Key]] (<syntaxhighlight lang=apl inline>⌸</syntaxhighlight>), [[Rank operator]] (<syntaxhighlight lang=apl inline>⍤</syntaxhighlight>), [[Major cell search|high-rank]] [[Index Of]] (<syntaxhighlight lang=apl inline>⍳</syntaxhighlight>), multi-threading with [[future]]s and [[isolate]]s
|-
| [[Dyalog_APL_versions#14.1|14.1]]  || 2015 || June      || <syntaxhighlight lang=apl inline>:Disposable</syntaxhighlight> [[.NET]] objects and resources, gesture support, many new I-beams
|-
| [[Dyalog_APL_versions#15.0|15.0]]  || 2016 || June      || <syntaxhighlight lang=apl inline>⎕MKDIR</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NDELETE</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NEXISTS</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NGET</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NINFO</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NPARTS</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NPUT</syntaxhighlight>
|-
| [[Dyalog_APL_versions#16.0|16.0]]  || 2017 || June      || [[At]] (<syntaxhighlight lang=apl inline>@</syntaxhighlight>), [[Interval Index]] (<syntaxhighlight lang=apl inline>⍸</syntaxhighlight>), [[Where]] (<syntaxhighlight lang=apl inline>⍸</syntaxhighlight>), [[Nest]] (<syntaxhighlight lang=apl inline>⊆</syntaxhighlight>), [[Partition]] (<syntaxhighlight lang=apl inline>⊆</syntaxhighlight>), [[Stencil]] (<syntaxhighlight lang=apl inline>⌺</syntaxhighlight>), <syntaxhighlight lang=apl inline>⎕JSON</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕CSV</syntaxhighlight>
|-
| [[Dyalog_APL_versions#17.0|17.0]]  || 2018 || July      || <syntaxhighlight lang=apl inline>⎕NCOPY</syntaxhighlight>, <syntaxhighlight lang=apl inline>⎕NMOVE</syntaxhighlight>, [[total array ordering]], high-rank [[Unique]] (<syntaxhighlight lang=apl inline>∪</syntaxhighlight>)
|-
| [[Dyalog_APL_versions#17.1|17.1]]  || 2019 || October  || Duplicates in [[Interval Index]] (<syntaxhighlight lang=apl inline>⍸</syntaxhighlight>) look-up array
|-
| [[Dyalog_APL_versions#18.0|18.0]]  || 2020 || June      || [[Atop]] (<syntaxhighlight lang=apl inline>⍤</syntaxhighlight>), [[Over]] (<syntaxhighlight lang=apl inline>⍥</syntaxhighlight>), [[Constant]] (<syntaxhighlight lang=apl inline>⍨</syntaxhighlight>), [[Unique Mask]] (<syntaxhighlight lang=apl inline>≠</syntaxhighlight>), duplicates from [[Where]] (<syntaxhighlight lang=apl inline>⍸</syntaxhighlight>), empty partitions from [[Partitioned Enclose]] (<syntaxhighlight lang=apl inline>⊂</syntaxhighlight>), date-time conversion (<syntaxhighlight lang=apl inline>⎕DT</syntaxhighlight>), case folding/mapping (<syntaxhighlight lang=apl inline>⎕C</syntaxhighlight>), launching with text source file, [[.NET]] Core support
|-
| [[Dyalog_APL_versions#18.2|18.2]]  || 2022 || March    || <syntaxhighlight lang=apl inline>⎕ATX</syntaxhighlight>, shell scripting
|-
| [[Dyalog_APL_versions#19.0|19.0]]  || 2024 || March    || 64-bit ARM (macOS and Raspberry Pi) support, last version for intel macOS, <syntaxhighlight lang=apl inline>⎕TALLOC</syntaxhighlight>, Health Monitor protocol, multi-line session input, JSON-format session logs
|}
 
== Primitives ==
 
=== Functions ===
 
{|class=wikitable
! Glyph                              !! Monadic              !! Dyadic
|-
| <syntaxhighlight lang=apl inline>+</syntaxhighlight> || [[Conjugate]]        || [[Plus]]
|-
| <syntaxhighlight lang=apl inline>-</syntaxhighlight> || [[Negate]]            || [[Minus]]
|-
| <syntaxhighlight lang=apl inline>×</syntaxhighlight> || [[Direction]]        || [[Times]]
|-
| <syntaxhighlight lang=apl inline>÷</syntaxhighlight> || [[Reciprocal]]        || [[Divide]]
|-
| <syntaxhighlight lang=apl inline>|</syntaxhighlight> || [[Magnitude]]        || [[Residue]]
|-
| <syntaxhighlight lang=apl inline>⌊</syntaxhighlight> || [[Floor]]            || [[Minimum]]
|-
| <syntaxhighlight lang=apl inline>⌈</syntaxhighlight> || [[Ceiling]]          || [[Maximum]]
|-
| <syntaxhighlight lang=apl inline>*</syntaxhighlight> || [[Exponential]]      || [[Power function|Power]]
|-
| <syntaxhighlight lang=apl inline>⍟</syntaxhighlight> || [[Natural Logarithm]] || [[Logarithm]]
|-
| <syntaxhighlight lang=apl inline>!</syntaxhighlight> || [[Factorial]]        || [[Binomial]]
|-
| <syntaxhighlight lang=apl inline>○</syntaxhighlight> || [[Pi Times]]          || [[Circle function|Circular]]
|-
| <syntaxhighlight lang=apl inline>~</syntaxhighlight> || [[Not]]              || [[Without]]
|-
| <syntaxhighlight lang=apl inline>?</syntaxhighlight> || [[Roll]]              || [[Deal]]
|-
| <syntaxhighlight lang=apl inline>∧</syntaxhighlight> ||                      || [[And]]
|-
| <syntaxhighlight lang=apl inline>∨</syntaxhighlight> ||                      || [[Or]]
|-
| <syntaxhighlight lang=apl inline>⍲</syntaxhighlight> ||                      || [[Nand]]
|-
| <syntaxhighlight lang=apl inline>⍱</syntaxhighlight> ||                      || [[Nor]]
|-
| <syntaxhighlight lang=apl inline><</syntaxhighlight> ||                      || [[Less]]
|-
| <syntaxhighlight lang=apl inline>≤</syntaxhighlight> ||                      || [[Less Or Equal]]
|-
| <syntaxhighlight lang=apl inline>=</syntaxhighlight> ||                      || [[Equal]]
|-
| <syntaxhighlight lang=apl inline>≥</syntaxhighlight> ||                      || [[Greater Or Equal]]
|-
| <syntaxhighlight lang=apl inline>></syntaxhighlight> ||                      || [[Greater]]
|-
| <syntaxhighlight lang=apl inline>≠</syntaxhighlight> || [[Unique Mask]]      || [[Not Equal]]
|-
| <syntaxhighlight lang=apl inline>⍴</syntaxhighlight> || [[Shape]]            || [[Reshape]]
|-
| <syntaxhighlight lang=apl inline>,</syntaxhighlight> || [[Ravel]]            || [[Catenate]]
|-
| <syntaxhighlight lang=apl inline>⍪</syntaxhighlight> || [[Table]]            || [[Catenate First]]
|-
| <syntaxhighlight lang=apl inline>⌽</syntaxhighlight> || [[Reverse]]          || [[Rotate]]
|-
| <syntaxhighlight lang=apl inline>⊖</syntaxhighlight> || [[Reverse First]]    || [[Rotate First]]
|-
| <syntaxhighlight lang=apl inline>⍉</syntaxhighlight> ||colspan=2| [[Transpose]]
|-
| <syntaxhighlight lang=apl inline>↑</syntaxhighlight> || [[Mix]]/[[First]]    || [[Take]]
|-
| <syntaxhighlight lang=apl inline>↓</syntaxhighlight> || [[Split]]            || [[Drop]]
|-
| <syntaxhighlight lang=apl inline>⊂</syntaxhighlight> || [[Enclose]]          || [[Partitioned Enclose]]
|-
| <syntaxhighlight lang=apl inline>⊆</syntaxhighlight> || [[Nest]]              || [[Partition]]
|-
| <syntaxhighlight lang=apl inline>∊</syntaxhighlight> || [[Enlist]]/[[Type]]  || [[Membership]]
|-
| <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> || [[First]]/[[Mix]]    || [[Pick]]
|-
| <syntaxhighlight lang=apl inline>/</syntaxhighlight> ||                      || [[Replicate]]
|-
| <syntaxhighlight lang=apl inline>⌿</syntaxhighlight> ||                      || [[Replicate First]]
|-
| <syntaxhighlight lang=apl inline>\</syntaxhighlight> ||                      || [[Expand]]
|-
| <syntaxhighlight lang=apl inline>⍀</syntaxhighlight> ||                      || [[Expand First]]
|-
| <syntaxhighlight lang=apl inline>∩</syntaxhighlight> ||                      || [[Intersection]]
|-
| <syntaxhighlight lang=apl inline>∪</syntaxhighlight> || [[Unique]]            || [[Union]]
|-
| <syntaxhighlight lang=apl inline>⊣</syntaxhighlight> || [[Identity|Same]]    || [[Left Identity|Left]]
|-
| <syntaxhighlight lang=apl inline>⊢</syntaxhighlight> || [[Identity|Same]]    || [[Right Identity|Right]]
|-
| <syntaxhighlight lang=apl inline>⍳</syntaxhighlight> || [[Index Generator]]  || [[Index Of]]
|-
| <syntaxhighlight lang=apl inline>⍸</syntaxhighlight> || [[Where]]            || [[Interval Index]]
|-
| <syntaxhighlight lang=apl inline>⍒</syntaxhighlight> ||colspan=2| [[Grade Down]]
|-
| <syntaxhighlight lang=apl inline>⍋</syntaxhighlight> ||colspan=2| [[Grade Up]]
|-
| <syntaxhighlight lang=apl inline>⍷</syntaxhighlight> ||                      || [[Find]]
|-
| <syntaxhighlight lang=apl inline>≡</syntaxhighlight> || [[Depth]]            || [[Match]]
|-
| <syntaxhighlight lang=apl inline>≢</syntaxhighlight> || [[Tally]]            || [[Not Match]]
|-
| <syntaxhighlight lang=apl inline>⍎</syntaxhighlight> ||colspan=2| [[Execute]]
|-
| <syntaxhighlight lang=apl inline>⍕</syntaxhighlight> ||colspan=2| [[Format]]
|-
| <syntaxhighlight lang=apl inline>⊥</syntaxhighlight> ||                      || [[Base]]
|-
| <syntaxhighlight lang=apl inline>⊤</syntaxhighlight> ||                      || [[Represent]]
|-
| <syntaxhighlight lang=apl inline>⌹</syntaxhighlight> || [[Matrix Inverse]]    || [[Matrix Divide]]
|-
| <syntaxhighlight lang=apl inline>⌷</syntaxhighlight> || [[Materialise]]      || [[Index (function)|Index]]
|}
 
=== Operators ===
 
{|class=wikitable
! Syntax                                !! Monadic call        !! Dyadic call
|-
| <syntaxhighlight lang=apl inline>f/</syntaxhighlight>  || [[Reduction]]      || [[Windowed Reduction]]
|-
| <syntaxhighlight lang=apl inline>f⌿</syntaxhighlight>  || [[Reduction First]] || [[Windowed Reduction First]]
|-
| <syntaxhighlight lang=apl inline>f\</syntaxhighlight>  || [[Scan]]            ||
|-
| <syntaxhighlight lang=apl inline>f⍀</syntaxhighlight>  || [[Scan First]]      ||
|-
| <syntaxhighlight lang=apl inline>f¨</syntaxhighlight>  ||colspan=2| [[Each]]
|-
| <syntaxhighlight lang=apl inline>f⍨</syntaxhighlight>  ||colspan=2| [[Commute]]
|-
| <syntaxhighlight lang=apl inline>A⍨</syntaxhighlight>  ||colspan=2| [[Constant]]
|-
| <syntaxhighlight lang=apl inline>f⍣v</syntaxhighlight>  ||colspan=2| [[Power (operator)|Power]]
|-
| <syntaxhighlight lang=apl inline>f.g</syntaxhighlight>  ||                    || [[Inner Product]]
|-
| <syntaxhighlight lang=apl inline>∘.f</syntaxhighlight>  ||                    || [[Outer Product]]
|-
| <syntaxhighlight lang=apl inline>A∘g</syntaxhighlight>  ||rowspan=2| [[Bind]]  ||
|-
| <syntaxhighlight lang=apl inline>f∘B</syntaxhighlight>  ||
|-
| <syntaxhighlight lang=apl inline>f∘g</syntaxhighlight>  ||colspan=2| [[Beside]]
|-
| <syntaxhighlight lang=apl inline>f⍤B</syntaxhighlight>  ||colspan=2| [[Rank operator|Rank]]
|-
| <syntaxhighlight lang=apl inline>f⍤g</syntaxhighlight>  ||colspan=2| [[Atop]]
|-
| <syntaxhighlight lang=apl inline>f⍥g</syntaxhighlight>  ||colspan=2| [[Over]]
|-
| <syntaxhighlight lang=apl inline>f@v</syntaxhighlight>  ||colspan=2| [[At]]
|-
| <syntaxhighlight lang=apl inline>f⍠B</syntaxhighlight>  ||colspan=2| [[Variant]]
|-
| <syntaxhighlight lang=apl inline>f⌸</syntaxhighlight>  ||colspan=2| [[Key]]
|-
| <syntaxhighlight lang=apl inline>f⌺B</syntaxhighlight>  || [[Stencil]]        ||
|-
| <syntaxhighlight lang=apl inline>A⌶</syntaxhighlight>  ||colspan=2| [[I-beam]]
|-
| <syntaxhighlight lang=apl inline>f&</syntaxhighlight>  ||colspan=2| [[Spawn]]
|-
| <syntaxhighlight lang=apl inline>f[B]</syntaxhighlight> ||colspan=2| [[Function axis|Axis]]
|}
 
== 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 ===
 
Dyalog uses the following [[numeric]] types:
* 1-bit packed [[Boolean]]
* 1-byte integer
* 2-byte integer
* 4-byte integer
* 8-byte [[wikipedia:IEEE 754|double]]
* 16-byte [[complex]] (one double for each component)
* 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]].
 
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.
* In [[Dyalog APL versions#18.0|18.0]] only, [[wikipedia:CLMUL instruction set|CLMUL]] is used for [[xor]] [[reduction]]s and [[scan]]s.
* In [[Dyalog APL versions#18.0|18.0]] only, [[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 ==


[https://dyalog.com Dyalog website]
* [https://tryapl.org TryAPL]
* [https://tio.run/#apl-dyalog Try It Online]
* [https://dyalog.com Download]
 
== References ==
<references/>


{{APL programming language}}
{{APL dialects}}[[Category:Dyalog APL| ]][[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]][[Category:.NET]]

Latest revision as of 11:10, 24 September 2024

"Dyalog" redirects here. For the company, see Dyalog Ltd.

Dyalog APL, or simply Dyalog, is a nested APL based on NARS and APL2, first released by British company Dyadic Systems Ltd. (now Dyalog Ltd.) in 1983 for the 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, Lisp-style lexically scoped anonymous functions (dfns), and 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 shared libraries, .NET, the JVM, R, and Python.

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, dzaima/APL, and April. 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 trains among nested APLs.

History

See also: 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 Zilog UK, Dyadic developed an interpreter using the C programming language for the Zilog Z8000's 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 model rather than adding boxes 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.[1]

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 SimCorp. In 1991, Dyadic hired John Daintree to begin work on the ⎕WC graphical user interface for Microsoft Windows; Dyalog for Windows debuted at APL92 and quickly become Dyalog's main platform.[1]

In 1996, John Scholes introduced a new form of functional definition to Dyalog based on his studies of the functional programming language Scheme, which he called dfns, for "direct functions". 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 namespaces which he had added to the language in 1994 to deliver a Windows GUI API and an interface to COM/OLE, Daintree developed an object model for Dyalog, based on concepts from C# and Visual Basic.

In 2005, Dyadic transferred management to CEO Gitte Christensen and CTO Morten Kromberg, and sold ownership of the company to a group of investors including their company Insight Systems. With this arrangement, the development team at Dyalog grew rapidly. Dfns were promoted as "mainstream" APL features, with the result that many newer APLs only support dfns, abandoning traditional defined functions completely. Daintree's work on objects resulted in the addition of full object oriented programming capabilities to Dyalog APL in 2006. The influence of the Microsoft's .NET Framework also led to a project to create a new language called APL#, prototypes of which were released in 2010. The project was abandoned in 2012 when Microsoft deprecated Silverlight.

In addition to functional and object oriented language features, Dyalog APL folded concepts and features from the SHARP APL and J side of the APL family tree back into what fundamentally remains a dialect of APL2. In 2011 the company hired Roger Hui, developer of J, and in 2016 it also hired J programmer and language implementer Marshall Lochbaum. Both developers improved performance of Dyalog's primitives on flat arrays, and brought concepts such as the Rank operator, trains, and composition operators, namely Atop and Over, from J to APL.

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. Hui and Lochbaum also improved performance of Dyalog's primitives on flat arrays.

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 commands based on it, in 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:

Distribution Action
Debian 8.2, 9.8, 9.9 no pre-reqs
Fedora 29, 30 dnf install ncurses-compat-libs
Linux Mint 18.0, 19.0 no pre-reqs
openSUSE 15.0 zypper install libncurses5
CentOS/RedHat 6 not supported for 17.1 as glibc is at too low a level
CentOS/RedHat 7 no pre-reqs
RedHat 8 rpm -Uvh ncurses-compat-libs (note: RH8 would not install in a VM)
Ubuntu 16.04, 18.04 no pre-reqs
Ubuntu 19.04 apt-get install libtinfo5

Versions

Main article: Dyalog APL versions

Dyalog lists historical versions, along with release notes since 14.0, on its website. Its early history is recounted in more detail by Pete Donnelly in Dyalog APL: A Personal History (pdf).

Number Year Month Features
1 1983 April (Zilog S8000 only)
2 1984 (Many more platforms)
3.0 1985 (More platforms) Rectangular display of arrays
4.0 1986 October User-defined operators, function assignment (including for derived functions), ⎕MONITOR
5.0 1987 April Nested array editor
5.1 1988 April (first version for DOS) User-defined input/output tables, ⎕SM and ⎕SR, windowed editor/tracer, interface to GSS/CGI
5.2 1990 January Naked trace
6.0 1990 April GUI IDE
6.1 1990 October ⎕ED
6.2.1 1992 July (first version for Windows) ⎕WC, ⎕DQ, etc.
6.3.1 1993 April ⎕NA, graphical, clipboard and printer objects
7.0.1 1994 August Namespaces, additional GUI objects
7.1 1995 May ⎕CS, GUI objects as namespaces, greater APL2 compatibility
8.0 1996 May Keywords (:If/:Else, :Repeat/:Until, :Trap, and so on), ⎕PATH, additional GUI objects, OLE
8.1 1997 March dfns with lexical scope, syntax colouring, TCPSocket object, OLE client/server, automatic file tie numbers
8.2 1999 January Windowed Reduction and scalar functions with axis (from APL2), Threading with Spawn (&), ActiveX, :With, additional GUI objects
9.0 2000 September Namespace references (instead of string names) and dot syntax, context-sensitive help (F1), aditional GUI objects with animation
9.0.1 2001 January (Windows CE) Pocket APL
9.0.2 2002 January .NET support
9.5 2002 September
10.0 2003 March ⎕NULL, ⎕MAP (mapped files), idiom recognition, retained hash tables, .NET support built-in, run-time workspace as .exe, auto-completion, mapped
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 C#, Index (), Power operator (), GCD (), LCM ()
12.0 2008 August Unicode support (⎕AVU, ⎕UCS), ⎕FCOPY, ⎕FPROPS
12.1 2009 November I-beam (), Table (), ⎕XML, ⎕FCHK, User commands
13.0 2011 April Left (), Right (), Variant (), ⎕OPT, ⎕R, ⎕S, ⎕PROFILE, ⎕RSI, complex number and decimal float support, short arguments for Take, Drop, and Index (, , )
13.1 2012 April ⎕DMX, ⎕FHIST
13.2 2013 January Array Editor
14.0 2014 June Trains, Tally (), Key (), Rank operator (), high-rank Index Of (), multi-threading with futures and isolates
14.1 2015 June :Disposable .NET objects and resources, gesture support, many new I-beams
15.0 2016 June ⎕MKDIR, ⎕NDELETE, ⎕NEXISTS, ⎕NGET, ⎕NINFO, ⎕NPARTS, ⎕NPUT
16.0 2017 June At (@), Interval Index (), Where (), Nest (), Partition (), Stencil (), ⎕JSON, ⎕CSV
17.0 2018 July ⎕NCOPY, ⎕NMOVE, total array ordering, high-rank Unique ()
17.1 2019 October Duplicates in Interval Index () look-up array
18.0 2020 June Atop (), Over (), Constant (), Unique Mask (), duplicates from Where (), empty partitions from Partitioned Enclose (), date-time conversion (⎕DT), case folding/mapping (⎕C), launching with text source file, .NET Core support
18.2 2022 March ⎕ATX, shell scripting
19.0 2024 March 64-bit ARM (macOS and Raspberry Pi) support, last version for intel macOS, ⎕TALLOC, Health Monitor protocol, multi-line session input, JSON-format session logs

Primitives

Functions

Glyph Monadic Dyadic
+ Conjugate Plus
- Negate Minus
× Direction Times
÷ Reciprocal Divide
| Magnitude Residue
Floor Minimum
Ceiling Maximum
* Exponential Power
Natural Logarithm Logarithm
! Factorial Binomial
Pi Times Circular
~ Not Without
? Roll Deal
And
Or
Nand
Nor
< Less
Less Or Equal
= Equal
Greater Or Equal
> Greater
Unique Mask Not Equal
Shape Reshape
, Ravel Catenate
Table Catenate First
Reverse Rotate
Reverse First Rotate First
Transpose
Mix/First Take
Split Drop
Enclose Partitioned Enclose
Nest Partition
Enlist/Type Membership
First/Mix Pick
/ Replicate
Replicate First
\ Expand
Expand First
Intersection
Unique Union
Same Left
Same Right
Index Generator Index Of
Where Interval Index
Grade Down
Grade Up
Find
Depth Match
Tally Not Match
Execute
Format
Base
Represent
Matrix Inverse Matrix Divide
Materialise Index

Operators

Syntax Monadic call Dyadic call
f/ Reduction Windowed Reduction
f⌿ Reduction First Windowed Reduction First
f\ Scan
f⍀ Scan First
Each
f⍨ Commute
A⍨ Constant
f⍣v Power
f.g Inner Product
∘.f Outer Product
A∘g Bind
f∘B
f∘g Beside
f⍤B Rank
f⍤g Atop
f⍥g Over
f@v At
f⍠B Variant
f⌸ Key
f⌺B Stencil
A⌶ I-beam
f& Spawn
f[B] Axis

Implementation

Dyalog APL is implemented primarily in C with some parts implemented in C++ in order to use templates. C intrinsics are used to access instruction set extensions. Some architecture-specific assembly, both compiled separately and inline from C, is used for functionality like exception flags which is not easily accessible in C. Prior to version 17.0, assembly was also used for vectorized arithmetic. In 17.0, this code was replaced by a new C++ implementation.

Internal types

Dyalog uses the following numeric types:

  • 1-bit packed Boolean
  • 1-byte integer
  • 2-byte integer
  • 4-byte integer
  • 8-byte double
  • 16-byte complex (one double for each component)
  • 16-byte decimal float "decf" (BID or 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 code point values.

Nested and mixed arrays (that is, pointer arrays) are always stored as arrays of pointers, while 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 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 functions was unified and extended to allow Intel AVX2 and ARM NEON in addition to Intel SSE2 and 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 functions, as well as some functions derived from operators applied to these functions, such as the Outer Product and Inner Product.

Dyalog also uses many other x86 extensions:

It also uses the POWER8 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

References

  1. 1.0 1.1 Stephen Taylor. "How we got here". Vector journal Volume 23 special supplement "Dyalog at 25". 2008-09.


APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000PometoTinyAPL
Historical A Programming LanguageA+ (A) ∙ APL#APL2CAPL\360APL/700APL\1130APL\3000APL.68000APL*PLUSAPL.jlAPL.SVAPLXExtended Dyalog APLIverson notationIVSYS/7090NARSngn/aplopenAPLOperators and FunctionsPATRowanSAXSHARP APLRationalized APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLBQNCoSyELIGleeIIvyJJellyK (Goal, Klong, Q) ∙ KamilaLispLang5LilNialRADUiua
Overviews Comparison of APL dialectsTimeline of array languagesTimeline of influential array languagesFamily tree of array languages