« first day (767 days earlier)      last day (1888 days later) » 

4:36 AM
So that's 56 bytes on golfing the spaces out. Not sure there's anything left
 
 
3 hours later…
7:11 AM
⎕←{1>n←2÷⍨≢⍵:⍵⋄∊∇¨⍉¨@1⌽∘⊖∘⍉¨@4⌽@3 4,∘.(↑∘⍵,)⍨n×1 ¯1}4 4⍴⍳16
Hrmm
⎕←{1>n←2÷⍨≢⍵:⍵⋄∊∇¨⍉¨@1⌽∘⊖∘⍉¨@4⌽@3 4,∘.(↑∘⍵,)⍨n×1 ¯1}4 4⍴⍳16
 
@voidhawk
1 5 6 2 3 4 8 7 11 12 16 15 14 10 9 13
 
50 bytes
 
7:42 AM
@voidhawk If you put that version into your answer, would you like some help writing an explanation?
 
Oh, or 49:
⎕←{1>n←2÷⍨≢⍵:⍵⋄∊∇¨⌽∘⊖¨@4⍉¨@1 4⌽@3 4,↑∘⍵¨∘.,⍨n×1 ¯1}4 4⍴⍳16
 
@voidhawk
1 5 6 2 3 4 8 7 11 12 16 15 14 10 9 13
 
Nah I appreciate it but I'll write something up
I won't post that version unless ngn's cool with it, I just golfed his solution :)
 
 
2 hours later…
9:40 AM
@voidhawk 48 bytes: {1>n←2÷⍨≢⍵:⍵⋄∊∇¨⌽∘⊖¨@4⍉¨@1 4⌽@3 4,↑∘⍵¨∘.,⍨,∘-⍨n}
 
ngn
10:32 AM
@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÷⍨≢⍵}
@voidhawk ^
 
10:50 AM
@ngn Oh that is a very dirty trick (and I didn't know we had error guards starts researching)
 
ngn
11:03 AM
⌽@3 4, -> ,0 1⌽ for -1 byte: {0::⍵⋄∊∇¨⌽∘⊖¨@4⍉¨@1 4,0 1⌽↑∘⍵¨∘.,⍨,∘-⍨2÷⍨≢⍵}
 
ngn
11:13 AM
-1 byte using an alternating monadified scan (for lack of a better term): {0::⍵⋄∊∇¨⌽∘⊖¨@4,1 0⌽⊢∘⍉\⌽↑∘⍵¨∘.,⍨,∘-⍨2÷⍨≢⍵}
 
ngn
11:26 AM
-1 byte - i should have seen this earlier: ,∘-⍨2÷⍨≢⍵ -> 2 ¯2÷⍨≢⍵ and it's 42 bytes now: {0::⍵⋄∊∇¨⌽∘⊖¨@4,1 0⌽⊢∘⍉\⌽↑∘⍵¨∘.,⍨2 ¯2÷⍨≢⍵}
 
ngn
11:44 AM
-1 byte golfing my own golf 1 0⌽ -> ⌽@1: {0::⍵⋄∊∇¨⌽∘⊖¨@4,⌽@1⊢∘⍉\⌽↑∘⍵¨∘.,⍨2 ¯2÷⍨≢⍵}
 
@Adám Thanks muchly
 
 
4 hours later…
4:19 PM
⎕←{f←+/10⊥⍣¯1⊢⋄z←⍵∨⍳⍵⋄(⍵<×/z)∧((f⍵)=+/f¨¯2÷/∪∧\z)}438
 
@Sherlock9
1
 
Saving this for later golfing for this challenge: codegolf.stackexchange.com/questions/92036/…
 
 
4 hours later…
7:53 PM
{2>⍵:0⋄f←+/10⊤⊢⋄(1<≢⍭⍵)∧(f⍵)=+/f¨⍭⍵} 36 bytes in Extended. Posting shortly
 
8:38 PM
@ThomasLackner Welcome. Interested in APL?
 
8:57 PM
@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
 
@ThomasLackner Looks a lot like "wordy" K.
 
@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)
 
9:13 PM
@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.
 
@Adám it just seems simpler. procedural and OOP are in a way is left-to-right though of course the nested parenthesis sorta obscure the point.
 
@ThomasLackner I'm undecided on monadic (unary) functions being pre- or postfix, though. Have you had a look at I?
 
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.
 
9:21 PM
@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.
 
thats an interesting approach! never considered that. that comes from growing up with a really good interactive REPL i guess
i wonder if that would work better with beginner programmers. that is the hurdle our community must ultimately solve
 
@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.
 
@Adám having the same verbs mean the same things across different nouns is a huge help to that approach. (i think)
lowers that "vocabulary barrier"
 
9:28 PM
@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.
 
 
2 hours later…
11:39 PM
@Adám you here today?
I need a hand with something. I'm trying to get the first row in a matrix regardless of the shape of the matrix
 
@nathanrogers Yes, I'm only missing from Friday afternoon until Saturday night, UK time.
@nathanrogers Tried 1⌷M or 1↑M?
 
but what if I have a list of indices?
I have a list of rows I want to get, but at the moment there is only one row
and since its only one row its treating it as a vector, not a matrix
 
@nathanrogers That doesn't sound right. One of APL's strengths is exactly the ability keep rank right, even for edge cases.
 
table[indices;]
what if table is just 1 row? it's a vector
I'm getting the result from something like
table←↑f¨args
 
@nathanrogers Nope, a 1-row matrix is a 1-row matrix, and not a vector.
 
11:42 PM
but then when I table[indices;] with a single row table I get domain error
where f just returns 1 row
 
@nathanrogers What is args?
 
some complicated nested vector
but it just returns rows of data I want
that part is working fine, and when there's multiple results it works fine
it only isn't working when table ≡⍬ or 1=≢table
er...
 
@nathanrogers Not sure if I understand, but try table←↑f¨,args
 
? why
actually I switched it to ⍳⍴args
 
@nathanrogers table should never be , and 1=≢table is irrelevant. What is ≢⍴table?
 
11:45 PM
when the table is empty or when there is only 1 row
that's the problem I'm getting
 
@nathanrogers Because is f returns a vector, then on a vector returns a vector of vectors, and mixing that gives a matrix, but on a scalar, just gives an enclosed vectors, and discloses that enclosure, giving the contained vector.
@nathanrogers Try ⍳≢args instead.
 
oh, so the length of args is 1
and so it's only returning a single vector, which mixing is just turning the vector into a matrix?
 
@nathanrogers Yes, look:
⎕←⍴↑⊂1 2 3 ⋄ ⎕←⍴↑,⊂1 2 3
 
@Adám
3
1 3
 
@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.
 
11:52 PM
@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 Yeah, Morten told me about it.
 
the fix seems to be clearing the workspace and relinking if possible, but that works 10% of the time, otherwise have to close and restart
 
@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.
 
@Adám I'm still not getting it. I have table←↑f¨,⍳⍴args
and when I try to table[indices;] to get the rows I want, I'm getting domain error still
 
@nathanrogers ⍴f¨,⍳⍴args give? And what does ≡f¨,⍳⍴args give?
 

« first day (767 days earlier)      last day (1888 days later) »