« first day (2478 days earlier)      last day (2660 days later) » 

00:01
$><<gets.upcase.chars. already takes up most of it
so there's probably some shortcut
print(sum(ord(k)&95-64for k in s))
Or even print(sum(ord(k)&31for k in s))
seems to work
Anyway, way shorter in Octave :-) sum(upper(s)-64)
why not just sum after the gets
er, upcase
p gets.upcase.sum-64*(some shortcut for length)
@MarcusAndrews Because I forgot that sum works on strings
00:06
p gets.upcase.sum-64*~/$/
there's 25 LOL
i wonder if luis' trick can condense even more
@MarcusAndrews This will include an extra newline in the count, you'll want gets.chop.upcase.sum
according to the post it doesn't count newlines
and seems to return the right value in my ideone test
might have to do with using it after gets?
@MarcusAndrews ~/$/ doesn't count newlines, .sum does.
00:22
what about taking a string and printing it in first-last order repeatedly?
e.g. "12345" -> "15243"
I have it down to this:
p=input()
s=""
while p:s+=p[0];p=p[1:][::-1]
print(s)
can anyone do better?
@MarcusAndrews Debian.
00:37
-6
Q: Fill a hard drive

Peter KlipfelGiven a Windows, OSX or Linux machine, write a program that fills the hard drive of the machine. Edit: Your machine has a 4TB hard drive, 16 GB ram, and an off-the-shelf processor (pick one if it suits your needs) Winning Criteria: This is code-golf, so the shortest code in bytes wins!

Fill an HDD... {while(1){it.write(0,1);}} groovy.
@MarcusAndrews p=gets;$><<p[0]+p[-1]and p.slice!1..-2until p.empty?
Nevermind doesn't work
in Ruby I have it down to

s=gets.chars
$><<s.shift+s.pop.to_s while s.size
using your print trick
I also tried this but too long (Python):
@MarcusAndrews Runs infinitely. 0 is considered a true value for the purposes of while.
Try until s.empty? instead.
or s.size>0 perhaps
er is that shorter
same
00:44
Yep.
What's the .to_s call for, anyway?
has anyone here gotten Opus Magnum yet?
Hello!
@WheatWizard What's that
@Pavel It's the newest zachtronics game
00:52
I have a binary file foo in Mac OS X, which is dynamically linked to some dylibs. How do I statically link to those dylibs instead?
@Qwerp-Derp You'd have to modify the lib to act as a static library and recompile the binary.
How do I do that?
I'm pretty much a complete beginner in the C/C++ environment (even though what I'm doing right now is in Crystal)
@Qwerp-Derp You get the source code for both, and then modify the library's header file declare symbols for linking by the compiler instead of linking them from a shared library at runtime. Why are you even doing this?
@Pavel I want the binary to be stand-alone
@Pavel Also I don't have the source code for the .dylib files, I only have the .dylib file itself
@Qwerp-Derp Well then you're basically screwed. You can't statically link a library made to be dynamically linked without modifying the library's source be statically linkable.
00:59
Ah :(
So there's no way of changing a .dylib to a .a without the source code?
@Qwerp-Derp No.
@seshoumara hi!
the fill a hard drive was put on hold a few seconds before submitting my 5 bytes answer :(((
probably because it's unclear :P
01:06
it is, but I've seen worse
Does libiconv.dylib come with OSX?
@seshoumara Unclear is unclear regardless so blah.
Community opinion > 1 person's opinion
 
2 hours later…
03:05
Does Jelly have file i/o? (for example can it solve this?)
@user202729 I don't think it has a natural file i/o
(you can embed python codes in jelly so everything that python has, jelly also has)
 
1 hour later…
04:12
0
Q: How long should my microwave run?

Andrew BrēzaI'm hungry. Let's microwave something. Given a numerical input of between 1 and 4 digits, output the number of seconds that the microwave should run. Details The trick is figuring out if the user is inputting seconds or a combination of seconds and minutes. The ones and the tens places should b...

 
1 hour later…
05:23
Two years later, my lang outgolfs Dennis
Oh well never mind apparently I need to read the second page of answers >.<
06:05
Cans someone try to validate the certs at: googleapis.com/oauth2/v3/certs
Their values seem to be bogus
 
2 hours later…
08:14
morning
@Dennis the Hello, World! sed example on TIO can be golfed down by 5 bytes to cHello, World! :D
 
1 hour later…
09:24
Well most of the "Hello, World!"s aren't the shortest
09:36
is there a short way to add spaces between consecutive letters in a string?
i.e. only between a-z type letters?
I tried print gets.gsub /([A-Za-z])([A-Za-z])/,'\1 \2' but it seems to be nonoverlapping
sed -r ':;s:([a-z])([a-z]):\1 \2:;t'
but I wouldn't call that a short way
09:52
@MarcusAndrews Example?
I ended up just looping over it twice
e.g. "word! numb3r" -> "w o r d! n u m b3r"
Oh so symbols/numbers should be left in-place, and adjacent letters separated.
my sed example is looping as many iterations as it takes to separate all adjacent letters, but per iteration it does only one pair
@MarcusAndrews How about "Rbe" -> "R b e" or "Rb e"?
nvm
R b e
case-insensitive
09:59
aaa, you initially said only between a-z letters
I wasn't sufficiently clear, sorry -- my original regex has A-Za-z though
then likewise sed -r ':;s:([a-Z])([a-Z]):\1 \2:;t'
so have you tried a-Z instead in your regex?
I ended up doing
a=gets
(0..1).each{a=a.gsub /([a-z])([a-z])/i,'\1 \2'}
puts a
/i for case insensitive afaik
what language is that?
10:05
and a-Z isn't working?
prob. would, didn't know you could do it like that
too used to seeing "A-Za-z" i suppose
could be a sed thing maybe
 
2 hours later…
11:46
Say, does anyone think it would be possible to have a better version of the Largest Printable Number challenge, seeing as many of us do not like the rules?
12:02
I'm interested in a 256 byte limit, where you may use digits and constants, but you can't use constants larger than 10. The output (to stdout) must be theoretically finite and deterministic and the program must theoretically terminate for any sufficient amount of resources for your program to run (resources include very large bigint or int, time, memory, etc.) Finally, the only operations allowed will be +, -, ×, ÷, so you can't call the Ackermann function unless you define it within your program.
Anonymous
> many
Anonymous
Okay, maybe not many, but certainly a few people.
Anonymous
I think that the challenge is a fine challenge. It has a few shortcomings, but not enough to warrant a rewrite. Also, what you're proposing would probably be a different enough challenge that it wouldn't be a dupe. Also also, you might want to include modulo (%) in the allowed operations. Also also also, what about nullary functions that return larger-than-10 constants (e.g. lambda: 1000 in Python)? If there was one built-in to the language, would it be allowed?
Anonymous
What about functions that return a large number regardless of their argument(s)?
12:14
Citation found:
5
Q: Is there a decent "largest number" question on the site?

k_gThe question largest number printable is broken in many ways: it has a huge number of source restrictions and a strange scoring function. Many of the other largest number challenges are like this in one way or another. I was wondering if we should create a canonical question that fits the moder...

Anonymous
@SimplyBeautifulArt There are only a few upvotes on each of the answers that says it's not good. The challenge itself has 107 upvotes. That's still not "many" by any stretch of the imagination.
@Mego Any constant defined within the program may be used, if that's what you meant on the nullary functions.
If it were built-in, then no.
Anonymous
@SimplyBeautifulArt But they're not constants, though. There's a lot of rules-lawyering that can go on to find loopholes. The spec would have to be very specific.
@Mego I think that should be fine.
@Mego Perhaps. But the restrictions on the current one does not give room to much mathematical creativity for me.
Anonymous
What about a nondeterministic function that takes two arguments n and m and returns 9 99.99999999999999% of the time, but the rest of the time returns A(n, m)?
12:19
@Mego R.I.P., because I'm certainly not good enough as far as programming to make very specific specs.
9
Q: Is it okay if a submission has an extremely small chance of not functioning properly?

R. KapFor instance, consider the following un-golfed submission in c to some code-golf challenge requiring the use of a while looping construct: void function() { int a, b; while(a != b) { // Do something } } Although the while loop would be invoked most of the time, there is...

I'll say no.
If no-one catches it then whatevers tho
Anonymous
The point of this is that there's a lot of room for loopholes in any attempted spec for that kind of challenge. The fact that the original challenge turned out decent despite all the rules-lawyering is impressive.
lol
Well, what other sorts of loopholes are you thinking of?
Since I clearly can't come up with them on my own.
Oddly, I don't see any rules that require the output to be deterministic on the current challenge we have.
Anonymous
The few that I pointed out are the obvious ones to me. To find more, I'd have to expend mental energy, which is in short supply because my coffee is still brewing.
Lol, okay, thanks anyways.
 
2 hours later…
13:57
CMP: Should the inverse of the alphabet string be it reversed, or it uppercased?
Anonymous
@cairdcoinheringaahing Reversed
I notice that when you: (in that particular case, also applies to other similar situations)
* hover over cairdcoinheringaahing's message
* click at the [V] button on the left
* choose [Reply to this message]
Mego's message below will be permanently highlighted, until you let the mouse pointer in and out cairdcoinheringaahing's message again or refresh the page (at least on Chrome)
14:17
And what is the inverse of a newline?
Anonymous
@cairdcoinheringaahing Carriage return
@user202729 Reproduced on Firefox
Same on safari
And one last question: inverse of a space?
Newline?
What is this for? Drst?
14:22
@Mr.Xcoder Levant
Is anything missing on this page except for the z and y atoms which I'll add later today?
Although it is named so, why is Ȧ "any and all" and not just "all"? The "any" part is misleading.
^ I may be mistaken.
because [] gives you false there
whereas "all" would give true for []
@user202729 Because Dennis borrowed it from Octave
So they are only different when the flattened array is not empty?
14:28
@user202729 presumably so
Ok so that makes sense. Add an explanation why it is named so would be useful.
Like, "this is a monad that returns 1 if there is any element in the flattened array and all the elements are truthy, 0 otherwise."
Yes, I am planning to change that
But later
CMC: Given a list of positive integers L, check whether the count of primes that appear in the prime factorization of at least one element in L exceeds the length of L.
Can't add test cases rn
@SimplyBeautifulArt Are you intentionally pop yourself up the top of the online user stack?
@user202729 no
I have the tendency to forget to leave rooms when changing computers
And the sounds of pings makes my brother go crazy
So you can turn it (the sound) off.
14:37
But I want the sound
@Mr.Xcoder Jelly, 7 bytes: Try it online!
Very often I turn off computer sound, so the first time I hear the ping sound, I was surprised. I turn it off since then.
@Mr.Xcoder Sorry I misread the specification.
beats head against computer
anyone want to write python for me :P
@user202729 The annoyingness helps me respond to chat when I'm watching anime/YouTube lol
14:42
@ThomasWard Maybe I can help, depending on the problem
I can be notified when I look at the title-bar that says (<nonzero finite ordinal>*) The Nineteenth Byte | chat.stackexchange.com, because I don't often make video fullscreen.
@Mr.Xcoder Jely, 7 bytes: Try it online!
@Mr.Xcoder i need to strip apart an email message, and retain only a handful of headers but all of the payloads including attachments, and then rebuild the message so that it's DMARC compliant. I'm struggling on the "retain all of the payloads" part :/
Oh then I definitely cannot help
welcome to my life >.>
i'mma have to run this through a test message
with attachments
then write to another message and see if it creates a proper email message
THEN run that through a mail server to test
blurgh i have a headache
@ThomasWard Example? Is it internet-related or something? Or just string-processing task?
14:46
coffee would help but there's none until 11Am
0
Q: Minimum rectangle cover

ZgarbRectangle covers Suppose you have a matrix of bits, for example the following. 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 We would like to find a rectangle cover for this matrix. It is a set of rectangular subsets of the matrix that don't contain any 0s, b...

@user202729 sorta both, but it's email message processing, which is very tricky.
And fragile as all hell.
15:40
1
Q: Is outputting a Maybe acceptable in Haskell?

totallyhumanHaskell has a very strong type system, so there is a type called Maybe to work around some restrictions. Essentially, instead of erroring out, a function can return a Maybe that is either a Just x where x is the intended output or it can return Nothing, which indicates that there is no possible ...

Should the inverse of be √a or 2ᵃ form a golfing language perspective?
2^a can be expressed as 1<<a, so if you had shiftleft, then no.
@user202729 I have bitshifts, so √a?
 
1 hour later…
17:08
Does anybody else experience massive memory problems with the latest Chrome? Like, here's a screenshot of my current chrome task manager. The browser eats over 2G of RAM, while all tabs and extension never even reach 60M...
Given a string, replace any lowercase letter with a-that letter, any uppercase letter with A-that letter, and any digit with 0-that number
"Db2" -> "ABCDab012"
@MarcusAndrews Pyth, 26 bytes: ssmCM}@JCM"a0A"smg-dk0JdCM
17:24
my current python:
s=""
for c in input():
 s+=''.join(map(chr,range(65+32*c.islower(),ord(c)+1)))if c.isalpha()else"0123456789"[:int(c)+1]
print(s)
129
print(''.join(''.join(map(chr,range(65+32*c.islower(),ord(c)+1)))if c.isalpha()else"0123456789"[:int(c)+1]for c in input()))
125
@MarcusAndrews SOGL, 22 bytes: ,{6*6/:GWH'⁸÷'⁸*IWFΝ∑p
Another challenge: You're given a point A,B, and then n lines follow. Each line has x,y,r, the parameters for a circle. Output how many of these circles contain point A,B.
My current Ruby (117):

a,b=gets.split.map(&:to_i)
s=0
gets.to_i.times{x,y,r=gets.split.map(&:to_i);s+=(((a-x)**2+(b-y)**2)**0.5<=r)?1:0}
p s
sample input:

0 0
2
0 0 1
0 0 2
17:56
CMP: What production language should I learn after Python?
0
A: Sandbox for Proposed Challenges

HeimdallOutput the first digit of Graham's number Code golf Write a program that will output the first digit of Graham's number (and nothing else), terminate and produce no error. I'll be lenient about loopholes. But if your submission is something like print("4"), the burden of proof will be on you.*...

Python is a production language
18:20
How do I fix this ruby syntax?
n,r=gets.split.map(&:to_i)
puts n.times{|i|i*r}.to_c.join(" ")
trying to print a space-delimited arithmetic sequence, n terms, common difference r, starting at 0
@cairdcoinheringaahing Maybe JS, C or Swift
Ooops, it might actually be invalid... Yes it is
@cairdcoinheringaahing Python 2, 15 bytes print input()*2
or ƓḤ if you want STDIN
18:48
TIL GitHub archived repos
 
1 hour later…
19:50
@cairdcoinheringaahing Your profile doesn't say which ones you know.
@user202729 Sensible behaviour to avoid ninjas.
20:09
@Adám Python
And am learning APL, before you suggest that :P
> using only ASCII characters.
My python one stands
@cairdcoinheringaahing Then it depends on a lot. If you want breadth, I'd suggest Haskell or Perl. If you want low level, then C-something, or even a type of assembler. If you want a job, maybe Java ;-) If you want to golf, Jelly, obviously.
@Adám See, I know that APL can open job offers, and is good for golfing, and could be considered low-level (?), so either Haskell, Perl or APL :P
@cairdcoinheringaahing APL is hardly low-level, though. You have no direct access to memory or even data types (though you can tell APL that you want a specific type). Well, I guess you've chosen already anyway…
@Adám Well, I'm still deciding between continuing APL, or learning Haskell or C :P
20:17
@cairdcoinheringaahing I'm biased.
@cairdcoinheringaahing Still, I think the ratio of available programmers to needed programmers favours APL these days.
n*(d*(n-1)+2*m)/2
can this be shortened?
@MarcusAndrews n*(d*(n-1)/2+m)
hm n*(d*n-d)/2+m*n perhaps
or is there a short perl method for accepting 3 int inputs on the same line?
Trying to make a short codegolf for the sum of an arithmetic sequence
20:32
@MarcusAndrews n*(d*~-n/2+m)
@dzaima What is~?
@Adám Bitflip (~n == -n-1)
@cairdcoinheringaahing Oh, I forgot to check the chat log which language MA was using. Thought he meant math.
 
1 hour later…
21:43
Anyone know how to see how close I am to the silver badge? The profile page is really unhelpful
@cairdcoinheringaahing look on the top tags, at the score. you currently have 149 for codegolf, which means 251 til silver
22:14
Q: Should I add checking for en passent to my "Is it a valid chess move?" question?
23:08
0
A: Sandbox for Proposed Challenges

NoOneIsHereValidate a StarCraft II Build Order code-golf decision-problem game Explanation You must decide whether the input represents a valid StarCraft II Build Order. Here is how you will decide: Start with the first word (it will be the race, Zerg, Protoss, or Terran) Set the list of valid units to...

0
A: Sandbox for Proposed Challenges

caird coinheringaahingChessMoveQ Given a list of up to 32 elements, each consisting of 4 elements, and a second list with 4 elements, determine whether the move detailed in the second input is a valid chess move. The first list indicates the position of all 32 pieces on the board. Each element will follow the struct...

Impressive
I believe one of those views is my own... So someone votes three times maybe? :P
23:25
3
Q: The lowest initial numbers in a Fibonacci-like sequence

Stewie GriffinGiven a positive integer input N, output the two non-negative numbers, a and b with the lowest possible mean value that will result in the number N being part of the recurring relation sequence: f(0) = a f(1) = b f(n) = f(n-2)+f(n-1) In case there are more than one solution then you should out...

23:58
Is it wrong to say x^2 grows exponentially or is that only for things like 2^x?

« first day (2478 days earlier)      last day (2660 days later) »