« first day (995 days earlier)      last day (1959 days later) » 

00:18
@Jonah How about this?
@Bubbler That's nice, though I have 1 additional requirement I didn't specify clearly enough. I need to be able to "tick up". That is, I either need to be able to give a number and get the odometer equivalent of that number, or else be able to continuously increment the odometer to its next highest value, as with my original example.
00:41
After some thoughts, mine converged to yours but with two less ~s.
00:59
@Bubbler, Nice. Thanks for looking.
01:42
And looks like J got a new cool set of primitives quite recently
02:03
Excellent. I need to read up on those.
 
2 hours later…
04:19
⎕←{n←⌊3⍟1+⍵×2⋄P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←(n/¨3)⊤¨⍵+2÷⍨1-3*n⋄'S' 'NE' 'NW'[⍬{0=≢⍵:⍺⋄t←⌊/⍵∘{⊃⌽⍸⍺=⍵}¨⍳3⋄(⍺,t⌷⍵)∇⍵↑⍨t}P],'N' 'SW' 'SE'[Q]}299792458 1000
@Sherlock9
INDEX ERROR
Got it down to 132
Oh right
⋄⎕IO←0⋄⎕←{n←⌊3⍟1+⍵×2⋄P Q←w↓⍨¨¯1+0⍳⍨¨=/w↑⍨¨⌊/≢¨w←(n/¨3)⊤¨⍵+2÷⍨1-3*n⋄'S' 'NE' 'NW'[⍬{0=≢⍵:⍺⋄t←⌊/⍵∘{⊃⌽⍸⍺=⍵}¨⍳3⋄(⍺,t⌷⍵)∇⍵↑⍨t}P],'N' 'SW' 'SE'[Q]}299792458 1000
@Sherlock9
┌──┬─┬─┬──┬──┬──┬──┬──┐
│NE│S│S│SE│SW│SE│SW│SE│
└──┴─┴─┴──┴──┴──┴──┴──┘
⋄⎕IO←0⋄⎕←{n←⌊3⍟1+⍵×2⋄P Q←w↓⍨¨0⍳⍨¨=/w↑⍨¨⌊/≢¨w←(n/¨3)⊤¨⍵+2÷⍨1-3*n⋄'S' 'NE' 'NW'[⍬{0=≢⍵:⍺⋄t←⌊/⍵∘{⊃⌽⍸⍺=⍵}¨⍳3⋄(⍺,t⌷⍵)∇⍵↑⍨t}P],'N' 'SW' 'SE'[Q]}299792458 1000
@Sherlock9
┌──┬─┬─┬──┬──┬──┬──┬──┬─┐
│NE│S│S│SE│SW│SE│SW│SE│N│
└──┴─┴─┴──┴──┴──┴──┴──┴─┘
04:26
Bug fix saved bytes!
I forgot to finish converting to ⎕IO←0 :D
 
8 hours later…
12:07
This bounty applies to this challenge. I've found a 9-byte Extended Dyalog solution.
Oh right I should claim a bounty on this answer
Also, if you have any golfing suggestions for that answer, I would very much appreciate it :D
@Sherlock9 Why only 100? Isn't it the shortest answer?
Oh whoops. I forgot about the bonuses XD
12:23
@Sherlock9 Willing to go Extended?
@Adám I think so, what do you have in mind?
⎕CY'dfns'
{P Q←w↓⍨¨⊃⍸≠⌿↑1+w←(⍳3)∘adic¨⍵⋄'S' 'NE' 'NW'[⍬{0=≢⍵:⍺⋄t←⌊/⍵∘{⊃⌽⍸⍺=⍵}¨∪⍵⋄(⍺,t⌷⍵)∇t↑⍵}P],('N' 'SW' 'SE')[Q]}
→
{P Q←w↓⍨¨⊃⍸≠⌿↑1+w←(⍳3)∘⌂adic¨⍵⋄'S' 'NE' 'NW'[⍬{=≢⍵:⍺⋄t←⌊/⊃∘⌽∘⍸¨⍵∘=¨∪⍵⋄(⍺,t⌷⍵)∇t↑⍵}P],Q⊇'N' 'SW' 'SE'}
Ven
Ven
@Adám why's that (⍳3) in parentheses?
@Ven ⍳3∘⌂adic¨⍵
Ven
Ven
oh, it's not a . I'll blame firefox for that one...
12:29
@Sherlock9 In any case, you don't need to parenthesise ('N' 'SW' 'SE')[Q]
Heck, I was sure I'd fixed that
I'll edit it in at the same time as changing to Extended
@Sherlock9 Full program at 99
@Adám I've edited it in! I should probably rearrange the post so that the Extended solution is the more prominent one but I don't get why =≢⍵ is equal to 0=≢⍵ here
@Sherlock9 Because in Extended, all monadic scalar comparisons imply the prototypical element as left argument, so numbers are compared to 0 and characters to space.
13:07
@Adám I've a 10-byter for non-extended
@J.Sallé That's good. Hurry up and cash in!
Yeah I'm just finishing testing to see if I didn't miss anything
Ven
Ven
@Adam Did you consider :47640307 any further?
@Ven What is ":47640307"?
Ven
Ven
Nov 16 '18 at 7:12, by Adám
@dzaima {⍺⍺ ⍵} is ignore-left-and apply-monadically? I've thought about that. Yes, I agree that a single-char {⍺⍵} would be very valuable. seems like a nice symbol…
I guess you can't reply after a while.
13:15
@Ven Which one of them? I did add to Extended Dyalog APL.
@Ven pretty sure you can, you just can't have anything before the : and must have stuff after :num
Ven
Ven
@dzaima ah, maybe then!
@J.Sallé ⍵*2 could just be |⍵, no? Anyway, I don't see it handling ¯5 5right; it needs to return 5: if the temperatures are -5 and 5, output 5.
@Adám |⍵ wouldn't handle that case, while ⍵*2 does
@Adám TIO
13:25
@J.Sallé both give 25, no? Try it online!
@Adám Yeah I hadn't tried the negative number before the positive
shucks
@Adám I think I've fixed it for an extra 2 bytes
Still testing to see if I missed anything though, but I think {⊃⍵[⌽⍋⍵×-⍵]} works
@J.Sallé That doesn't look right. Again, positive and negative are treated the same since ⍵×-⍵ is the same as -|⍵*2
I find it strange that ⍵[⍒⍵×-⍵] doesn't match ⍵[⌽⍋⍵×-⍵]
@J.Sallé Because of duplicates. Think about how you'd grade 1 1 2 where gives 1 2 3 and gives 3 1 2.
@Adám I was using the wrong test case >.< goddamn it
@Adám Yeah I assumed that was it.
13:55
Ah hell there's a bug in the code
14:13
@Sherlock9 I'll wait for a fix before bountying.
Sure thing
I'm a little distressed as a) I should have seen this earlier, and b) while I have written a correct answer in Ruby before, I'm not sure how to translate it into APL
The idea is that I can't just chop off everything before the point of mismatch. It's not efficient enough. I need to find a way to keep the two paths and the common ancestor and also search the first path and the common ancestor for the shortest backtracking step
And it's all so jargon-y in my head, I'm not sure where to start
I have an idea for a fix but I'm not sure how to implement it. In a case like 66 to 1, where the paths are P←1 3 3 3 and Q←1, the point of mismatch is index 2. ⍸P∘=¨∪P gets us (1)(2 3 4) and then ⊃⌽⍸P∘=¨∪P gets us 1 4. Now I need to get, not the minimum, but whichever index in that last list is closest to the point of mismatch, 2. Now how do I do that?
ngn
ngn
@Sherlock9 can P and Q contain 0s?
if not, maybe something like ⎕io++/=⌿↑P Q?
15:25
@ngn I can fairly easily change the 0 1 2 of the alphabet to 1 2 3 by just adding 1 to P and Q
Sorry I keep swapping between ⎕IO←0 and ⎕IO←1 and forget to specify
@ngn Okay so with ⎕IO←0, that's +/=⌿↑1+P Q
ngn
ngn
@Sherlock9 shame on apl for allowing that :)
:D
Okay I'm not sure how this solves my problem of needing to find from a list of ancestors, the one closest to the point of mismatch. So of ancestors 3 7 14 and point of mismatch 9, the answer should be 7
ngn
ngn
15:41
@Sherlock9 that just finds the index of the point of mismatch. if there's more, i don't quite understand what the rest of the task is.
Ahhh fair enough
ngn
ngn
"whichever index in that last list is closest to the point of mismatch" - isn't that always pointOfMismatch+1?
Basically once I've found the indices of the ancestors, say, indices 3 7 14. I need to find the index that's closest or equal to that point of mismatch
ngn
ngn
@Sherlock9 ok, let me try to re-state it in my own words: so you've got a list of numbers a and a number b and you want to find the element of a that is closest to b?
Exactly!
Sorry for not being clear! I'm having trouble understanding everything myself
ngn
ngn
15:46
a[⊃⍋|a-b]?
To misquote Tom Lehrer
> It's so simple
So very simple
That I could not help but be completely annoyed XD
Thank you very much. One moment while I write all this down
ngn
ngn
googling "Tom Lehrer" ... :)
@ngn I just realized the problem. I'm looking for the first point where P and Q mismatch. That gets me the number of matches between the two lists.
The song you're looking for is New Math. The original lines are:
It's so simple / So very simple / That only a child could do it
ngn
ngn
lol :) i knew that voice sounds familiar - it's the guy who turned the periodic table into a song
16:13
⎕←{M←⊃⍸≠⌿↑1+P Q←⍵{(⍵/3)⊤⍺-+/3*⍳⍵}¨⌊3⍟1+⍵×2⋄I←⍬{M≥≢⍵:⍺⋄t←{⍵[⊃⍋|⍵-M]}⍵∘{⊃⌽⍸⍺=⍵}¨∪⍵⋄(⍺,t)∇t↑⍵}P⋄'S' 'NE' 'NW'[P[I]],'N' 'SW' 'SE'[Q↓⍨⊃⌽I]}66 5
@Sherlock9
┌─┬──┐
│S│SW│
└─┴──┘
Oh I didn't specify ⎕IO
⋄⎕IO←0⋄⎕←{M←⊃⍸≠⌿↑1+P Q←⍵{(⍵/3)⊤⍺-+/3*⍳⍵}¨⌊3⍟1+⍵×2⋄I←⍬{M≥≢⍵:⍺⋄t←{⍵[⊃⍋|⍵-M]}⍵∘{⊃⌽⍸⍺=⍵}¨∪⍵⋄(⍺,t)∇t↑⍵}P⋄'S' 'NE' 'NW'[P[I]],'N' 'SW' 'SE'[Q↓⍨⊃⌽I]}66 5
@Sherlock9
┌─┬─┬──┐
│S│N│SW│
└─┴─┴──┘
ngn
ngn
16:28
@Sherlock9 in your answer you must specify ⎕fr←1287 too, otherwise it fails for 1162261466 1743392199
16:40
@ngn It looks fine to me with ⎕FR←645
I'll keep it in mind though
ngn
ngn
interesting...
it works on tio, so you're right
in my interpreter it fails, i'm using a model for ⍸: where←{(,⍵)/,⍳⍴⍵}
17:29
I should add the reason for the algorithm being incorrect to the explanation at some point
 
1 hour later…
18:59
I found and fixed another bug while writing up an explanation to the previous bug! XD
 
1 hour later…
ngn
ngn
20:11
reminder: ≈1h left
20:59
I really liked this answer and I'd appreciate any golfs you guys might find. There's an awful lot of parenthesizing going on in there
21:10
@Sherlock9 115
ngn
ngn
for my bounty, @H.PWiz gets 350 rep for his 28-byte answer and @dzaima gets an honourable mention for (probably) having come up with a shorter answer but never publishing it.
ngn
ngn
@ngn my 23-byte solution: {⍉⍵⌹¯1*+⌿×/2⊥⍣¯1↑⍳⍴⍵}⍣2
@ngn yep, my part of 27 was ¯1*≠⌿∧/2⊥⍣¯1↑⍳⍴⍵, though as i have no idea what matrix multiplication or division is, i had no ability to golf that part
21:20
@ngn What was your 27? Like mine+dzaima's?
Also, cool solution!
ngn
ngn
@H.PWiz yeah, equivalent to those combined
when you said you had 28 i knew you'd figured out the trick with ⌹ :)
and when dzaima said he had -1, i was almost certain he had something equivalent to my way to generate the Hadamard matrix
proof that the 23 solution is correct, starting with H.PWiz's formula:
(⍵⌹h)+.×⌹h  ←→  ⍉(⍉⌹h)+.×⍉⍵⌹h  ←→  ⍉(⌹h)+.×⍉⍵⌹h  ←→  ⍉(⍉⍵⌹h)⌹h  ←→  (⍵(⍉⌹)h)(⍉⌹)h  ←→  h(⍉⌹⍨)h(⍉⌹⍨)⍵  ←→  h(⍉⌹⍨)⍣2⊢⍵
it uses the identities a+.×b ←→ ⍉(⍉b)+.×(⍉a), a⌹b ←→ (⌹b)+.×a, and ⍉h ←→ h (because the Hadamard matrix is symmetric)
22:14
@J.Sallé 44 and can probably cut another couple with Extended.

« first day (995 days earlier)      last day (1959 days later) »