Good to hear. Obviously, I can't directly help you with that, but if you run into problems with APL in general, or if you need to learn something, I am here for you, and so are many others. How would you characterise your level of APL knowledge?
beginners level, I started with gnu apl end of last year, read 'apl at a glance' and 'apl in depth' and did advent of code mainly in APL. With this year, I switched over to Dyalog APL - for being more modern. Now my objective is to have at least a solution (even if ugly) for all the competition tasks.
having a common lisp background, APL feels alien but VERY interesting.
Yes as long as you only use it in one machine at any one time - see clause 4.2 of the licence agreement: 4.2 You may install each version of the software on more than one computer provided that it is used on one computer at a time
That said, the unregistered version is completely identical to the registered one…
Consider an old-skool phone keypad (if you're old enough you may have used a land line att some stage). The buttons have letters, too, so that you can memorise phone numbers by means of the words they spell out. SO: given a huge list of numbers and a dictionary (in German), return all possible words that the numbers can spell.
Had some fun with challenge by José Valim (creator of Elixir) -- github.com/josevalim/nested-data-structure-traversal/pull/22/… -- I'm sure it's still quite golfable but that's probably not the goal. They're collecting different ways to solve the problem. Most non-FP solutions use mutation, most FP solutions use reduce, APL uses ... well ... partition :D
I guess if they want to understand my solution I should comment it a bit :D
See the repo README. Basically adding indices to records with a twist
ie. the nested records (Lessons inside the Sections) share a global index space and the indices can optionally get reset if the section has a reset: True boolean field.
Mentioned in the PR that it should be a no-op anyways (for all inputs i, output(i with first section reset = True) == output(i), but that I can change my code to fix that (I'd use @ for the algorithm instead of indexed assignment and then use the old resets array for the output) but they were fine with it as is
CMC: In the following dfn, what is the shortest code you can replace [placeholder] with so that the function always reaches and then returns the 42 when called?
OK, I managed to get rid of almost every trace of side effect. My GoTo temporarily sets a variable, but it makes sure to erase it afterwards, and I can use an arbitrarily unlikely variable name, or even amend my implementation to choose a variable name that isn't in use.
My father taught me top-down programming, where you use names you've not defined yet, and then the interpreter asks you "what does that mean?" (i.e. VALUE ERROR) and you define the missing name (maybe in terms of other missing names) until you've implemented your program.
I've probably lost like a second of time on every error Dyalog has thrown at me by just having to hold down esc (and then many more seconds reopening every editor window that has been closed by the esc spam)
@Adám i mean, yeah, but that doesn't work when you're editing stuff
@dzaima (and in this challenge specifically, i also have to have a full dfn and code a specific number of lines after the thing being written, and I just have to spam different erroring things until one works; a )sic in between each like doubles the time it takes to do stuff)
Oh, found a shortcoming in my GoTo: It equates →⍬ to →0 while it should really let execution continue. I can probably make it go to the next line, but I don't think I can make GoTo ⍬ ⋄ here work right.
@Adám if a utility I use from someone else errors unexpectedly, it hiding why that happened is absolutely the last thing I would want it to do
@dzaima (PS: I come from a world where, when a library errors, I try to do something about it, instead of buying consulting for the library)
(fwiw errors in Java can have a "cause" object, so you can even make a catch-all and throw new error, with a usefuler top stack item, while also not just completely destroying the extremely useful information about the specifics!)
@dzaima Yeah, I'll keep arguing for a simpler way to "re-signal" an error while preserving the info. John also mentioned the possibility of shipping the actual error object along so you get the full picture at the bottom.