« first day (564 days earlier)      last day (725 days later) » 

3:03 PM
Hmm... I'm implementing a GCD function on N.y(n), but I'm not sure what the default input should be
1 would be pointless, since the GCD of anything and 1 is always 1
 
3:23 PM
Excuse me: the GCD of any integer and 1 is always 1
Oh my gosh: I'm experiencing a merge conflict because of a single added + in a line I didn't touch???
Well, it was easy to fix, so that's good
 
4:32 PM
@ETHproductions Can you help me with some JS? I'm super rusty (thanks to Japt)...
Current function f=s=>[...s].map(x=>x.charCodeAt(0)-32).map(n=(x,y=x)=>(x*x)%95==y?x:g(x-10))
I want the value of y to be the original value of x
Is that confusing?
@ETHproductions Good point, 2 then?
map(n=(x,y=x)=>(x*x)%95==y?x:g(x-10)) ...I'm trying to find the root modulo of x, but I need to keep the original value of x after decrementing.
So I'm trying to set y to the original value of x, but obviously it gets updated if I do (x,y=x)
 
 
1 hour later…
5:43 PM
@Oliver .map is called with (item, index, array) so you can't do anything with default parameters unless you do (x,i,a,y=x)=>
You could do n=x=>(y=x)*x%95==y?x:g(x-10) I think
Oh wait, do you want y to be the current value of x + 32?
hmm, it's a bit more complicated like that
f=s=>[...s].map(x=>(g=x=>x*x%95==y?x:g(x-10))(y=x.charCodeAt(0)-32))
I think this should work
 
@ETHproductions That's a really good work around. Thanks!
I believe s=>[...s].map(x=>(g=x=>x*x%95==y?String.fromCharCode(x+32):g(x-10))(y=x.charCod‌​eAt(0)-32)) solves the challenge.
 
@Oliver That'd be interesting. Xy would be 2 for even integers, 1 for odd, and some decimal for non-integers
@Oliver If output as a list of characters is allowed, yes. You could do s=>String.fromCharCode(...[...s].map()) if not
Or s=>s.replace(/./g,x=>...)
 
5:59 PM
The input can be a list of chars
s=>s.map(x=>(g=x=>x*x%95==y?String.fromCharCode(x+32).join(""):g(x-10))(y=x.cha‌​rCodeAt(0)-32))
wait that doesn't work
 
Are you sure x-10 is what you want?
Why not x-1 or x+1?
 
I'm not sure, I figured -1 would always land true 40
I need [80, 85, 66] -> [40, 35, 16] If I decrement, wouldn't it always land on 40
 
You could start at 0 and do x+1
s=>s.map(x=>(g=z=>z*z%95==x.cha‌​rCodeAt(0)-32?String.fromCharCode(z+32):g(z+1))(0))
Wait, what's the .join("") for? That'll just throw an error
 
I need to turn the array into a string
 
You've got it in the wrong place then, it should be at the very end
 
6:10 PM
You're right, thank you
Nice Japt solution
That took you all of 30 seconds? :P
 
I've been working on it for like 15 minutes :P
c!bHÆJÃc95Dz%95+H also works, though 1 byte longer
@Oliver What was wrong with your answer?
 
@ETHproductions Had to handle [""], fixed now
Ugh, nvm
 
@Oliver You don't have to handle [""], the empty string is represented as []
 
6:26 PM
But there's a test case '' -> ''
In Chrome, it throws an exception
 
'' represented as a list of chars is equivalent to [...''], try that
f([...''])
Hint: [...''] is the empty array []
 
Thanks :) I was actually about to add s+1!="1"?...:"" (I'm bad at JS)
@ETHproductions Output can be an array
 
Oh, so you don't even need the .join("")
 
Correct
 
 
2 hours later…
8:32 PM
@ETHproductions You ended up not having a default for GCD? :P
 
I pushed it before you talked to me about it :P
 
What's a coprime
> if the only positive integer that divides both of them is 1
ah ok
So their GCD is 1
 
Right
That's what it does internally (this.y(n) == 1)
 
Nice! \o/
 
Just pushed a whole bunch of changes to v2 (mostly refactoring and cleaning up the code). If you run across anything sketchy while testing code, just let me know
 
8:43 PM
Will do
 
Also added the default argument for the GCD function :P
 
Heh :P
Maybe change the docs to .y(n=2)
 
Oh right
 
Hey, no more alerts for non-functions
 
Yeah, since there were a ton of non-functions that didn't have the alert I decided to just get rid of the ones that did
 
8:50 PM
You expanded the single line functions, yay!
It makes stepping through functions easy
 
9:19 PM
Posted a question on SO for the first time in a long time: stackoverflow.com/q/45337572/4449486
 
 
2 hours later…
11:19 PM
@ETHproductions Hm, hope you figure that one out. Sounds like a real doozy
Sorry but, what does /../g match? regex101 isn't helping me with that one. Or is the .. a placeholder
I'm sure this doesn't help, but if you drop the g flag, you get the desired output
Oh, but the regex coming in can gave the g
Can you modify the regex coming in and catch gs?
 

« first day (564 days earlier)      last day (725 days later) »