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

8:04 PM
pax badges are available now
pax east, anyway
 
@Poke Wat. Pax is late summer.
Oh
 
BOSTON, MA
APR 5 - 8, 2018
 
@Poke I live really nearby where Pax Prime and Pax Dev happen
Also, wow, that is a long time in advance
 
@Pavel that's how they do
 
@Pavel I would imagine they would need to be native to PowerShell, since the pipeline is an environment feature and not a language feature.
 
8:13 PM
@AdmBorkBork Apparantly you can by writing a class that extends System.Management.Automation.Cmdlet
 
Is this not how to define functions?
x=gets.to_i
n=gets.to_i
f=->n{n>1?n*f[n-1]:1}
p f(x)/f(x-n)
Trying to codegolf some factorial stuff
nvm had to use [] not ()
 
@MarcusAndrews That makes f a proc. Procs are called with either [] or .call.
 
x=gets.to_i
f=->k{k>1?k*f[k-1]:1}
p f[x]/f[x-gets.to_i]
(reads two integers and computed x!/(x-n)!)
 
# How to define a function:
def f n
n>1?n*f(n-1):1
end
 
mm
Is this as short as I can get it?
(I suspect it is, or is at least pretty close)
 
8:27 PM
Is there a prefix meaning "greater than 2"? Like "mon" for one and "dy"/"di" for two?
 
@cairdcoinheringaahing poly-?
 
@Pavel Sure, that would make sense.
 
@Adám Hmm, that works. Thanks!
 
I smell Grammar hw :P
 
@Mr.Xcoder Nope
 
8:31 PM
That was a joke anyway :D
 
Yeah, I'm trying to find a term for commands with an arity > 2. Nilads, monads, dyads, and polyds
 
> polyds
 
Pronounced "pol - ids"
 
lol I thought about multyads for a second
 
I'd go for polyads myself
 
8:34 PM
For some reason, I place emphasis on the "ads" part: "poly-ADS" rather than "POLY-ads"
 
What are the Atoms in Jelly that you (anyone that is willing to answer) have found hard to understand at first?
 
@Mr.Xcoder Uneval, z and y (I still don't fully understand the last two)
 
Well ¯\_(ツ)_/¯ what is Uneval?
 
@Mr.Xcoder Cast to string
 
yeah just looked too
 
8:36 PM
What about 2 though? Poly can apply to 2 or more sometimes
 
Caird is looking for 2 or more (I think)
 
@Mr.Xcoder I would also mention the string ub
 
Mm I thought he had said > 2 but if so, that works too
 
> greater than 2
 
@cairdcoinheringaahing I think I've seen the adjective polyadic.
 
@Mr.Xcoder And the difference between F and
 
e.g. monomial, binomial, multinomial theorem, etc
 
ಠ_ಠ I feel like I'm listing too many :P
 
@cairdcoinheringaahing Thanks, I am making a list of "harder (to understand)" atoms rn
 
CMP: (for Jelly users) Have you ever used the t atom?
 
8:42 PM
@cairdcoinheringaahing I haven't.
Also mold is hard to get
 
:O I used realised what is for!
 
@cairdcoinheringaahing i'd be glad to hear that
 
@Mr.Xcoder Do you know what is? Just curious to see how behind I am :P
 
Any shorter way to do this in Python or Ruby?
n=input()
a=b=""
for i in range(n):l=raw_input();a+=l[i];b+=l[n-i-1]
print a,b
 
@cairdcoinheringaahing I don't.
 
8:49 PM
It's reading through a grid supplied in input and taking letters along the diagonal
 
@MarcusAndrews n-i-1 is the same as n+~i
 
@Mr.Xcoder CMC: Given n < 16, convert n to hex, using the digits 0-9A-F
 
AxxE
xBFx
xGCx    = ABCD EFGH
HxxD
ah thanks, -1 char there
 
@cairdcoinheringaahing Brb
Why < 16??!?!
 
Because it doesn't work as I thought it did for > 16 ಠ_ಠ
 
8:51 PM
@cairdcoinheringaahing 3 bytes I guess: ṃØH
 
@Mr.Xcoder Yep :P
> Base decompression; convert x to base length(y) then index into y.
 
trying ruby but again wrong syntax
n=gets.to_i
a=b=""
for i in 0..n do
    l=gets.to_s
    a+=l[i]
    b+=l[n+~i]
end
p a b
 
@MarcusAndrews p a b
Did you mean p a,b?
 
maybe
the other stuff is failing atm
 
@MarcusAndrews (0..n).each do |i| is prefered to for i in 0..n in ruby
@MarcusAndrews What error are you getting?
 
8:55 PM
implicit null conversion on the string bit
 
You mean the a=b=""?
Could you just paste the error?
 
the (0..n).each thing is longer though
"no implicit conversion of nil into String (TypeError)"
on the line l=gets.to_s
 
@MarcusAndrews No it isn't, because you can use { instead of do when calling each.
 
Ah the minus 1
n=gets.to_i
a=b=""
for i in 0..n-1 do
    l=gets.to_s
    a+=l[i]
    b+=l[n+~i]
end
print a+" "+b
n=gets.to_i
a=b=""
(0..n).each do |i|{l=gets.to_s;a+=l[i];b+=l[n+~i]}
print a+" "+b
 
@MarcusAndrews 0...n is shorter than 0..n-1
 
8:58 PM
ahh, interesting syntax
 
@MarcusAndrews That's just completely wrong block syntax.
(0..n).each{|i|l=gets.to_s;a+=l[i];b+=l[n+~i]}
Or (0...n).
 
gotcha
is the print the shortest possible?
space separated so I just did a+" "+b
 
$><< is shorter than print
 
also more interesting syntax
 
It's two symbols, $> <<
Or STDOUT APPEND
 
9:02 PM
send the righthand contents as input to $> which must be stdout?
 
yep.
Why print, anyway? The normal way of printing in Ruby is puts.
@MarcusAndrews $< is STDIN, $<.read is the shortest way of getting all the input. $<.each_line iterates over lines.
 
so $<.map{...} applies a mapping to every line from stdin?
$<.map{|l| p l} (or do whatever else with the line)
 
@Mr.Xcoder Cartesian product and power
 
9:17 PM
@cairdcoinheringaahing APL: ⎕⊃⎕D,⎕A (assumes ⎕IO←0)
 
Anonymous
@cairdcoinheringaahing Actually, 2 bytes: ─û (hex, uppercase)
 
@cairdcoinheringaahing Do you want write access to the repository?
 
@Mr.Xcoder Sure, why not?
 
(or did I make the wiki publically editable?)
@cairdcoinheringaahing I'll give you write access, but could you please tell me if the wiki can now be edited without write access?
 
@Mr.Xcoder Sure, testing
@Mr.Xcoder No, it can't be edited
 
9:22 PM
Good, thanks
@cairdcoinheringaahing Done
 
@Mr.Xcoder Thanks
 
9:34 PM
0
A: Sandbox for Proposed Challenges

Herman LauensteinNumbers where n! - 1 or n! + 1 is a prime Combination of OEIS A002981 and OEIS A002982 Sandbox note: This is my first code-golf challenge; feedback is highly appreciated. Output the nth non-negative integer m where m! - 1 or m! + 1 is a prime. The first few numbers of the sequence are 0, 1, ...

 
how about something like this
P={}
i=input
for _ in' '*int(i()):
 for j in range(*map(int,i().split())):P[j]=1
print(len(P))
input looks like
3
2 5
8 13
14 20
each row is a range of time
at the end, output number of hours with at least one person present
e.g. 2 5 means someone is present at hours 2, 3, 4, 5 (total of 4 here)
so output for that one above is 14
 
@cairdcoinheringaahing PowerShell, ridiculously long -- ("{0:x}"-f$args[0]).ToUpper()
However, it works for n > 16, so there's that at least
 
trying the ruby approach Pavel taught earlier
P={}
gets.to_i.times{a,b=gets.split.map(&:to_i);(a...b).each{|i|P[i]=1}}
p P.size
 
It's using the -f format operator
 
@MarcusAndrews i=input saved you no byte (nput goes for the first, i=i\n for the second)
 
9:45 PM
Used for things like displaying as a percentage, or as a dollar-and-cents amount, or to a certain precision, etc. Here, we're converting to hex with the x specifier.
 
I usually do it out of habit if there's more than one input simply because it doesn't hurt / it's mindless to do
but i take the point, yeah
can the ruby be shortened?
 
10:08 PM
What was that n+1 trick again?
-~n or something?
yep
 
Uh, where is a assigned and what is that program supposed to do?
 
right now, tallest pyramid given a certain number of blocks, as well as number of blocks left over
n=input()
t=int(((8*n+1)**.5-1)/2)
print t,n-t*-~t/2
solves the equation t(t+1)/2 <= n
 
Looks like t<=n*2-1
 
ruby
n=gets.to_i
t=(((8*n+1)**0.5-1)/2).to_i
print t,' ',n-t*-~t/2
(puts places the two items on separate lines, print same line)
oh wait, that print trick
 
Why are you using print again
Don't use print in ruby
 
10:13 PM
weird didn't work this time anyway
unexpected ',',
 
In production code you should use puts most of the time.
 
this is for codegolfing
but yes i agree
 
puts is still shorter than print, and doesn't have $><<'s order of operations priority so it's sometimes better.
 
but placing two numbers on the same line, separated by space?
 
Ah, I see, the arguments to print shouldn't be seperated.
I understand now
 
10:15 PM
funnily enough the python is shorter
n=input()
t=int(((8*n+1)**.5-1)/2)
print t,n-t*-~t/2
 
$><<[t,n-t*-~t/2]*" "
No that's a bit longer I think
 
the python is 53
the other is 61
 
What exactly is the problem, I'm still not following what all the numbers are for.
 
"tallest pyramid given a certain number of blocks, as well as number of blocks left over"
pyramid requires 1+2+3+4+... blocks
so if you have n blocks you need to solve for t(t+1)/2 <= n
to get the height of the pyramid
and then n-t(t+1)/2 tells you the blocks left over
for example if I have 12 blocks, I can a pyramid with 1+2+3+4 = 10 blocks (If I added layer 5 I'd need 15 blocks, which I don't have). So I can make a pyramid of height 4, with 12 - 10 = 2 blocks left over
 
Hmmm
 
10:22 PM
and the solution to the block inequality is t = (1/2) * (sqrt(8n + 1) - 1)
 
10:42 PM
0
Q: Tips for golfing in QBasic

DLoscWhat?! This question doesn't exist yet? What general tips do you have for golfing in QBasic? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to QBasic (e.g. "remove comments" is not an answer).

 
11:37 PM
wait what ever happened to the ppcg home page? you cant get to chat from it easily anymore
I have a feeling this happened a while ago I just haven't been on here for a while
 
@BaldBantha SE icon in top left corner>chat.
 
yeah the drop down thing disapeared
 
@BaldBantha No, SE just rolled out a new navbar not long ago.
@BaldBantha It's weird. On SE.se it is still the old style. And on SO, the top left icon goes to SO, not SE like all other SE sites.
 
11:57 PM
Grr! Why doesn’t befunge 98 have a decent interpreter? The s command should put the v in that empty space, sending the IP down! tio.run/##S0pNK81LT9W1tNAtqAQz//@vK1Yw1HPgUlCwM9Jz@P@/DAA
Never mind, apparently it just doesn’t execute it
 

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