@voidhawk i claim no credit for it, it was just the straightforward recursive bloated solution, so sure, post it if you want, but i wouldn't hasten to write an explanation - it hasn't gone through the scrutiny of the orchard yet :)
and i can already smell some golfs
@Sherlock9 here's one dirty trick - we can let the expression fail when n=0.5 and return ⍵ in an error guard: {0::⍵⋄∊∇¨⌽∘⊖¨@4⍉¨@1 4⌽@3 4,↑∘⍵¨∘.,⍨,∘-⍨2÷⍨≢⍵}
@Adám of course! more of a q/kdb guy at the moment. check out my half-assed attempt at a vector lang called xxl on github. btw great work on your management of and contributions to this community. lotta hard work
thats the one. the VM is pretty broken but i like the ideas. been trying to take the good ideas and reimplement using pattern matching as a core vm primitive (like Wolfram) but its slow going as you can imagine
@Adám yeah. in bitter contradiction with the APL way, i think words work better for programming audiences. i believe a language designer should work hard to make the work available to all, even those who are tainted by the poisons of the von neumann paradigm and its attendant wordiness. anyway, short well chosen words can still be concise imho
can still lead to concise programs* (i should say)
@ThomasLackner I had a quick skim through README.md. Looks really interesting. I have been contemplating a left-to-right APLy language for a while now.
im most proud of integrating the erlang-inspired mailbox concept because i think it is the clearest way to express certain kinds of asynchronous programs.
@Adám i think left-to-right with postfix is easiest. it comes down to how you imply projection i think - could get confusing. prefix sounds great (and is more logical) but a lot of stack swapping has to happen for it to "read" like a human language in the end.
in xxl, a lambda or function is tagged with its arity (1 arg or 2, cuz im lazy), and an arity of two function when executed will return a projection. the whole thing is a pretty barbaric while loop, betraying my naive notion of evaluation strategy. there's a certain beautiful inner realization to make with the whole system but i failed to really hit the mark.
@ThomasLackner Despite well-written APL being translatable to English from left to right, I find it easier to explain the procedures from right to left. However, this does lead to very bottom-up programming. A totally different approach is embracing top-down, where every statement after the initial one, qualifies something in the initial one:
mean is sum divided by count where sum is is plus reduction
But obviously, the interpreter will have to execute bottom-up, leading to "interesting" tracing.
@Adám ive often pondered "where" and "in" like you see in the high abstraction functional languages. isnt it easier to just state those requirements in the line before? i wonder if this practice steps from formal mathematics or something else.
@ThomasLackner Yes, in a way it is easier, but it drowns the reader in unwanted detail, whereas top-down gives the most important high-level impression first.
@Adám hmm. yeah, i see what you mean. i have heard that a new programmers biggest symbolic obstacle to understanding is "getting" the order that the statements occur in. in other words, top-to-bottom is more logical than jumping down to main() and then going through its statements. i guess that anecdata tainted me at some younger age
My father actually taught me top-down APL programming, where one defines the top level thing one wants first, then executes that, causing APL to stop and "ask" what things mean (a.k.a VALUE ERROR). Then one answers what that thing means, and tells APL to continue until the next undefined term. When all terms have been defined, the program terminates with the correct answer.
@ThomasLackner Yeah, a good REPL (known as "the session"!) that was core to APL pretty much from day 1. It absolutely excels when a systems programmer approaches a domain expert. Hi! I'll help you make the computer calculate this for you. What are you trying to compute? Oh, XYZ. Right, what does that mean? Oh, XYZ is ABC and DEF? I see. And ABC, what's that? Etc. etc.
@ThomasLackner As humans are getting more expensive, while computational power is getting cheaper, and algorithms are getting more complex, I think we'll gradually see a move towards domain experts doing their own programming. Then a "friendly" approach like this will be very valuable.
@nathanrogers Because is f returns a vector, then f¨ on a vector returns a vector of vectors, and mixing that gives a matrix, but f¨ on a scalar, just gives an enclosed vectors, and ↑ discloses that enclosure, giving the contained vector.
@DyalogAPL Only a vector of vectors mixes into a matrix. A scalar of vector(s) doesn't.
@nathanrogers Another way to think of it is that ↑ concatenates the shapes of the outer and inner arrays. But if the outer array has shape ⍬ then the concatenation of the outer array shape and the inner array shape is just the shape of the inner array. A vector, in your case.
@Adám I also narrowed down a bug where there's some kind of process detatchment unsing link when editing code in another editor when the debugger is up
@nathanrogers Interestingly, the documentation speaks of the ancient line editor warning when redefining pendent functions, but I don't see that happening. Maybe that check has inadvertently been disabled, and thus we see bugs.