As part this challenge, you had to convert an adjacency list to an adjacency matrix. I spent a while on this in J, and my best effort was [:+/(-{.1:)"1@(,|."1). Very curious to see it bested, if anyone wants a micro challenge. cc/ @Bubbler
@Razetime J does have amend } and that was my first attempt. But it ends up being a handful of bytes longer than my more contorted solution. I did manage to shave 1 more byte off of it, but I'm out of other ideas.
@LdBeth I understand that whether or not you get padding depends on the shape of the arrays you use. (My understanding of Stencil and APL in general is very limited.)
@avx I read the CNN article and I found it quite good. Thanks for sharing!
By padding do you mean "fills"? In which case I think Alex is right, Stencil has an implicit mix so fills are no easier to avoid than they are with ↑ - shape has to be homogeneous. (I could be wrong)
You could always reduce the rank after using stencil and remove the fills yourself, depends on your use-case /shrug
@Fmbalbuena You can use :Repeat etc. in the interactive session. In a dfn or tacit function, you have to wrap it in ⍎ e.g. ⍎':for x :in ⍳3 ⋄ ⎕←x ⋄ :endfor' but TryAPL won't allow this.
@Fmbalbuena In the Windows IDE, you can press Ctrl+Del to remove a line (or all selected lines) from the session log. Any other way of removing lines will be temporary; next time you press Enter, they'll come back.
@Fmbalbuena Yes: {⍺←⊢ ⋄ ⍺1≢1} or {2∊⎕NC'⍺'}
@KamilaSzewczyk I don't know, but let me know if you want me to find out.
@MasterQuiz If the language server isn't working, then I suggest you log an issue on GitHub.
@Razetime ⍸⍣¯1?
@PyGamer0 Because you're using /; use ⌿ and it should make a whole lot more sense.
@LdBeth The left operand gets called with a vector indicating how much padding was added. This vector is perfect as left argument to ↓ in order to remove that added padding: ⎕←{⊂⍺↓⍵}⌺3 3⊢3 4⍴⍳12
@KamilaSzewczyk The interpreter rarely uses a single algorithm for anything; it chooses dependent on the values presented at runtime. For factorials, most of the code appears to be related to Stirling's formula.
Spouge's approximation seems generally much better.
KamilaLisp has a cache of natural factorials up to 100 which are reused to compute further factorials, while real or imaginary values of "factorial" defined using the Gamma function are computed using Spouge's approximation.
One good thing about it is that you can precompute the coefficients for a given precision in the compile-time, since APL is very primitive in the regard that it doesn't have arbitrary precision computation.
And even Lanczos dates from the same time as original APL.
@Fmbalbuena Oh, no, the typewriter (not printer) was just the interface, corresponding to the modern keyboard and screen in a single unit. The interpreter was cloud-based.
@Adám (except that "cloud" in 1975 meant just some water molecules up in the sky... the interpreter was probably running on a mainframe, like IBM/360) :-)
@AlexB I'm just trying to avoid having to explain old terminology. There's absolutely no difference between "on a mainframe" and "on someone's server" and "in the cloud".
I don't think I want to push this challenge farther... @FawnLocke proposed it as a solution to @Fmbalbuena in like 5 seconds. It took me some time to understand it. It's a good exercise.
@Adám No, that's not how I understood the challenge from @Fmbalbuena. For instance, ⍺ could be 3 and ⍵ could be 3 1 4 9. It would have to return "pi", because the first 3 digits match, though ⍵ ⍷ PI would fail.
@FawnLocke Not necessarily. You could have unlimited precision. If you process the digits, then you have all of them. If it goes to stdout BY DEFAULT it could shorten it with "...".
@rak1507 of course I know. The point is that Python has unlimited digits for integers. This would be a nice feature for APL, given the emphasis of this language.
@Adám not really - it's printing the precise value of pi rounded to an IEEE-754 64-bit float. Dyalog's 99⍕○1 gives a value that rounds towards it, but not the precise value itself