« first day (968 days earlier)      last day (33 days later) » 

12:09 AM
somehow I guess this is unary even though there are two states
 
 
4 hours later…
3:57 AM
So I'm working on a solution for Project Euler Problem 18 (and by extension 67) and just trying to find a good way to represent the binary tree in APL is an interesting challenge in and of itself
 
4:35 AM
Not in front of a computer but isn't this something like ⊃⊃{⍺+0,⍨2⌈/⍵}⌿triangle?
 
4:46 AM
⋄ b ← 4 4 ⍴ 8 5 9 3 2 4 6 0 7 4 0 0 3 0 0 0 ⋄ ⎕←{⊃{(2↓⍵)⍪⍨⌈/¨{(2|⍳⍴⍵)⊂⍵}2+/,⍉2↑⍵}⍣(¯1+⊃⍴⍵)⊢⍵}b
 
@Sherlock9
23
 
Ah. I had something quite a lot longer XD
Oh wait that's for the formatting ohhh
 
 
2 hours later…
6:57 AM
⋄ b ← 4 4 ⍴ 8 5 9 3 2 4 6 0 7 4 0 0 3 0 0 0 ⋄ ⎕←⊃{{(2↓⍵)⍪⍨(1↓2↑⍵)+0,⍨2⌈/1↑⍵}⍣(¯1+⊃⍴⍵)⊢⍵}b
 
@Sherlock9
23
 
This is shorter but still not great
 
7:09 AM
@TessellatingHeckler doesn't care if you have "invalid" digits. a⊥x y z is always xa²+yx¹+zx⁰, so for a=1, x=2, y=0, z=3, you get a2×1²+0×1¹+3×0⁰=5, i.e. the sum, +/ (well, +⌿ to be precise).
 
 
2 hours later…
8:41 AM
⋄b ← 4 4 ⍴ 8 5 9 3 0 2 4 6 0 0 7 4 0 0 0 3⋄⎕←⊃⌽{{(2↓⍵)⍪⍨(1↓2↑⍵)+0,2⌈/1↑⍵}⍣(¯1+⊃⍴⍵)⊢⍵}b ⍝ rearranging the triangle
⋄ b ← 4 4 ⍴ 8 5 9 3 0 2 4 6 0 0 7 4 0 0 0 3 ⋄ ⎕←⊃⌽{{(2↓⍵)⍪⍨(1↓2↑⍵)+0,2⌈/1↑⍵}⍣(¯1+⊃⍴⍵)⊢⍵}b ⍝ rearranging the triangle
 
@Sherlock9 Don't use comments!
 
Ah, nuts
⎕←⊃⌽{{(¯2↓⍵)⍪(1↑¯2↑⍵)+0,2⌈/¯1↑⍵}⍣3⊢⍵}4 4 ⍴ 0 0 0 3 0 0 7 4 0 2 4 6 8 5 9 3
 
@Sherlock9
23
 
Internally, the bot inserts your code into a dfn, but a comment symbol will terminate the line and so no } is found…
 
Oh whoops
Hrm, there has to be a golfier way to do the whole problem than just (grabbing a last line, taking the pairwise max, adding it to the second-to-last line, and appending that new line to the rest of the array), but I'm not seeing it
 
9:33 AM
@Sherlock9 reduce? i haven't really analyzed what the code is doing but you seem to be describing it
 
⋄ prob18 ← {(¯2↓⍵)⍪(1↑¯2↑⍵)+0,⍨2⌈/¯1↑⍵} ⋄ ⎕←prob18/ 4 4⍴3 0 0 0 7 4 0 0 2 4 6 0 8 5 9 3
 
@Sherlock9
┌─┬─┬─┬─┐
│0│0│0│0│
└─┴─┴─┴─┘
 
⋄ prob18 ← {(¯2↓⍵)⍪(1↑¯2↑⍵)+0,⍨2⌈/¯1↑⍵} ⋄ ⎕←prob18 4 4⍴3 0 0 0 7 4 0 0 2 4 6 0 8 5 9 3
 
@Sherlock9
 3  0  0 0
 7  4  0 0
10 13 15 0
 
Reduce could work, but something tells me my function is set up wrong
 
10:37 AM
@Sherlock9 do ↓ on the input to get the lines as ⍺ & ⍵
 
@dzaima How do you mean?
⎕←{{⍺,⍵}↓⍵}4 4⍴3 0 0 0 7 4 0 0 2 4 6 0 8 5 9 3
 
@Sherlock9
VALUE ERROR
 
@Sherlock9 something like {...}/↓⍵
may need to reverse the input list though as you start with the first two lines, not the last
 
10:54 AM
Almost works
Actually, hang on
⎕←{⍺+0,⍨2⌈/⍵}/↓↑(8 5 9 3)(2 4 6)(7 4)3
 
@Sherlock9
┌──────────┐
│20 13 15 3│
└──────────┘
 
None of those are the correct answer of 23, but it's an interesting start
⎕←{⍺+0,⍨2⌈/⍵}/↓(8 5 9 3)(2 4 6)(7 4)3
 
@Sherlock9
┌─────────────────────┐
│┌───────┬─────┬───┬─┐│
││8 5 9 3│2 4 6│7 4│3││
│└───────┴─────┴───┴─┘│
└─────────────────────┘
 
And this doesn't work at all
⎕←{⍺+0,⍨2⌈/⍵}/(8 5 9 3)(2 4 6)(7 4)3
 
@Sherlock9
RANK ERROR
 
10:57 AM
Nor this
Oh the 0,⍨ shouldn't be there but that doesn't resolve the rank error
 
... That was the original input order of the question and I reversed it on being asked to reverse it the first time XD
As you can see from one of a few entries that use 4 4⍴3 0 0 0 7 4 0 0 2 4 6 0 8 5 9 3
And now the next challenge!
...
Building the 100 by 100 matrix without going over the maximum input
⍨⍤⍣
 
11:16 AM
Hooooly cow this has over 500 unread messages. That's a first for me.
 
@J.Sallé What has?
 
@Adám first time I've seen this chat with over 500 unread messages. It usually doesn't accumulate so much
Guess I was working a bit more yesterday and didn't have time to check here
 
 
2 hours later…
1:25 PM
⎕←⊃⊃{⍺+0,⍨2⌈/⍵}/↓↑(3)(7 4)(2 4 6)(8 5 9 3)
 
@voidhawk
23
 
1:57 PM
@Sherlock9 applying that brings it down to a beautiful {⍺+2⌈/⍵}/
 
2:20 PM
@dzaima Ooh excellent
 
2:47 PM
Hm, should I try to do partition numbers (problem 78) or go take a nap XD
 
@Sherlock9 ⎕DL&3600 lets you sleep for an hour while you keep working!
 
Thanks! I'm already home from work though :D
 
Also note that ⎕DL&¨2/1800 lets you sleep for an hour while only 30 mins pass.
 
@Adám Welp, I now know which language to code my time machine in.
 
@J.Sallé John Scholes once rigged a presentation of his so that all of a sudden a number was printed into his session, to which he remarked that he doesn't know where that came from,. Then a while later during his demonstration he wrote ⎕DL with a negative number, and then commented that now he knows where that number had come from.
 
3:04 PM
I do love me some nerdy jokes.
 
 
5 hours later…
7:48 PM
@Adám I've gotten a nonce error, which I've never seen before, running this code ⍸{1pco⌊○10*⍵-1}¨⍳10. I think it's pco throwing it, but I'm not sure. What does it mean?
It runs fine for ¨⍳9, that's why I think it's pco's fault
I've tried setting ⎕FR←1287 and ⎕PP←34 to no avail.
 
8:36 PM
@J.Sallé nonce seems to only be happening in extended, in unicode it's giving domain error, i'm assuming that's pco just refusing to work with numbers that big no matter what
 
@dzaima Yeah, I looked into the function and it doesn't work for numbers over 105097564
⋄←⎕CY'dfns' ⋄ 1pco(1e9)
 
@J.Sallé
SYNTAX ERROR
 
huh, in code it's domain error
 
9:30 PM
@Adám if that's a base conversion, should it say xa²+ya¹+za⁰ instead of xa²+yx¹+zx⁰ ?
 

« first day (968 days earlier)      last day (33 days later) »