@Razetime If your language can have a syntax that is close to that of APL, then you can give each syntactic element a name, and (if needed) use string replacement to transpile your language to the DSL.
@MortenKromberg Sure, but the "else" block might be more than just a value, and you might not want to or be able to compute it unless the condition is false/the error is hit.
Understood, my answer is essentially "don't try to do that". As I understand it, you are using error trapping as PART of your validation and want to combine it with regular control structures. I do not think it is generally desirable to try to create some kind of Frankenstein monster syntax to make that easy. :OrIf is confusing enough already, imagine if it were blended with error handling...
The above style is one I use a lot, though not necessarily for mixing guards and error guards. It requires naming functions, which is hard, but I think worth the effort for significant code.
@PaulMansour Well, kind of. You're missing the error-guarded block, which will end up separating the two paths to DoThat from each other. That's not so good.
Actually, that's not true what I just wrote.
That block is the lower ...
@PaulMansour I don't think the naming is an issue, but I still don't like having to refer to the name twice, and ToThat might need a dummy argument.
Hello, I am trying to solve P1/2015 of problems.tryapl.org and I have solution that works on tryapl.org, but that gives a syntax error on problems.tryapl.org when I click on the "Test" button. It is: {d[⍋d← (a∊⎕A) / (a ← 1 ⎕C ⍺)] ≡ c[⍋ c ← (w∊⎕A) / (w ← 1 ⎕C ⍵)]}. What could be the reason that it works on one website but not on the other?
Thanks, actually I am wondering if there is something like the dyadic compose (&) of J available in Dyalog APL that would allow me to do something like x u&v y ↔ (v x) u (v y). In this way I could get rid of duplicating the sorting of the characters in the left and right argument.
@Razetime Maybe I could inject covers for ⍨ and ⍥ and ⍤ and ⎕C and ≠ as those are easy. ⍸ and ⊂ a bit harder, but should be possible too. Then the only problem becomes their inverses, but that's a low cost, I think.
I'm having troubles figuring out how to edit a function in GNU APL.
I have tried ∇func (DEFN ERROR), )edit (BAD COMMAND), )editor (BAD COMMAND)
and all give me errors.
Any suggestion on how to edit a simple function would be appreciated.
To check that there are no consecutive digits in a sequence I've come up with ~∨/ 1 ¯1 ∊(¯1↓i)-(1↓i). Is there a way to write in a more compact way the (¯1↓i)-(1↓i) part? It is almost like a fork
@Razetime I've bookmarked javascript:alert((location+"").replace("https://aplwiki.com/","[apl.")+"]("+location+")") so I can click it from an APL Wiki page and get markdown ready for posting in chat.