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
2
votes
1 answer

Debugging APL code: how to use `@`(index) and `⊢` (right tack) together?

I am attempting to read Aaron Hsu's thesis on A data parallel compiler hosted on the GPU, where I have landed at some APL code I am unable to fix. I've attached both a screenshot of the offending page (page number 74 as per the thesis numbering on…
Siddharth Bhat
  • 823
  • 5
  • 15
2
votes
2 answers

Multi-line inputs in RIDE (APL)?

I wish to type in a multi-line array as follows: ast ← ('∘' ('a' ('p')) ('b' ('q' ('v')) ('r')) ('c' ('s' ('w' 'x')) ('t' ('y' 'z')))) This is correctly…
Siddharth Bhat
  • 823
  • 5
  • 15
2
votes
1 answer

Error while loading DyalogTutor_EN workspace in Dyalog APL, how to proceed?

I am unable to load the DyalogTutor_EN.dws file in Dyalog APL for Mac. The error is "There was an error ("TRANSLATION ERROR") with the specified file". How do I load this file in order to follow the book Mastering Dyalog APL which uses examples from…
sourav.d
  • 122
  • 7
2
votes
1 answer

Is there a way to ⎕NA import a dll exported C++ class in dyalog APL?

I have a .dll which exports a C++ class. Is there some way to use ⎕NA to import this class into Dyalog APL? I am looking at the DLL Export Viewer, and my class is exporting the way I expect. I have also written a C++ test application which imports…
Nathan
  • 463
  • 1
  • 4
  • 9
2
votes
1 answer

Why is ⎕SIGNAL not caught by :: error guards?

{11::¯1 ⋄ 2÷0}⍬ ¯1 {11::¯1 ⋄ ⎕SIGNAL 11}⍬ DOMAIN ERROR Why is the first signal caught, while the second is not?
Tobia
  • 17,856
  • 6
  • 74
  • 93
2
votes
2 answers

APL programming - How can I convert a simple matrix into a picture?

I'm fairly new to APL and I would like to convert a 4x4 binary matrix into an image composed of black and white squares - the sort of thing found here. Documentation says that it's possible using ⎕WC to create a GUI object and then stating the Bits…
awyr_agored
  • 613
  • 3
  • 19
2
votes
3 answers

APL - How can I find the longest word in a string vector?

I want to find the longest word in a string vector. Using APL I know that the shape function will return the length of a string e.g. ⍴ 'string' ⍝ returns 6 The reduce function allows me to map diadic functions along a vector but since shape is…
awyr_agored
  • 613
  • 3
  • 19
2
votes
3 answers

Getting the type of a value in APL

I have a long vector which should be a character vector but when I print it using Dyalog's DISPLAY function it turns out to be a mixed vector. Now I need to find out which of the elements is not a character. How do I retrieve the type of a value in…
August Karlstrom
  • 10,773
  • 7
  • 38
  • 60
2
votes
5 answers

APL Idiom to surround an array with zeros

Is there a simple idiom in (Dyalog) APL to surround a numeric array with zeros? Currently for a numerical array NA of rank 1, or a vector I use 0,⍨0, NA and for an array of rank 2 I use 0,[1]⍨0,[1]0,⍨0, NA For higher ranks I could just repeat the…
Probie
  • 1,371
  • 7
  • 15
2
votes
1 answer

Apply a function to a random row of a matrix

I have a 5x5 matrix M and a function f that operates on vectors. r ← ⊃?⍴M is the index of a random row of M. I need to return a modified version of M without direct assignment (it's important for the larger program) where f is only applied to r⌷M.…
Ian Martin
  • 95
  • 6
2
votes
3 answers

Interprocess Communications between Dyalog APL and q

How would I connect a Dyalog APL Client to reach out to a q server and execute a simple transaction (like "2+2")? The protocol seems simple enough and very well documented when it comes to decoding the answer, but I can't seem to get past the very…
Lurgid Bee
  • 63
  • 7
2
votes
1 answer

APL Dyalog Nested Array Element Transformations

I've been using Dyalog APL for a class assignment and I've run across an issue in transforming each element of a nested array. I have a character array called HOLD which has a variable amount of 7 character long arrays in it. Using a split…
2
votes
1 answer

using dyalog apl to access )fns function in a script function

I'm trying to use Dyalog APL to generate a function list from within a startup script using: ⍎ ')fns' but get this error: ⍎VALUE ERROR Using ⍎ ')fns' in a latent expression script in APLX is not a problem, but I get clobbered doing the same thing…
user3161399
  • 253
  • 2
  • 6
2
votes
4 answers

Multi-line text values in Dyalog APL

How to code a multi-line text value in Dyalog APL? I want to code something like this: query←' SELECT * FROM SOME_TABLE ' to be able to copy this text to SQL Developer and back. I know that I could code it this way: query←'' query,←'SELECT *…
Olexa
  • 577
  • 2
  • 16
2
votes
1 answer

Filtering rows by column value

I have this simple d-fn in Dyalog: {⍺,≢⍵} ⌸ 'koala' , which returns: k 1 o 1 a 2 l 1 I want to filter rows from the resulting array, so that (for example, for filter value=2), I would get: a 2 l 1 In general, I would like to know how to operate…
syntagma
  • 23,346
  • 16
  • 78
  • 134