@Adám do you have any advice regarding this? I know of some 1 bytes shaveoffs, but I prefer to cut them all together. There is a slightly different version in the revisions history (almost same length)
@Adám maybe, one day. My only refrain from using APL for real applications is that it's streams/files related functions are not really "native" to the language, and looks a bit like patches. When it comes to calculations, I sometimes prefer it over python, because I can write stuff easier and faster (and in some cases get a result faster than py)
@Uriel I know, but they really are called Native, hence the N prefix to their names. This is because APL predates files as we know them, so in APL lingo, File refers to APL (component) files, a system APL had to store items (both arrays and functions).
@Uriel Quad is not an operator, but rather a character which is reserved for being the first in system names which avoids name clashes with user defined names. In general, the single-char glyphs of APL are for core language only, i.e. computational and structural things. Only exceptions are & and ⌶.
@Uriel APLX did that for component files, but frankly, I find their symbols not very mnemonic, and the syntax more awkward than elegant. Have you looked at ⎕MAP?
@Adám I guess I would give a deeper look on files operations once I get on a PC; frankly, I haven't done much APL stuff that runs repeatedly (like GUI apps or infinte input stream related operations)
@Uriel if only the pairs in "o" could be generated in ascending order of their sums, you would be able to avoid the grading and square-bracket indexing
@ngn I have a theorized solution that might work, I need to go right now, but I'll test it and be back in a few hours. Let me know if you find something interesting. Thanks!
@Uriel I'll try to golf a bit more before I give up - there's a trick for computing the Fibs - you do +\⌽⍵ multiple times, e.g. using the power operator ⍣ but it's not guaranteed it leads to fewer characters here
he-he, another 2 chars fell surprisingly quickly :) ⊃o/⍨k∊¨+\∘⌽⍣{k≤⊃⍺}¨o←a/⍨</¨a←,⍉|-\¨⍳2⍴1+k←⎕
@Uriel in my mind there's a significant difference between + and 3
@Uriel "+" is the name (or rather symbol, which is like an abbreviated name) for the function that does addition
@Uriel "3" on the other hand is a numeric literal, it's a concrete value
@Uriel I advocate being able to reassign symbols, especially after watching Guy Steele's "Growing a Language", but I don't think we need to mess up with literals.
@ngn hmm. I just finished going through the logic, seems it produces o where higher maximum pairs are created first for each mean. any idea how to change it?
@Uriel hm, the problem statement explicitly mentions this case, and the "theorem" has no proof yet. This can be fixed at the cost of an extra ⌽ before the ⍉
GNU APL and ngn/apl use UTF-8, so use a byte counting tool.
NARS2000 only uses UCS-2, so 2 bytes per character.
IBM's APL2 is the only modern APL that natively supports APL EBCDIC, so 1 byte per character.
Dyalog APL uses any Unicode format, or the classic Dyalog character set (Table 1 below).*
...
≈ is intended to be approximate equality like ≈←{eps>|⍺-⍵} but I never actually needed it; in ngn/apl some "primitives" are implemented in terms of others. ⍫ is a reified return. What I really wanted to implement was continuations but I settled for this. ⍁ binds a function (usually a user-defined one) with its identity element, used for reductions on empty vectors. ∞ is obviously infinity. Dyalog don't like it but I don't have a problem with it. ↗ is "raise" a.k.a. "throw", a.k.a. ⎕signal
I don't recommend ngn/apl for anything more serious than sharing a one-liner with a friend. It's a by-product from me learning how to implement programming languages. I made some mistakes.
@ngn No, but it can be inferred from there. Dictionary says that ∘.f is 0 .f and n.f is f⍤n ∞, so ∘.f is f.0 ∞. However, it is pretty obvious. ∘.f means that every element of the left argument gets paired (all combos style) with every element of the right. In other words, every element of the left gets paired with the entire array on the right. Hence f⍤0 ∞.
@ngn btw the new solution is not much slower than the previous (second version of second one), but fills the ws pretty quickly because of the double range
@EriktheOutgolfer Documentation It is only really useful in tradfns, however "naked" branch (without line number/label "argument") does work in dfns where it cuts the stack back (just like it does in tradfns).