« first day (2476 days earlier)      last day (2370 days later) » 

You
3:00 PM
I bricked a phone which
1. is Korean exclusive
2. no developers give a f*** about
 
oh that thing
well rip then :/
 
CMC: Given an integer Q, output the highest prime factor of Q that is palindrome.
 
You
and I'm trying to fix it bcz I'm gonna be damned if I don't
 
9 -> 3
@You Did you recently change your name or something? If so, what were you called before?
 
You
3:03 PM
Nobody
 
13 is not a palindrome or am I misinterpreting?
 
@Mr.Xcoder Why is 13 considered a palindrome?
 
@Mr.Xcoder I didn't get it, 13 is not a palindrome?
 
Should be the same in forwards and reverse
 
@HyperNeutrino @MarcusAndrews @J.Sallé Sorry!
 
3:03 PM
what about something like 169 = 13 x 13
 
169 -> Undefined, 55 -> 11
 
the prime divisor part makes it long but i can do divisor with print(max(k for k in range(1,q) if str(q)==str(q)[::-1]and q%k==0)) or something
 
==0 => <1. And str(z) is `z` in 2. Also you can remove the space between range and if
 
so by undefined do you mean return a set undefine-value or just do whatever
 
Undefined means anything, including summoning Cthulhu ()
@Mr.Xcoder Jelly, 7 bytes
 
3:09 PM
I have jelly answer, spoiler or post directly
ok nvm then
I had ÆfŒḂÐfṀ lol same
 
I guess... :P post
 
CMP: Would people find it helpful if I made a Jelly tutorial video series or has everyone who wants to learn Jelly already learned it from tutorial page or JHT? :P
 
I hate watching video. Reading is easier. So, no.
 
ok :P
I find videos hard to follow along sometimes because half the time they're too slow and the other time too fast but some people find them useful
 
Maybe we could write our own (JHT) Jelly documentation pages and newbie-friendly hints, since the ones in Jelly's wiki are quite hard for new users to follow.
 
3:13 PM
@HyperNeutrino I have made a video intro to Brachylog, if you want an example
 
that was mainly where I drew inspiration for the idea :D
 
ninja'd I guess then...
 
lol
 
@Mr.Xcoder that's a pretty good idea. I might also get around to making an improved documentation page that has better searching
 
3:14 PM
I thought about doing more but it's difficult to find a proper learning path
 
and also copy-pasting symbols using keyboard shortcuts because I don't like using my touchpad xD
 
and I'm not sure there's interest for it anyway
 
@Fatalize I find one thing hard in Brachylog: How to get rid of its declarative style when it's not needed. For instance, if I want to output the alphabet, what should I do in order to prevent it from printing true.?
Adding Z = as an argument didn't do it :P
 
@Fatalize Most places have free refills though
 
@Mr.Xcoder this?
I guess we would need the code you tried to see why it didnt work
 
3:18 PM
@Fatalize Oh... Dang I had an extra =. I always added Z= instead of Z or OUTPUT... That's why it never worked... Thanks and sorry :C
 
Oh
 
I am dumb.
 
It seems like input and output has always been confusing
No you're not, Erik and LeakyNun had the same difficulties understand inputs and outputs
I'm not sure how to make it clearer
Basically the argument in TIO is for the second variable of th main program
And an uppercase string is a free variable
So really when you put Z you only state that the Output is some variable called Z that is unknown
 
CMC: Given an integer i and a number n, return any i x i matrix with determinant n. The results don't have to be consistent with the same i and n.
 
Prolog is an odd language, and Brachylog is odder still.
 
3:21 PM
@HyperNeutrino test case?
 
If you know Prolog, Brachylog is fairly easy to understand
Most confusions in Brachylog would not exist if learners knew Prolog
 
I knew prolog at one point, no longer do.
 
They are often about unification, backtracking and constraints, which are basic parts of Prolog
 
I still basically understand the concepts behind it.
Doesn't make it any less odd though.
 
@Pavel I relearned Prolog about 2 years after first learning it, to start participating in PPCG :p
 
3:23 PM
Nice
 
I've actually never used Prolog for any "real" application
 
@HyperNeutrino Created :P.
 
I sometimes use Brachylog to programmatically generate strings for work sometime but that doesn't count
 
i = 3, n = 3 => 1 2 3 ; 4 5 6 ; 7 8 8
i = 2, n = 5 => 1 5 ; 1 10
i = 3, n =-8 => 0 4 5 ; 8 5 2 ; 0 3 4
^^^yay
 
any faster way to sort incoming integers, space-delimited on one line?
input()
print(*sorted(map(int,input().split())))
 
3:25 PM
I don't know what you would even use prolog for honestly
It's not particularly good at doing actual work
 
@MarcusAndrews faster or golfier?
 
shortest bytes possible
ruby, python
etc
 
@MarcusAndrews why do you need to discard the first line and why do you need the *
 
first line is n, number of entities
i don't use it so i discard
 
oh ok
 
3:26 PM
second line is the array to sort, space-delimieted
* to output space-delimited array
splat operator
 
@Pavel It's good at parsing stuff
 
@MarcusAndrews $_=eval"[#{$_.gsub/ /,?,}]".sort with -p flag.
 
I can't use flags
 
Why not tho
 
The interface doesn't allow it
 
3:28 PM
What interface
 
Codingame
I'm using their codegolf challenges to learn Ruby/Python/shorter code a little better
But the built-in IDE doesn't allow flags
 
@Pavel NASA uses Prolog for the ISS vocal commands
 
@HyperNeutrino Do you want write access to the repo?
 
@MarcusAndrews $><<eval"[#{gets.gsub/ /,?,}]".sort*"\n"
(It should be seperated by newlines, right? Not too good at python)
 
hm it doesn't like the [
it's all on one line
e.g. input is 4 3 2 5 1
output 1 2 3 4 5
 
3:30 PM
right because its an int array
dur
 
@Mr.Xcoder sure though I'm not sure how much I'll be able to contribute
 
I added you as a contributor
 
@MarcusAndrews eval("[#{gets.gsub/ /,?,}]").sort.each{|i|p i}
 
cool thanks!
 
@Mr.Xcoder Copy the old documentation and then extend it should be a better idea than write them from scratch.
 
3:32 PM
Have gotta learn this gsub thing
 
@user202729 I'll see.
 
@MarcusAndrews General SUBstitute
 
(probably I'll use a lot of the old one)
 
First argument is a regex, second is the replacement string
so 'foobarbaz'.gsub(/a/, '!') yields 'foob!b!z'
 
hm someone got 40, so apparently it can be done shorter
 
3:33 PM
The second argument can also be a block to compute the replacement string
 
that code didn't work either as it doesn't take in input from the IDE
not sure why
 
gets.split(' ').map{|i|i.to_i}.each{|i|p i} might be shorter but I'm too lazy to count bytes.
 
mm unfortunately not
that automatically sorts somehow?
 
Wait forgot to sort
crap
 
@HyperNeutrino But it can be consistent? | Obviously i > 0?
 
3:43 PM
consistency is not required and i > 0 yes
 
Hm... is there "rightpad" atom in Jelly? Or Enlist? For 1D or 2D array?
can be useful.
 
nope, Jelly lacks padding functions
 
Extremely ungolfy solution: 12 bytes Jelly Try it online!
 
I want to add a bunch of features to Jelly, but the code would look like an ungodly mess of random symbols :P
 
you can take the G off the end and put it in the display link
 
3:49 PM
Actually only 11 bytes because G is for formatting.
 
also is it just me or is that invalid
shouldn't it be 30000;01000;00100;00010;00001 or am I being dumb again
 
Oh sorry
Corrected: Try it online!
 
nice
anyway gtg o/
 
@MarcusAndrews Got it in 40, puts gets.split.map(&:to_i).sort.join' '
 
4:02 PM
ah clever
what's the & mean?
surprised it lets you join with string even though at that point they're all ints
I guess it implicit-casts or something
 
@MarcusAndrews &: is how you reference functions in ruby, since just typing their name calls them.
 
In this case same as doing something like .map{|x| x.to_i} ?
 
Yep
 
4:16 PM
CMC: Read a number $n from input, and join the next $n lines of input with spaces and output. More input may be supplied than $n, in which case the unneeded input should be ignored. If less than $n lines are supplied, the remaining lines are assumued to be empty but should still be joined by spaces and tacked onto the end.
Alternatively, take n as a parameter to a function, and read n lines from StdIn.
 
@Pavel So add a space for each missing line?
 
Yep
 
Far too long, Python 97:
import sys
i=int(input());k=sys.stdin.read().split("\n");print(" ".join((k+[""]*(i-len(k)))[:i]))
@Pavel Can we take input from command line args instead?
 
@Mr.Xcoder sure
I realized the stdin wasn't intresting when I realized it just tacked a $stdin.read.split("\n") to the front of the solution
 
4:30 PM
@LuisMendo multiline strings in MATL
['foo' 10 'bar'] is annoying
'foo
bar'
is better
 
Better as a func: def f(k,s):r=s.split('\n');print" ".join(r[:k])+" "*(k-len(r))
And a more interesting 61-byte approach.
 
@Pavel Jelly, 5 bytes: Try it online!
^^ Sorry I mistakenly use "code golf submission" mode from TIO.
 
Is there a way to check EOF in Jelly?
 
The output should be l1 l2 l3 l4 (with trailing space) for your input and 5.
@user202729 ._. why would one want that, yes there is. Literal Python ŒV
 
4:38 PM
@Mr.Xcoder How can you solve the challenge without that?
 
@Mr.Xcoder huh
 
(ignore the possibility of take input as argument)
 
@user202729 See my method above in Python. It gets all input, splits by newlines, then joins by spaces the input with the elements after index k trimmed (like head), then appends k - number of lines spaces.
I don't even want to try it in Jelly
@EriktheOutgolfer I think you can use literal Python to catch an EOF in jelly :P
 
@Mr.Xcoder if you want to detect EOF, ɠ is not what you should use
 
Did I ever mention ɠ?
 
4:43 PM
instead you have to resort to ƈ
ƈ won't throw like ɠ at EOF
 
@Pavel STDIN in PowerShell is weird, so here's a close equivalent in 47 bytes
 
@AdmBorkBork Did you manage to play around with Jelly's quicks?
 
I did some, still couldn't figure it out.
 
Just ask if you want guidance
Q: Is id(0) modulo something considered random by PPCG standards?
 
4:47 PM
@Pavel Python 2, 33 bytes: exec'print raw_input(),;'*input()
 
Result should be one two three (4 trailing spaces)
 
hmm...
looks like apl should compete fairly well...except from the fact of stdin
 
@EriktheOutgolfer I didn't even start trying because of that >.>
 
@Neil please don't tell me
that's a switch
in a code golf problem
 
@orlp without weighting any particular way, it clearly says switch, so it's definitely a switch
:p
 
4:52 PM
@orlp OK, I won't
 
I guess I could eliminate it if the input was guaranteed not to contain tabs etc.
 
CMC: Output the nth term of this sequence: 1, 0, 1, 2, 4, 1, 6, 8, 0, 1, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, ... (1 followed by 1 even digit, 1 followed by 2 even digits, ...). The even digits must start from 0, and must appear in cyclic order. Choose either 0 or 1-indexing. Alternatively, you may output the first n terms.
 
@Dennis yup otherwise you could just do ⁸;ƈ$ÐLỴż⁶ :p
@Mr.Xcoder not sure if that's more appropriate as a cmc or as a main?
 
@Dennis Oh yeah of course, but id(0)%17 for instance? Thanks anyway
@EriktheOutgolfer I think I'll move it to Main
 
4:56 PM
@Pavel I know :-( But that's as per Matlab / Octave. I had one idea to solve it, but turned out to be too complicated
 
@LuisMendo wait huh
why can't you just so something like
 
@Pavel Can we wait indefinitely until n lines have arrived?
 
'This is a newline:
'
 
How does Cyclic Sequence of even digits, with odds in between sound? (for the title)
 
I'd recommend sandboxing first btw
 
4:58 PM
Already sandboxing.
 
you might find out it's actually a dupe :D
 
@EriktheOutgolfer
 
@EriktheOutgolfer I don't think so... But well, we all know Peter :P
 
peter has an amazing ability to recognize dupes most of us wouldn't
the second part of this sentence is a reason to sandbox on its own :p
 
I know, that was a compliment
 
5:00 PM
@Adám how do you input newlines into that
 
What do you think about this description:
> It consists of runs of even digits, of increasing length which are interleaved with the digit 1. The even digits are always in cyclic order, which means that they appear in ascending order until we get an 8. Then, we cycle back from 0.
 
Are you sandboxing the sandbox post?
 
@Dennis Good point...
 
@Dennis what sandbox post? it's not yet one afaik
 
It's currently being sandboxed here.
 
5:08 PM
@Dennis well, people will actually see it here.
 
Yeah I kinda used TNB as a Sandbox for the Sandbox answer, which is a sandbox for main :P
 
Question: do we have a vanilla Cartesian Product challenge? There's Cartesian product of two lists, but it's a bit different if more than two lists are involved.
 
I disguise my use of TNB for sandboxing with CMCs.
 
@EriktheOutgolfer You don't need to. The challenge is to get lines. Each call to it gets a single line. {⍞}¨⍳n gets you a vector of n lines.
 
5:14 PM
Sandboxed. Any help with the description is welcome
 
@Adám sure, just asked if there's a way to input newlines as well...or how to eof
 
@Dennis Well, you know how it is. Most effective dupe-checker out there is the "Post title" field to the question-asking form.
 
@EriktheOutgolfer No, every newline will cause to return.
@EriktheOutgolfer Well, you can keep looping until the input ends with a ⎕UCS 0.
CMC:
RC4 stream cipher in one tweet: KSA=(k)=>{S=[];j=0;for(i=0;i<255;i++){S[i]=i}for(i=0;i<255;i++){j=(j+S[i]+k[i%k.length])%256;b=S[i];S[i]=S[j];S[j]=b}return S} PRGA=(S,i,j)=>{i=(i+1)%256;j=(j+S[i])%256;b=S[i];S[i]=S[j];S[j]=b;K=S[(S[i]+S[j])%256];return[[S,i,j],K]}
 
@Adám looks like javascript. that's all I know.
 
If ←⎕ reads from stdin, what does ←⍞ do?
 
5:17 PM
Not sure about the rest, but i<255 is definitely wrong.
 
@Pavel evaluates a line, return an unevaluated string
 
Ah
 
@Dennis Nicely spotted. My APL reply doesn't have that bug.
 
So the shortest tweetable RC4 stream cipher?
 
@Pavel Actually, is a little bit more than ⍎⍞ (execute STDIN), in that it will send a short prompt to STDERR, insist on an answer, allows system commands, and allows the user to break out.
 
5:20 PM
Cool
 
@Mr.Xcoder "tweerable" is redundant. The shortest possible is tweetable.
 
@Adám in this case, yes
 
Is Squad () just a pun on Quad () or is there another reason behind the name?
I don't think I've ever seen Squad actually used.
 
@Pavel squished quad
@Mr.Xcoder More specifically: Total byte count of two functions with the same I/O structure as the tweet's.
 
The description for Squad says "Materialize" and I can't figure out what the example doing.
 
5:24 PM
@EriktheOutgolfer It has to do with the fact that input is interactive and as in Matlab. That means that an "enter" key finishes the input. I thought of taking the unevaluated input when "enter" is pressed, seeing if the input so far is valid (if the closing quote is present), and else inputting another line.
Quotes within the string are no problem (they are escaped by duplicating). But the problem is that a single, unmatched quote may appear (and it means transpose). Handling that is diffcult
 
@Pavel I tend to use more, and they are often equivalent. However, can index high-rank arrays. E.g. 2⌷matrix is the second row, and 2 3⌷matrix is the third element of the second row.
 
@Adám well for one, u can set 256 to a variable
that'll take off two bytes
 
@Adám Wow, the description for Squad is unhelpful. I couldn't tell that anything is being indexed in the examples.
 
@Pavel Monadic is an identity function (no-op) for most things, but for .NET collections it turns them into vectors of .NET objects, and for a class with a default property it returns that.
 
0
A: Sandbox for Proposed Challenges

Mr. XcoderThe cyclic sequence of even digits, with odds in between Consider the following sequence: 1, 0, 1, 2, 4, 1, 6, 8, 0, 1, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 0, 1, ... The even digits start from 0 and are grouped into runs of increasing length. They are arranged cyclically, meaning ...

 
5:27 PM
@LuisMendo Do you think or would be suitable, now that you have ?
 
@Pavel Which description are you looking at? TryAPL/IDE Language bar or the full docs?
 
@Adám I think he's looking at the REPL description?
 
@Mr.Xcoder I think binary, yes. Thanks
 
@Maltysen I don't see how that's going to save anything.
 
4
Q: Tiling in one dimension

Luis MendoThe purpose of this challenge is to determine if a collection of one-dimensonal pieces can be tiled to form a continuous chunk. A piece is a non-empty, finite sequence of zeros and ones that starts and ends with a one. Some possible pieces are 1, 101, 1111, 1100101. Tiling means arranging the p...

 
5:31 PM
@noidd @kaepora We do love a challenge - yes we can do it in 123 characters: KSA←{S⊣⍵∘{S[⌽p]←S[p←⍵,j←256|j+S[⍵]+⍺[⍵|⍨≢⍺]]}¨S←⍳256⊣j←0} PRGA←{(S i j)(S[256|+/S[j i]←S[i,j←256|j+S[i←256|i+1⊣S i j←⍵]]])} Try it online: https://tio.run/#%23SyzI0U2pTMzJT///qG@qp/@jtgkG/72DHYF0dfCjrsWPerc@6phRHRz9qGdvQSxQNDi6AEgChXWygLSRqVlNljZQtndrrPaj3l0gRs2j3hWPOhcBebGxtYdWBIOVbwaqBBoH0mNQyxUQ5A62QSNYIVMhS1MjOBpkkLZ@cHSWQibElkwU8zOh7ExtQ6ApYF0QV8TGxmrW/v9fXFKUmpgLFAI6XQHokVDnYAV1v8SUzFwF7/yk1Mzi4sxHDf3qXBB1XBrFmXnZYKu9gXpArlGAyCgYKBhwAcUVvPGoAYpRVw0A
 
@Adám unless i'm mistaken
setting takes 6 bytes
and u save 2 on eeach use
and their are 4 uses
 
@Maltysen Ah a shared var. Hm.
 
@Adám even better
would be to set it to 255
and on the last 255
use x++
(i'm not sure about the precedence, so tha tmight not work, maybe haveot do ++x on the first 256)
 
apl doesn't have ++ :p
 
@EriktheOutgolfer lol i was talking about the js one
tho i guess Adam is more concerened about his apl one
true
 
5:37 PM
oh hi @SimplyBeautifulArt
 
@Mr.Xcoder heyo
 
any quicker way to do this?
gets;$<.map{|l|p l.to_i.to_s(2).size}
read in useless int, read and print the number of bits line by line
 
5:53 PM
Language?
 
ruby
(by quicker i mean shorter)
that one is 37 bytes
 
I feel like gets can be shortened.
 
I couldn't find a way to
I think that part is bare minimum, just reading/ignoring the first line
 
@Adám just to clarify, this calls KSA∘PRGA⊢input?
 
got it to gets;$<.map{|l|p "%b"%l=~/$/}
 
6:06 PM
Why l.to_i.to_s(2)?
Feel like you should be able to .to_s right away
 
@Adám It's the IDE language bar.
 
the inputs are strings
errr
i can't recall, for some reason it didn't work (I did try it)
 
6:45 PM
that stupid red dot in the review queue always makes me think that someone sent me a comment/chat message
 
I want to try doing the tree(3) golfing challenge via depth first search
Thereby outputting tree three via its definition
At least theoretically
 
My syntax is wrong, how to correct this?
x=gets.to_i
gets.to_i.times{f,t,c=gets.split(" ");if (f.to_i<=x<=t.to_i)p c}
 
@Fatalize Agreed, I think it's a horrible design choice. Because either you're on a site like PPCG where it never shows up, or you're on SO and it's there 24/7, cause their queues are literally never empty
 
Does anyone know how to modify a java method at runtime with reflection
 
Use case?
 
6:51 PM
@eaglgenes101 I need to make a test with an error pass and I'm not allowed to modify the test source code, so it has to be done at runtime.
 
Is it not possible to put an if-statement inline with the {} notation?
 
@DJMcMayhem Yeah it tricked me when I went on SO
 
Alternatively I could just write code that doesn't work to make the test pass, but that seems suboptimal.
@MarcusAndrews Sure it is
 
How do I correct the code above?
I also tried f.to_i<=x<=t.to_i?p c
 
@MarcusAndrews Try it online!
 
6:57 PM
ahhh
although now it isn't liking my chained if
maybe that's just a python thing
 
@MarcusAndrews {f,t,c=gets.split(" ");if f.to_i<=x<=t.to_i;p c;end}
 
hm it isnt' liking that either
 
@Fatalize Oh yeah that red bubble that makes me think I'll lose review privileges unless I actually review...
 
"undefined method `<=' for true"
 
0
A: Sandbox for Proposed Challenges

RamenChefDeep Summing code-golf array-manipulation Given an n-dimensional array (or your language's equivalent) filled with numbers, output which p-dimensional row has the largest sum. Input An n-dimensional array, filled with assorted numbers. n, the number of dimensions in the array. (doesn't nee...

 
6:59 PM
@MarcusAndrews Order of operations, try t?1:0 instead of t.to_i. If that doesn't work, (t?1:0)
 
is it theoretically possible to calculare tree(3) directly via depth first search?
Right now I'm trying to adapt loader's number to the tree(3) challenge, though calculating tree(3) via depth first search might be easier
 
7:46 PM
@J.Sallé No, it doesn't call anything, it is just two lines which define the two functions, just like the original tweet did.
@Pavel Yeah, I know, those texts are really bad. Total overhaul in progress in time for version 17.0. The new texts will be used across IDE, RIDE, and TryAPL, and I also plan on publishing them as a quick-guide.
 
@AdmBorkBork Do scripts that can take advantage of the PowerShell pipeline have to be written in PowerShell, or could I possibly use another .NET language such as C#? Without using [namespace]::function(), that is.
 

« first day (2476 days earlier)      last day (2370 days later) »