« first day (587 days earlier)      last day (2083 days later) » 
00:00 - 17:0017:00 - 00:00

ngn
5:00 PM
I can't bear the thought that ngn/k still does that too, it's time for me to catch up with Arthur...
 
@ngn yeah, it's sad
@ngn And yeah I can do that with ⎕IO←1
 
ngn
@Adám I think that bit was wrong, there could be a ¯2, ¯3,... so it should have been ⍵/⍨0≤⍵
 
@Adám what he said
@Adám this one works though
 
ngn
hey, why not use square-bracket indexing instead of ?
 
@ngn Yeah, I was getting to something like that.
 
ngn
5:03 PM
{0::0⋄f≡⌽⍵[f←⍵/⍨0≤⍵]}
 
@ngn well in the original version it wouldn't work, not sure now
 
@ngn Yup, and then the error guard goes away.
 
ngn
@Adám I think we still need it - if ⍵ contains invalid positive indices we must return false
 
Yeah we need to return false on an index error
Can't just error according to the challenge specs
 
Can you maybe 0⌈indices or something so that returns false?
 
ngn
5:13 PM
@Adám you don't know what's at index 0, it might happen to be the same as the corresponding item across the ≡
 
@Adám that would change the array, wouldn't it? The input is an array of indices, and basically it returns true if x y≥⎕IO and (vec[x]=y)∧(vec[y]=x)
must be true for every pair of indices in the array btw
 
ngn
@J.Sallé @Adám next idea: use
"where"
{0::0⋄f≡⌽⍵[f←⍸0≤⍵]} passes the tests
 
@ngn Ha! Nice!
 
@ngn whoa that's a nice catch
 
ngn
in k: {a~|x@a:&-1<x} thanks to the fact that out-of-bounds indexing returns nulls
 
5:28 PM
@ngn I was about to translate it into K hahahahah
 
@ngn I don't think that can give an error.
 
ngn
@H.PWiz haha, that's the final blow :)
(I should say "final", you never know...)
 
@ngn But wouldn't f≡⌽⍵[⍬] give 1 when it should give 0? (Have not read the challenge.)
 
I was about to add that
 
ngn
@Adám the expected result for an empty input is truthy
 
5:38 PM
Actually that wasn't what I was about to add.
This fails when a cell points to itself, which is specified to not be a tunnel
 
@ngn But if it isn't empty, just only has negative (bad) indices, gives ⍬.
 
Different Challenge: Given a permutation of ⍳n. Check if it is only tunnels (where an element that points to itself is a tunnel). I pose this because I believe there is a short solution
 
@H.PWiz ⍋≡⊢ ?
 
ngn
@Adám see this test case: [-1, -2, -3] Truthy (no tunnels, that's OK)
 
@Adám Yes, that's what I had
 
5:43 PM
⍒≡⌽ works too.
 
ngn
@H.PWiz I think they should add that to the tests, it's not clear to me what the intended result is for input ,0
 
@ngn I would argue that that case isn't very different from 1 0. Just that your solution happens to not work when there is only one positive value
 
ngn
hm, that seems wrong
 
5:58 PM
@ngn I don't think the test cases on that challenge are very interesting. How about 2 3 0 1. I think that has two tunnels
 
ngn
@H.PWiz I've just suggested that test case in the comments :D
 
6:43 PM
This dark SE theme makes this look very pleasing to me. I like it.
 
@J.Sallé Dark SE theme?
 
@Adám yes. Someone at TNB mentioned it and gave me the link. It's like a userscript but it uses CSS or some such thing. Here's the link.
 
 
5 hours later…
11:44 PM
@Adám sorry I fell asleep lol
 
@NoahCristino What time zone are you in?
 
00:00 - 17:0017:00 - 00:00

« first day (587 days earlier)      last day (2083 days later) »