« first day (663 days earlier)      last day (1976 days later) » 

2:08 AM
how do I check if something is imaginary or not?
=∘⌈⍨1j1e¯15
 
do you mean imaginary or complex?
 
is this sufficient?
complex probably
 
Imaginary numbers have no real part
You can get the real/imaginary parts of a number with 9○⍵ and 11○⍵
 
i want to know IF a number is imaginary or not
 
So 0≠11○⍵?
or (0=9○⍵)∧0≠11○⍵
 
2:38 AM
@nathanrogers ⊢=+
Unary plus is conjugate.
 
I guess imaginary would be -=+ then
 
this one is bugging me. as part of the one challenges, i need a J phrase for "the index of the first element in the list which has been seen before." the best i came up with was `1 i.~ ({: e. }:)\`. can anyone improve this?
 
3:00 AM
Which index do you want? Yours looks like it always returns the index of the second occurrence
 
3:17 AM
1 i.~1<#/.~ gives the index of the first occurrence of the first element appearing more than once
 
3:38 AM
@H.PWiz i need the 2nd. the 2nd occurence is "the first element which has been seen before." on the first occurence, it hasn't been seen yet so it doesn't count.
Another splinter in my mind has been "get the most frequent element of a list". My best attempt so far: ~. {.@\: 1 #. = for 11 bytes (the spaces can be removed). It feels like this one should be more concise in J but I've hacked at it for a while and can't get it down...
woops 0{~.\:1#.= was my shortest so far...
 
4:03 AM
How about ~:i.0:?
Index of zero on nub sieve
@Jonah
 
@Bubbler oh my! tyvm!
completely forgot about the nub sieve
 
@Bubbler: your last one got me under the APL answer :) codegolf.stackexchange.com/a/176210/15469
 
i like that freq element of a list one
 
@Jonah You can rearrange things to save another byte: Try it online!
 
re: the 8 bytes one, i stumbled on it myself but since it wasn't any shorter that the 1 #. = i stuck with the latter. <3 ^^. ty. will update post.
@Bubbler what langs do you usually golf in?
 
4:34 AM
Usually J, Jelly and Python, sometimes APL and JS.
 
i ought to bite the bullet and learn Jelly
 
Learning Jelly is pretty hard
 
Bubbler: Will my J experience help? What is the hardest part and what advice do you have for learning?
 
 
2 hours later…
7:05 AM
@Jonah The very first thing to understand is Jelly's parsing rule. I understood it as "how Jelly tried to trim bytes from J's tacit expressions".
Next thing is just reading the insane amount of built-ins.
If you're really interested, join Jelly Hypertraining and ask questions.
 
 
6 hours later…
1:06 PM
Dyadic Transpose https://codegolf.stackexchange.com/q/176164?atw=1 #codegolf
 
 
4 hours later…
4:53 PM
thanks kenneth
 
ngn
5:12 PM
can anyone shorten?
 
5:22 PM
@ngn Nope. Clever.
 
ngn
@Adám actually, there is a way. i wanted to test if it's relatively obvious.
 
@ngn ⍨
 
@ngn I'm pretty sure someone can shorten that (not me though)
 
ngn
cmc: given a char matrix, replace '/' with '\' and vice versa
 
6:14 PM
@ngn I'd totally have an answer for this if not for "matrix" :c
 
ngn
6:27 PM
@J.Sallé how many bytes? if it works for scalars and doesn't require extra parens, you could make it work for matrices by appending ¨
 
@ngn Is the matrix composed of only \/?
 
ngn
@Quintec no. other chars must be preserved
 
@ngn doesn't look like it. I've got (,¨⌽p)⎕R(,¨p←'/' '\\')⊢
 
@J.Sallé 2 × No need for . And no need for either.
 
@Adám huh, I think that was a remnant of an earlier version of the answer
I was having trouble getting the escapes to work, so I had to use '/' '\\' instead of '/\\' and just assumed I'd need the
 
ngn
6:45 PM
the best i had as part of this was '/\'∘(⍳⊃∘⌽,⍨)¨ but there's a shorter one. shall i reveal it?
 
@ngn please (○.○)
 
ngn
@J.Sallé you could do (⌽p)⎕R(p←'\\' '/') (as Adam mentioned) or even p⎕R(⌽p←'\\' '/')
@Adám {⊃3⌽⍵∪'/\'}¨
 
Thus spoke the Master
 
 
2 hours later…
8:31 PM
I am not worthy
 
@Quintec Of?
 
ngn :P
 
@Quintec noone is. :p
 
@Quintec He has years of experience — and is really smart too. And you don't have to be a good APL golfer to be a worthy APLer.
 
That code is so simple. Even I could understand it in one read, but I would’ve never thought to combine functions in that way
Ironically I don’t understand the longer train
 
8:37 PM
@Quintec the ability to combine things smartly is what makes ngn so good at APL. Really, most of APL is combining things :p
 
@Quintec Do you want '/\'∘(⍳⊃∘⌽,⍨)¨ explained?
 
Does that count as 3 functions or 4?
 
@Quintec Technically, just one.
 
Where, first of reverse, join with itself?
Well I mean as part of trying to interpret the train
 
@Quintec the train is called dyadically, i.e. ,⍨ is {⍵,⍺}, and is also called dyadically
 
8:40 PM
Yes, but I’m trying to find the 3 parts
oh I see
 
@Quintec There is only one; it isn't a train at all.
 
How can I tell if it’s a train or not? It seems to be all functions
 
@Quintec It is a single derived function which is monadic due to having a left argument bound '/\'∘(.
 
@Adám the thing inside the parentheses is a train though
 
Yes, I meant the middle in parenthese
 
8:42 PM
@Quintec Ah, yes, this single derived function is derived from a 3-train.
@Quintec ⍳ ⊃∘⌽ ,⍨
 
Yeah that’s what I was thinking.
 
Since there is a bound left argument '/\', the train must be called dyadically.
So the right tine (single one of a fork's three pointy tips) is ,⍨ so it appends the left arg '/\' to the main right arg (which is always a single character due to ¨).
 
So (‘/\’ f string) g (string,’/\’), where f is interval index
Sorry for weird notation am on phone
 
@Quintec No, is just indices-of.
 
Oh for some reason I thought there was an underbar
 
8:46 PM
@Quintec to expand, ('/\' ⍳ ⍵) ⊃ ⌽ (⍵,'/\')
 
Yeah
 
So, e.g. for . it looks .. up in '/\' which is number 3 because unfound elements become 1+lastindex.
And on the right we get '\/.' (due to being applied monadically to the right argument of the derived function ⊃∘⌽ before is applied dyadically).
 
what does dyadic horseshoe thing do
for lack of a better way to say it on mobile
 
@Quintec Picks the element with that index.
@Quintec (it is called right shoe!) The function is called "pick".
 
so it picks from the reverse? Or is that also dyadic
 
8:50 PM
@Quintec yes - ('/\' ⍳ ⍵) ⊃ (⌽(⍵,'/\'))
 
@Quintec It picks from the reverse because of . In this case it could just as well have been (index).
 
Pick the indices where ‘/\’ are in the original string in the reversed string with ‘/\’ appended to the front
 
@Quintec No, use the location of the character in '/' '\' ⍵ to pick from '\' '/' ⍵; in other words, swap '/' and '\' and leave all other chars as-is.
 
Oh right, because ‘/\’ is an array of charaxters
 
Nice example of why it is so neat that APL gives 1+maxindex for unfound items.
 
 
1 hour later…
ngn
10:19 PM
lol, thanks everyone for the hyperbolical remarks :)
 
11:17 PM
@ngn This is the first example of your true genius that I have been able to comprehend ;)
 

« first day (663 days earlier)      last day (1976 days later) »