Questions tagged [dyalog]

"Dyalog" refers to the APL implementation developed and distributed by British company Dyalog Ltd. Dyalog APL includes many additions over the ISO standard for APL. This tag should be used in addition to [apl] when asking for help with language features specific to Dyalog APL, or when a solution using such features is acceptable.

Dyalog APL, or simply Dyalog, is a nested APL by British company Dyalog Ltd. The name Dyalog is a portmanteau of Dyadic and Zilog since it was initially released for the Zilog Z8000 processor in 1983. Continuously developed since, Dyalog has added numerous core language features, and 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.

Example

This defines m as a 4-row, 3-column matrix consisting of the first 12 natural numbers:

      m ← 4 3 ⍴ ⍳ 12

Now we can sum the columns:

      +⌿ m
22 26 30

Counting the number of rows:

      ≢ m
3

Average of each column using an anonymous tacit function:

      ( +⌿ ÷ ≢ ) m
5.5 6.5 7.5

Tag usage

This tag should be used together with (in addition to more subject-specific tags) when asking about features limited to Dyalog APL and similar dialects, or when asking for code to complete a task, and a solution using Dyalog features is acceptable. Due to the rapid development of the language, it is beneficial to also include which version number is used, e.g. 17.1 or 18.0.

Learn more

146 questions
11
votes
4 answers

Where can I learn APL?

I want to learn APL (more specifically Dyalog APL), but I can't seem to find any good sources to learn from. The only source I could find was Dyalog's Documentation Downloads, but other than that, can anyone recommend a good source?
Ankit
  • 1,861
  • 18
  • 18
6
votes
1 answer

Issue with declaring multiline functions in APL

#!/usr/bin/dyalog -script ⍝ /usr/bin/dyalog is a symlink to /opt/mdyalog/18.0/64/unicode/mapl factors←{⎕ML ⎕IO←1 ⋄ ⍵{ ⍵,(⍺÷×/⍵)~1}∊⍵{(0=(⍵*⍳⌊⍵⍟⍺)|⍺)/⍵}¨⍬{nxt←⊃⍵ ⋄ msk←0≠nxt|⍵ ⋄ ∧/1↓msk:⍺,⍵ ⋄ (⍺,nxt)∇ msk/⍵}⍵{…
Perigord
  • 111
  • 6
6
votes
3 answers

unwanted: APL keyboard overlay enabled?

I've been trying out APL. I'm running Windows 10 and I've installed Dyalog 18.0, and the APL Language and APL Backtick Symbols extentions for VS Code. But even though I'm not running any of these programs, sometimes suddenly my keyboard is hyjacked!…
JHBonarius
  • 10,824
  • 3
  • 22
  • 41
6
votes
1 answer

How is `{⊂⍵}` different from just `⊂`?

I'm reading through Hui and Kromberg's recent "APL Since 1978" and in the discussion of ⌺ (stencil) they give the following example: {⊂⍵}⌺5⊢'abcde' abc abcd abcde bcde cde Why is the {⊂⍵} needed over just ⊂? I'm still pretty new to…
ssfrr
  • 343
  • 2
  • 5
6
votes
1 answer

Error Handling in APL

I am currently working on an APL program for a class and have run into an issue with error handling. In a function I made, I want to check to see that the input is an integer. If it is not, I want to return an error message and not run the rest of…
JSON K.
  • 131
  • 1
  • 7
6
votes
3 answers

rank operator vs axis notation

I had a sneak peek at APL2 on the mainframe a number of years ago and remember being shown solutions to the problem of adding a vector to a matrix. Given a←4 4 ⍴ ⍳16 and ⎕io←1 The old way of adding a vector to the rows was something like a+(⍴a)⍴10…
Apollo 42
  • 95
  • 6
5
votes
2 answers

Vector of functions in APL

What is the syntax for a vector (array) of functions in APL? I have tried the following but these are interpreted as a 3-train and a 2-train, respectively: {1},{2} {1} {2} PS. I am looking to do this with more complex (and possibly named)…
P Varga
  • 19,174
  • 12
  • 70
  • 108
5
votes
1 answer

Explanation of quicksort in APL

I am attempting to understand the classic quicksort in APL: Q←{1≥≢⍵:⍵ ⋄ S←{⍺⌿⍨⍺ ⍺⍺ ⍵} ⋄ ⍵((∇S))⍵⌷⍨?≢⍵} There are some things I don't understand, and some stylistic choices that bother me, so I'm going to list all of them out. I hope…
Siddharth Bhat
  • 823
  • 5
  • 15
5
votes
3 answers

Creating a vector of closures in Dyalog

I would like to define a vector of anonymous functions that take a single parameter, then map a parameter x across this vector, returning an array of the results of f(x) for each index. Is this possible in Dyalog? I ask because my naive attempt at…
Ian Martin
  • 95
  • 6
5
votes
6 answers

How to interleave two given vectors in APL

I'm trying to solve a problem using APL, for which I have two vectors v1 and v2, with relative length of at most +1, depending on the input. That means that ((≢v1)-(≢v2))∊¯1 0 1. What would be the best way to interleave said vectors, so to create a…
J. Sallé
  • 213
  • 1
  • 8
5
votes
5 answers

"APL Object Notation" in Dyalog APL

How to convert any Dyalog APL value to a character vector that could be passed to ⍎ to get the same value? How this is expected to look like: x←2 3⍴⍳6 x←1,⊂x x←x,⊂'foo' y←desired_function x DPX…
Olexa
  • 577
  • 2
  • 16
5
votes
3 answers

Understanding APL's Inner Product

Here is an excerpt from the Mastering Dyalog APL book, from the chapter on Inner Products: HMS is a variable which contains duration in Hours, Minutes, and Seconds: HMS ← 3 44 29 Chapter J – Operators 397 We would like to convert it into seconds.…
syntagma
  • 23,346
  • 16
  • 78
  • 134
4
votes
1 answer

APL Fork/Train with Compression

I want to select elements from an array based on some test. Currently, I am trying to do that with a compression, and I would like to write it as a tacit function. (I'm very new to APL, so feel free to suggest other options.) Below is a minimal…
j_v_wow_d
  • 511
  • 2
  • 11
4
votes
2 answers

Cannot use user commands in Dyalog APL

I just installed Dyalog-APL 18.0 on my windows(Windows 10) machine and when I tried using ]box on -style=max on the IDE I got the following error: FILE ACCESS ERROR: C:/Users//Documents/: Unable to read directory status Then I noticed that…
MrV
  • 169
  • 1
  • 7
4
votes
2 answers

How can I mask the scan operator in APL?

Assuming I have an array N ← 0 0 0 1 1 1 0 0 1, how can I apply the scan \ to achieve the array 0 0 0 1 2 3 0 0 1? +\N gives me 0 0 0 1 2 3 3 3 4 which is not what I want. +\¨⊆⍨N gives me | 1 2 3 | 1 | which is closer, but then I lose the…
mazin
  • 395
  • 2
  • 7
1
2 3
9 10