Questions tagged [apl]

APL (named after the book A Programming Language) is an interactive array-oriented language. It is based on a mathematical notation developed by Kenneth E. Iverson. Do not use this tag for Alexa Presentation Language; use [alexa-presentation-language] instead.

Wiki

APL, short for A Programming Language, is an interactive array-oriented language and integrated development environment. It is an interpreted language with built-in array capabilities and outstanding debugging features that makes the language a perfect choice for the agile approach. APL is also the first functional programming language ever, and it is also considered as a tacit programming language.

Example

APL uses symbols, array comprehension, and implied Iverson brackets to make its code concise and enable thinking about it much like Mathematical formulas.

This example assigns the vector (list) value 4 5 6 7 to N:

N ← 4 5 6 7 

The code below then adds 4 to all elements of the vector (giving 8 9 10 11):

N + 4

Now we can get a Boolean mask indicating results of 10 or higher (giving 0 0 1 1):

10 ≤ N + 4

And sum that to find out how many sums fulfilled the criteria (giving 2):

+/ 10 ≤ N + 4

Tag usage

The tag should be used for programming related problems in implementing or using the APL programming language. Please avoid theoretical and conceptual questions on Stack Overflow. Other tags such as , or can also be used with tag . Make sure to specify which dialect you use, for example by using the tag.

Read more

341 questions
1
vote
2 answers

How do I create a time string from a number of seconds in APL?

I would like to turn a number-of-seconds-since midnight into an HH:MM:SS formatted string. For example, the number 17672 should turn into the string '04:54:32'. I can do the math to get the integer components, like so: T←17672 H←⌊T÷3600 …
Ray Toal
  • 86,166
  • 18
  • 182
  • 232
1
vote
1 answer

How to open Dyalog APL mapped file

I am trying to disable some image processing code in a digital camera firmware. From the firmware dump, I found some *.bin files with magic number that corresponds to "Dyalog APL mapped file 64-bit version 19.145" (from unix file command). After…
Hendrik Poernama
  • 413
  • 3
  • 14
1
vote
2 answers

Interesting bug in APL2 on IBM Mainframe regarding ⊥

In this environment we measure efficiency in number of consumed Service Units. I'll convert the current dateTime to milliseconds to illustrate the bug: 0 100 100 100 100 100 1000⊥⎕TS ⍝ this statement consumes around 150 SUs 0 100 100 100 100…
mappo
  • 444
  • 2
  • 9
1
vote
1 answer

Multiply Vector Elements by Vector to Return a Square Matrix

I am fairly new to APL and am struggling to multiply each element of a vector v by the vector in such a fashion that it returns an n x n square matrix where n is the length of the vector. For example, v ← 1 0 0 1. I have attempted to create a…
toeknee97
  • 13
  • 2
1
vote
4 answers

APL / APLX - What does the Omega (⍵) do?

I'm learning APL through APLX. I see a lot of code using the omega character, but whenever I try to look up what it means, I can't find any information. None of the APLX documentation mentions it, yet it appears in some of the sample code in the…
ren
  • 270
  • 2
  • 15
1
vote
1 answer

APL / APLX: value error when using an if statement inside a for loop

I'm attempting to implement quicksort in APLX, but I can't seem to fix this value error I keep getting from the statement :If((ITEM COMPARE PIVOT)≤0). After some testing, I believe the problem lies with the fact that I am using an If statement…
ren
  • 270
  • 2
  • 15
1
vote
2 answers

Dyalog APL language bar is missing

I have just installed Dyalog APL and I can't see language bar above as well as other bars. No prior configuration was done. OS is Windows 7. Here you can see my window and normal look of it. Normal look My window How can I fix it? Thanks!
Dasha
  • 327
  • 2
  • 10
1
vote
1 answer

Forms loosing caption on W10

I'm sorry, this will be a no-code question, but I think it is still the right place to ask. I'm using the (unfortunately) not so famous language APL and am having problems running my apps under W10 - the forms are shown without a caption: Only when…
MBaas
  • 7,248
  • 6
  • 44
  • 61
1
vote
3 answers

How do I implement accumulation in APL?

Consider the following simple piece of code: a ← ⍳5 el1 ← a+2 el2 ← +/el1 el1 el2 ┌─────────┬──┐ │3 4 5 6 7│25│ └─────────┴──┘ I am simply adding 2 to a and summing the array up, then returning array containing results of both…
syntagma
  • 23,346
  • 16
  • 78
  • 134
1
vote
2 answers

APL return value of a function

I want to know how to return a value after my function finishes running. I have, for example: FUNCTION X ? X ⍴ 10 //This means, generate X random numbers (X is the function's argument) within the range 1-10. I just want to know how I can return the…
idelara
  • 1,786
  • 4
  • 24
  • 48
1
vote
1 answer

Pollard Rho implementation in APL

Recently, I have tried to work using APL but have had difficulty conceptualizing it. For instance, let's say I want to make a program g<-pollard x, where the function computes if a number x is prime or factorable through the Pollard-Rho method. I…
user17103
  • 51
  • 3
1
vote
2 answers

How is each operator optimized by the APL interpreter?

I am wondering whether I should heavily use the each operator when using APL or should I try to find another solution to a given problem? How is usage of this operator optimized in APL?
syntagma
  • 23,346
  • 16
  • 78
  • 134
1
vote
2 answers

Cross-platforming C++ functions to APL

I am currently writing C++ programs for APL. Up to now, what I've been doing is creating a function in APL, which runs the command prompt and calls the executable, with input and output files it creates as parameters and in turn, the C++ executable…
SS-Mag
  • 38
  • 5
1
vote
1 answer

Why does reducing with concatination give a scalar in APL?

Note that I'm using Dyalog APL for the following. Given: S←'string' S string ⍴S 6 ⍴⍴S 1 DISPLAY S ┌→─────┐ │string│ └──────┘ If I perform a reduction with concatenation, I get a scalar: S_←,/S S_ string …
Sean Kelleher
  • 1,952
  • 1
  • 23
  • 34
1
vote
1 answer

What are {curly brackets} for in Gnu-Apl?

What are {curly brackets} for in GNU-APL? As far as I know, GNU-APL uses the APL Iso standard.
Anon
  • 2,267
  • 3
  • 34
  • 51