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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
60 views

Dyalog APL: How to execute a function regardless of errors?

I have a function with the code (borrowed here https://github.com/mkromberg/websocket-demo) assert 0=⊃res←iConga.Clt''WSHOST WSPORT'http' 100000('X509'(⎕NEW iConga.X509Cert))('Options'iConga.Options....
конструктор's user avatar
1 vote
0 answers
39 views

Apply a list of functions on the same right operand

I have 3 functions which return parse_apple 1 'bpple4578' ┌─┬─────────┐ │0│bpple4578│ └─┴─────────┘ parse_bpple 1 'bpple4578' ┌─┬────┐ │1│4578│ └─┴────┘ parse_45 1 'bpple4578' ┌─┬─────────┐ │0│...
Akanoa's user avatar
  • 33
1 vote
1 answer
242 views

Filter a list of list based on data

I've this data x ← ((1 'data1') (0 'data2') (0 'data3') (1 'data4') ) x ┌─────────┬─────────┬─────────┬─────────┐ │┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│┌─┬─────┐│ ││1│data1│││0│data2│││0│data3│││...
Akanoa's user avatar
  • 33
4 votes
1 answer
70 views

Dyalog APL: How to filter an array like filter()

I need to filter out from the array (namespaces) all values that do not fulfil the required condition: field 'status' = 'TRADING' I use this variant tmpSymbolsT←(data←⎕JSON(HttpCommand.Get'api.binance....
конструктор's user avatar
3 votes
1 answer
93 views

Dyalog APL: what is the problem with loops?

I'm trying to process data received via API using a loop, but the loop is very slow. Is this a Dyalog bug? res←getBinanceSymbols res←⍬ baseToken←'USDT' tmpSymbols←(⎕JSON(HttpCommand.Get'api....
конструктор's user avatar
2 votes
1 answer
53 views

Dyalog APL: Check if a field exists in JSON?

The task is to check if there is an "s" field in the JSON, I've tried to do this as follows: ⍝ Example JSON I'm working with JSON ← '{"e":"depthUpdate","E"...
конструктор's user avatar
2 votes
1 answer
74 views

How can I read one byte from stdin in Dyalog APL?

I’m trying to make a terminal user interface in Dyalog APL and need a way to read a single byte of user input from stdin. How can I do this? In Python for example, you can use sys.stdin.read(1). I’ve ...
rabbitgrowth's user avatar
2 votes
1 answer
65 views

How do I make sleep in Dyalog APL?

How to implement an analogue of Sleep() function in Dyalog APL? Task context: I have a CSV file, and for each line where I call a function, the function makes a network request, and because of their ...
конструктор's user avatar
2 votes
2 answers
70 views

Dyalog APL: convert JSON to a pure array

How to convert JSON to a pure array? I have JSON like this { "lastUpdateId": 40104114357, "bids": [ [ "35074.17000000", "1....
конструктор's user avatar
1 vote
1 answer
73 views

Dyalog APL, sort rows in a matrix

I would like to sort numbers within each row of a matrix, for example, 3 3 rho 2 3 1 4 5 7 1 9 8 should become 3 3 rho 1 2 3 4 5 7 1 8 9. I am new to Dyalog APL, and know how to generate, via grade ...
Kuushu Enshin's user avatar
2 votes
1 answer
58 views

Is Execute unsafe in namespece paths?

I'm handling a json string converted into a namespace. Here's a toy example to illustrate my concern: What if a malicious client POSTed this payload? js←'{"foo": "bar", "⎕OFF&...
mappo's user avatar
  • 466
1 vote
1 answer
107 views

APL2-style inner product in Dyalog APL

Consider this Boolean matrix which indicates, for each of 7 products, which of the 5 resources are needed: ⎕←cross←7 5⍴1 1,(4/0),1 0 1 0 1,(6/0),1 0 1 0 1 0 0 1 0 0 1 1 0 0,(3/1),0 1 1 0 0 0 0 1 ...
Adám's user avatar
  • 6,939
3 votes
1 answer
54 views

In Dyalog APL, can an Reduce N-Wise be a function or is it just an expression?

Say I want to name a function (assign to a variable) that does n-wise (2 in this example) reduction. Using tryapl.org it looks like I can't: v←⍳5 2,/v ┌───┬───┬───┬───┐ │1 2│2 3│3 4│4 5│ └─...
justin2004's user avatar
2 votes
1 answer
68 views

How can I get the last input expression in Dyalog APL?

I know I can re-execute lines by putting my text cursor on a previously entered line and pressing Enter, but sometimes the output is long and I am wondering if there is a keyboard shortcut to recall ...
RikedyP's user avatar
  • 642
3 votes
2 answers
138 views

DYALOG APL, Connect to SQL Server using .NET and load a DataTable with data using SqlConnection

DYALOG APL, Connect to MS SQL Server using .NET and load a DataTable with data using SqlConnection. I do not want to use SQAPL. I want to use DataTable as they can be used as data sources to GUI ...
Mike Chris's user avatar
3 votes
1 answer
54 views

Can someone explain this behavior for finding parent/child relationships of unnamed Namespaces?

I'm trying to use ## to find the parent of a namespace, and then ⎕NL -9 to find its children. Suppose I have a parent namespace: 'parent' ⎕NS '' Now I have 2 child namespaces: One named, and one ...
Josh D's user avatar
  • 33
3 votes
1 answer
62 views

How to get column names with Dyalog APL after an SQL query?

I am working with Dyalog APL and having trouble with getting the column names of a table resulted from an SQL query. More precisely, I am working with the workspaces (WS) sqapl and LOADDATA provided ...
T.P.'s user avatar
  • 133
3 votes
1 answer
44 views

How do I POST raw data in Dyalog APL HttpCommand?

I am trying to submit data as plain text using HttpCommand object. I know how to do it with cURL, but I'm unsure how to specify the data in my HttpCommand object. Here's how I would do it with cURL: ...
RikedyP's user avatar
  • 642
1 vote
1 answer
48 views

How can I use rich boxing when printing something in a function in Dyalog APL?

If I use quad-gets (⎕←...) to print some debugging information inside a function in Dyalog APL, it doesn't seem to respect my ]box settings. How can I print stuff with boxing on? tmp ← {⎕←⍵} ...
xpqz's user avatar
  • 3,647
2 votes
2 answers
72 views

How provide default values when using ⌸ in Dyalog APL

When using key ⌸ to produce a frequency table, e.g {⍺,≢⍵}⌸'mississippi' ┌→──┐ ↓m 1│ │i 4│ │s 4│ │p 2│ └+──┘ I frequently find myself wanting to 'seed' the result set to provide a count of 0 for ...
xpqz's user avatar
  • 3,647
1 vote
1 answer
110 views

Clearing the screen in Dyalog RIDE

Dyalog keeps a session log that persists between restarts. I find myself frequently needing to clear the screen of old output etc, and I've found no other way than mindlessly tapping on the return key....
xpqz's user avatar
  • 3,647
2 votes
1 answer
42 views

Access same row/column in each array in nested arrays in Dyalog APL

Is there a way to multiply or add a scalar to the same row or column in each array of a nested array without a loop? For example I would like to multiply all the values in the 2nd column (or row) of ...
xpqz's user avatar
  • 3,647
2 votes
2 answers
37 views

Resuming execution after conditional breakpoint in Dyalog APL

In a previous question I asked about how to set a conditional breakpoint in Dyalog RIDE, and the accepted answer works as advertised, by creating a guard statement with an empty function call as the ...
xpqz's user avatar
  • 3,647
3 votes
2 answers
80 views

Is another way to write this APL pattern?

CONTEXT let ns be an unsorted array of unique integers of arbitrary length, return the smallest missing positive number of that array. for example ns = {-1, -3, -2} -> 1 ns = {1, 2, 3, 4, 5, 6, 7, ...
Alden Luthfi's user avatar
3 votes
1 answer
53 views

Get the day(s) with the highest temperature from a table

I'm trying to get the highest temperature day(s) in APL. This is my code: days ← 'Monday' 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday' temp ← 7 1 1 ⍴78 80 89 82 79 89 73 ...
bRaNdOn's user avatar
  • 1,084
2 votes
1 answer
54 views

Setting a conditional breakpoint in Dyalog RIDE

In Dyalog RIDE, I know how to set breakpoints that will halt execution on specific lines in the APL source. Is there a way to make a breakpoint conditional so I can stop at a line only if a particular ...
xpqz's user avatar
  • 3,647
3 votes
1 answer
44 views

How do I tell a running Dyalog session to accept RIDE connections?

Dyalog RIDE can connect to running interpreter sessions, but in order for that to work, is there a way to tell an already running session that it should start listening to incoming connections? I know ...
xpqz's user avatar
  • 3,647
0 votes
2 answers
86 views

Boolean array in If guard

According to the Dyalog APL language reference the test condition to the right of :If must return a single element Boolean value 1 (true) or 0 (false) Is there any particular reason why the value is ...
August Karlstrom's user avatar
0 votes
1 answer
92 views

How to use compose operator in APL?

I'm not able to understand compose operator in APL. I have tried but precedence is the issue that I am facing.
Akshay Atanure's user avatar
0 votes
3 answers
106 views

how to print values between 2 numbers in APL?

I am not able to print values ranging from 30 to 50 both inclusive in APL. Actually I tried so much operators but not working.
Akshay Atanure's user avatar
1 vote
1 answer
57 views

What conditions does ]Save in Dyalog APL have?

So I recently started learning about Dyalog APL and now I have a function that I would like to save, but when ever I try to use ]Save according to the help text provided by it I only get 'Invalid ...
Bnengon's user avatar
  • 13
3 votes
1 answer
97 views

Two APL functions give different results, but their boxing is identical

I am trying to create an APL function which returns differences (non-identical items with identical index) between two vectors. I have come up with the following and it works fine, subtracting two ...
kamilok04's user avatar
1 vote
2 answers
122 views

Syntactical tree representation of an APL function (or an expression)

How to obtain a syntactical tree representation of a Dyalog APL function (or an expression)? I'd like to check whether a certain user-defined sub-function is called with certain number of elements in ...
Olexa's user avatar
  • 577
2 votes
1 answer
60 views

Why does v[1+(0×(⍴v))] produce a rank error and not the first item in a 2d array?

First, I assign v as: v ← ⍳(4 9) v ┌───┬───┬───┬───┬───┬───┬───┬───┬───┐ │0 0│0 1│0 2│0 3│0 4│0 5│0 6│0 7│0 8│ ├───┼───┼───┼───┼───┼───┼───┼───┼───┤ │1 0│1 1│1 2│1 3│1 4│1 5│1 6│1 7│1 8│ ├───┼───┼───┼...
trisimix's user avatar
  • 101
1 vote
1 answer
83 views

(APL) About the power and circle functions

Why does *○0j1 outputs -1 but *(○0j1) doesn’t? (¯1j1e¯16) What is the difference between them? Expected *(○0j1) to output the same thing as *○0j1
d d's user avatar
  • 13
0 votes
3 answers
52 views

APL2, order of processing each operator arguments

Assuming the user function: ∇ f b [1] b ∇ and the following is executed: f¨1 2 3 Three lines will display, 1 digit per line. In APLX the order is 1 2 3. Is there any APL2 guarantee the order the ...
Paul Houle's user avatar
0 votes
1 answer
48 views

Why create surrounding "neighborhoods" when using APL to iterate through the initial N by N game of life

It seems that adding extra live and dead cells changes how the original "neighborhood" would progress through the generations. When I apply the game of life rules to the initial N by N array,...
dawnbreaker's user avatar
0 votes
1 answer
124 views

Using Key operator to make a game but need more tree depth to create a more complex tree

I am working on a game using the Key operator to create simple parent tree nodes connected with children. Like (1 3 2 7 11 12) with 1 as a parent node and 3 2 7 11 12 children. The array has all the ...
creatural's user avatar
2 votes
0 answers
66 views

How can I avoid a DOMAIN ERROR using matrix inversion ⌹ in Dyalog

I have been porting old APL*PLUS PC functions that run on DOS to Dyalog and have had great success. But one function runs fine on APL*PLUS PC but gave me a DOMAIN ERROR on Dyalog. I traced the ...
MLS's user avatar
  • 41
3 votes
1 answer
180 views

Haskell version of APL trains

TLDR: Is there a Haskell library that offers function definitions (preferably with concise notation or naming) for handling common patterns of multi-argument function composition such as those in APL? ...
j_v_wow_d's user avatar
  • 511
3 votes
1 answer
89 views

Most efficiently insert a number in a maintained large sorted variable

I need to most efficiently insert a number in a maintained large sorted variable. Is there a better method than test1? test1 is quite a bit faster vs test2 which is just to append a variable then ...
creatural's user avatar
1 vote
3 answers
506 views

Add APL Keyboard Layout On Ubuntu 22.10

There is this, but now I'm on Ubuntu 22.10 and these solutions don't seem to work for trying to get a dyalog latest keyboard. I'm getting > setxkbmap -layout us,de,apl -variant ,dyalog -option grp:...
147pm's user avatar
  • 2,167
1 vote
2 answers
104 views

Porting APL*PLUS PC workspaces to Dyalog APL or GNU APL

I would like to use my old APL*PLUS PC functions on Dyalog or GNU APL. Is there a way to convert workspaces (preferred) or functions without having to retype the functions? I have tried reformatting ...
MLS's user avatar
  • 41
1 vote
4 answers
134 views

Proper size calculation of grid tooltip

Using Dyalog APL I'm trying to create a grid with cell tooltips. These tooltips are created with the method AddComment. For some reason the tooltip does not resize itself to fit the content so if the ...
August Karlstrom's user avatar
-1 votes
1 answer
87 views

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 ...
MLS's user avatar
  • 41
1 vote
1 answer
73 views

Use a recursive dop in APL

In the tryapl.org Primer when you select the Del glyph (∇) it shows an example of a Double-Del (∇∇) where a dop (as I understand it, a user defined operator) can reference itself in a recursive ...
ThePoetCoder's user avatar
0 votes
2 answers
104 views

Compressing Rather Large Table in APL

I am currently working on finding a palindrome of made from multiplying numbers of length 3 together (from 900 to 1000). I am able to generate a table of palindromes in binary (1/0). However, the ...
ArbIn's user avatar
  • 43
0 votes
1 answer
104 views

APL. How to find palindrome numbers in a given product list

The particular question asks to find all palindrome numbers between 900 and 1000. new_set ← (900 + ⍳100) 901, 902, 903, 904, ..., 999, 1000 ⍕¨(new_set ∘.× new_set) {⍵≡⌽⍵} ⍕¨(new_set ∘.× new_set) The ...
ArbIn's user avatar
  • 43
3 votes
2 answers
153 views

Read column of CSV file as array

I am trying to read a column from a CSV file into an array. So far I have successfully read the file with the code below. load 'csv' data =: readcsv '/Users/max/Desktop/prices.csv' Typing data in ...
M4X_'s user avatar
  • 507
6 votes
2 answers
197 views

What is the "j" expression for the "maximum consecutive ones" problem?

In the paper "Combinatory Logic and Combinators in Array Languages" they give a solution in APL: vec ← 1 1 0 1 1 1 0 0 0 1 ⍝ split (partition) on zeroes ⊆⍨vec ┌───┬─────┬─┐ ...
madeofmistake's user avatar

1
2 3 4 5
8