« first day (1603 days earlier)      last day (1351 days later) » 

04:36
@rak1507 There was an issue with the interpreter when using a specific construct, and it could only happen with ⎕IO←0 ;-)
 
2 hours later…
06:34
I require tips for writing complex language interpreters in APL
@Razetime You want to write a parser in APL?
yes, a parser
@Razetime Marshall's mini-series may be of interest, but also these items from dfns.dws and eval, min, and max.
Alternatively, you could write your language as a DSL that transpiles to APL.
@Adám what does this entail? I'm trying to make one for a relatively simple language
@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.
06:42
hm alright
 
2 hours later…
08:37
:58345154
 answer←'uh oh'
 :If x<0
    :Trap 0
       answer←÷x
    :EndTrap
 :EndIf
 ⎕←answer
08:50
@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...
Even :Finally doesn't solve this problem, does it?
That would depend on what you are trying to do, but not in general.
 
2 hours later…
11:17
the comp.lang.apl newgroup is being spammed
12:12
Does that do what you are trying, even if you don't like the technique?
:58352894 DoThis←{
    b←...
    b:DoThat ⍵
    0::DoThat ⍵
    ...
}
Ok, how do I paste in a multi-line response and have in response and have it ping properly?
@PaulMansour You don't. ¯\_(⍨)_/¯
I always resort to using a non-code leader line with the response tag, and then adding the code block after.
ok, good to know.
You've probably told me that before, but I don't comment enough to remember...
I don't think I have.
Oh. ⍨
Added to the wiki.
12:18
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.
DoThis←{0::DoThat ⍵ ⋄ b:∘ ⋄ ...} :p
@dzaima Yeah, I actually asked this because I spotted such code.
@Adám ah. For dfns it's imo better than anything else i've seen, even if it's not nice
@Adám True. Neither of those issues bother me I guess.
12:42
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?
it may be the use of ⎕C
Ok, thanks! I will then search for alternatives to converting case.
@p.vitzliputzli 1 (819⌶) might work.
819⌶ was the old version of the ⎕C function
yep, it works.
@Adám might be a good idea to offload problems.tryapl.org's evaluation things to the newer tryAPL instead of tio
Yes, it worked! Thanks a lot!
no problem.
Feel free to come back if you have trouble with any other questions.
12:55
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.
@p.vitzliputzli Yes, that is but again, only works in the newest version (including TryAPL), but not on problems.dyalog.com
@Adám Wonderful, thanks!
@p.vitzliputzli You can easily implement a model for it: Ö←{(⍵⍵ ⍺)⍺⍺(⍵⍵ ⍵)}
@Razetime Problem is that the testing framework needs unrestricted APL code, and TryAPL uses a strict whitelist.
@Adám Thanks!
13:11
@Adám ah that's too bad
13:23
@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.
13:33
7 CMCs: Dyalog 18.0's ⎕C in vanilla 17.1. Read about the enhancements here.
Announcement: Dyalog '21 will be a free online event.
2
13:50
@Adám does this mean there will be 3 grand prize winners + 3 professional winners at Dyalog 22?
@rak1507 I guess.
14:16
Yeah, I just got an email about postponing the offline event again
which is actually not bad for me because I'm not vaccinated yet (+ some other reasons)
14:30
@Bubbler Right, my wife isn't getting her second shot until a week into September.
14:49
@johnnynb Hey there, and welcome to the APL Orchard. Let us know if we can be of assistance with anything.
15:09
0
Q: GNU APL how do you edit a function

johnnynbI'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.

16:00
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
you can try 2-/?
@Razetime Thanks. I didn't know about windowed reduced
16:40
what's the simplest way to get the diagonals of a matrix?
       ,⌿(⊢⌽⍨¯1+⍳∘≢)⎕←3 4⍴⍳12
1  2  3  4
5  6  7  8
9 10 11 12
┌──────┬──────┬─────┬──────┐
│1 6 11│2 7 12│3 8 9│4 5 10│
└──────┴──────┴─────┴──────┘
that is cool
@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.
nice bookmarklet
I have a few nice bookmarklets.
16:45
@Adám this is cool but i was thinking (9) (5 10) (1 6 11) (2 7 12) (3 8) (4)
something shear the matrix so each row is offset by 1 and then grab columns might work?
idk
antidiagonals builtin?!
@hyper-neutrino yeah I guess that should be it
@Razetime J has that too.
@hyper-neutrino That's what APLcart's entry does, but how do you deal with the raggedness?
yeah... i'm not quite sure how this'd work lol.
16:50
shear with padding element a←1+⌈/,matrix and then remove a from each
@Razetime Works for numeric matrices only.
that's what i was thinking. but then you'd need some padding element you can be sure doesn't exist
yeah, that's my use case
Total hack:
      {c/⍨×≢¨c←#~¨⍨⍪⌿(⊢⌽⍨¯1+⍳∘≢)⍵,⍨#⍨¨⍵}3 4⍴⍳12
┌─┬────┬──────┬──────┬───┬─┐
│9│5 10│1 6 11│2 7 12│3 8│4│
└─┴────┴──────┴──────┴───┴─┘
if it's just numeric matrices i guess you could pad with max + 1 and then remove the maximal element from all?
16:52
don't see # everyday
@hyper-neutrino That's exactly what Razetime wrote.
maybe use ⎕DR or something to figure out type and change it up for each case
Crazy wasteful (though I'm not sure it is really any worse than the above), but works universally:
a more neat method would be to find a math expression for finding the indices of each diagonal?
16:54
      {c/⍨×≢¨c←(⍪⌿(⊢⌽⍨¯1+⍳∘≢)⍵,⍨(⊂⍵)⍨¨⍵)~¨⊂⊂⍵}3 4⍴⍳12
┌─┬────┬──────┬──────┬───┬─┐
│9│5 10│1 6 11│2 7 12│3 8│4│
└─┴────┴──────┴──────┴───┴─┘
@Razetime Yes, but you still have to filter away the out-of-bounds locations.
{⍵⊢∘⊂⌸⍨⍥,+/↑⍳⍴⍵}
Nice.
woah
Should be added to APLcart.
how did you figure that out
16:59
Now I remember Marshall doing this once.
It really makes sense.
Simply measure the distance from the top left corner.
All elements sharing distance belong to the same diagonal.
@Razetime from you saying to find a maths expression for the indices
and remembering the pattern +/↑⍳⍴⍵
I guess I'll have to remember that now
wait, wouldn't that (dist from topleft) give antidiagonals?
@rak1507 Same as +/¨⍳⍴⍵
@Adám faster
17:00
@hyper-neutrino It does, but fixes that.
@hyper-neutrino yes, it's not quite the same as the original question
but easily adaptable
ah. okay
@hyper-neutrino should be enough to ⊖ and then run the function
yeah this solution is clever
17:02
@dzaima cool!
@dzaima Hold on, that only computes the indices, right? Doesn't return the elements.
No, wait, ⊢⌸ is dyadic. Hm.
OK, added to APLcart. Time to make dinner for the family.
is there a reason for ⊂⍤⊢ over ⊢∘⊂ ?
@rak1507 Readability. "Enclose on the right argument" vs "…deferred in preference for the enclosed…"
fair enough, enjoy your dinner
(And since it already uses , why not f⍤g…)
Thanks!

« first day (1603 days earlier)      last day (1351 days later) »