[Bug-apl] Error handling and IO

2016-04-10 Thread Elias Mårtenson
Yesterday, I participated in the Google Code Jam (programming competition). For one of the tasks, APL was a very good fit. The question is here: https://code.google.com/codejam/contest/6254486/dashboard#s=p1 My solution (which I will not post right now, since one of you might want to give it a sho

Re: [Bug-apl] Error handling and IO

2016-04-10 Thread Alexey Veretennikov
Hi, In Dyalog APL there is a mechanism similar to try/catch in other languages: R←f X :Trap 0 R←1÷X :Else ⎕←'Error happened' R←0 :EndTrap f 0 Error happened 0 For details see the Mastering Dyalog Apl (http://www.dyalog.com/uploads/documents/MasteringDyalogAPL.pdf) Chapter M:

Re: [Bug-apl] Error handling and IO

2016-04-10 Thread Elias Mårtenson
Hello Alexey, This seems similar to what GNU APL provides with the ⎕EA feature. The problem with this (and, as far as I can tell, also with this Dyalog feature) is that in an error handler, the original error has disappeared. What is needed is a way to say: "call function X with file handle Y, en