@GreenSaguaro really you need just (⊂⍬); ⍬ is an empty list, but ⍬⍬ is a 2-item list of empty lists; ~⍬ removes all items that are in the empty list (but it's empty, so you remove nothing)
Are nullary functions possible in Dyalog APL? I have an action that does not take parameters that generates random data, and I want to run it multiple times
The APL wiki mentions a couple things as being noteworthy, but it doesn't mention the error handling. It looks like Nial has a native "fault" data type. Which means you can do:
1 ÷ 0
?div
5 ÷ 5 10 0 8
1. 0.5 ?div 0.625
Which means you can even error handle in the matrix-based style with something like:
% A basic divide by zero error: ;
1 / 0
?div
% Errors are values called faults.
This allows for powerful error handling: ;
5 / 5 10 0 8
1. 0.5 ?div 0.625
each (op x (if isfault x then 0 else x endif)) (5 / 5 10 0 8)
1. 0.5 0 0.625
% You can also define custom faults using 'fault': ;
fault 'this_is_an_error'
?this_is_an_error
% Or by using a fault literal: ;
?this_is_an_error
?this_is_an_error
@Adám Good point. Is this way of error handling with a native vectorizable data type a known idea in the APL world?
Does Dyalog (or bqn/ngn/extended/j/k) have an analog?
CMCrestricted-source: Write an expression which, under Dyalog Unicode, returns … (scalar or vector) but under Classic returns ... without your code containing the … character.
Additional restriction: Under Classic, you must not cause the … character to exist at any time, so evaluating ⎕UCS 8230 isn't allowed under Classic.
@Adám Hi @Adám, yes, definitely! I am just looking around the various resources for learning APL. I was using J for some experiments a while ago but felt like giving the original a try. Have not regretted it so far. I mean I just spend a few hours getting my feet wet in the language but I am surprised how much I like the symbol notation much more than its ASCII equivalent in J…