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
0
votes
2 answers

Replacing specific elements in a table with a specific element from a range in APLX

I'm learning a spread of programming languages in a class, and we're working on an APLX project at the moment. A restriction we have to work around is we cannot use If, For, While, etc. No loops or conditionals. I have to be able to take a plane…
Susannah Potts
  • 837
  • 1
  • 12
  • 32
0
votes
1 answer

Operating on return values from a different function in APL

HAND←DEAL N;ROWS;SCORES ROW←N×7 HAND←N 7⍴CHARS[?ROWS ⍴ 36] This is a function I have created in APL. User specifies value of N (1-5) which determines the amount of license plates this program generates. The license plates are then stored in…
collinskewl2
  • 75
  • 1
  • 3
0
votes
3 answers

Remove leading, trailing and multiple space within a string in APL

I've written a dfn in APL to remove leading, trailing and multiple space. Is there any other way to further improve it? {a←(⍵∊' ') ⋄ b←((¯1↓(a,0)×(1,a))+(⌽∧\(⌽⍵)=' '))=0 ⋄ b/⍵} ' sad as asdasd asd ' o/p sad as asdasd asd
user3263192
  • 499
  • 1
  • 4
  • 14
0
votes
1 answer

What does "comma bar" mean?

Please pardon my ignorance. I'm translating some APL to another format, and can't find anywhere what the function/meaning of a "comma bar" is. Not sure if this will come through, but it looks like this "⍪", and is encoded by U+236A. It appears…
gruvn
  • 692
  • 1
  • 6
  • 25
0
votes
2 answers

APLX to remove single 1s from a mask

Does someone know how to remove sinlge 1s from a bit mask using APLX? Example: 1 0 1 1 1 0 0 1 0 1 to 0 0 1 1 1 0 0 0 0 0 Hints greatly appreciated.
0
votes
1 answer

APLX Char vector to a Integer Vector

How do I convert from a char vector AKQJT98765 to a vector of integers 13 12 11 10 9 8 7 6 5 using APLX? I have tried the data conversion function, without succcess.
0
votes
3 answers

In APL, how can I compute the lowest unused positive integer from a given set of integers?

For example, given 1 8 4 9 0 2 , return 3. Thanks.
Paul Mansour
-1
votes
1 answer

Rank limit error on GNU APL 64-bit windows

I have an old APL application that runs on DOS that performs FFT and IFFT. It generates a rank limit error on GNU APL. With a workspace of 55 GB there should be no limit on rank or symbols. The only limit that makes sense is a user settable…
MLS
  • 41
  • 1
-1
votes
1 answer

How to Count Isolated Square Segments in an Array?

I'm trying to implement an APL program (ClosedSeg) that could count the total amount of isolated square segments in an array of Boolean. For example: arr1 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 ClosedSeg arr1 ⍝ Four…
-2
votes
2 answers

APL Bridge Game

I am trying to code a game of Bridge in APL the part I'm stuck on is when printing hands I want to return 4 separate hands to be scored of all random cards and I want to sort the cards by suit first and then within the suits sort by Ace to two I am…
-3
votes
1 answer

Print first n odd numbers in APL

I just started exploring APL. Though, familiar with C++ and python, I got stuck executing a simple program 'Print first n odd numbers' where n is the input in APL. Please help APL coders.
user2373347
1 2 3
22
23