« first day (2639 days earlier)      last day (2204 days later) » 

12:50 AM
hi
 
0																												'
hello
 
 
1 hour later…
1
Q: Simple Factorial Challenge

NL628In light of today's date... A factorial of a number n, is the product of all the numbers from 1 to n inclusive. The Challenge Given an integer n where 42 <= n <= 420, find the sum of the digits of n!. It's that simple :P Notes: I feel like this challenge isn't too simple, as some languages ha...

 
DENNIS WHAT DID YOU DO — NL628 16 mins ago
 
2:16 AM
0
A: Sandbox for Proposed Challenges

ScroobleOperate on a subset of a register code-golf matrix quantum-computing Note: You do NOT need to know anything about quantum mechanics or quantum computing to understand this challenge. I've tried to include sufficient background for any old code golfer to realize what's going on. Motivation (muc...

 
@ConorO'Brien Just is, no a.
 
@Pavel is reminds me more of equivalence than membership
other is Point doesn't convey the same meaning as is_a or isa
 
Java: other instanceof Point :P
I think isa and is_a just look akward
 
2:37 AM
Just have each class keep an array of all instances: other in Point.allPoints :P
 
Anonymous
Or have it be a multi-word keyword: is a
 
I like ^
 
@ConorO'Brien is_a is better than isa, but is a is way better than either
 
2:53 AM
mt isa mountain
 
@Mego hmmmm... would then is a be allowed?
 
Anonymous
@ConorO'Brien Yes. Anything matching \s+(is)\s+(a)\s+ should be allowed
 
I'm not sure how I feel about that.
esp. since I might want is to be an operator
 
@Mego Why the unnecessary parens?
 
if we're golfing it could be \bis\s+a\b
 
Anonymous
2:58 AM
@ConorO'Brien That would be an issue, then
 
Anonymous
@DJMcMayhem Matching groups
 
Anonymous
Also brain tired :P
 
@ConorO'Brien matching groups are slower. very slightly.
@ConorO'Brien easy... make it two tokens and try matching is a first
and throw ambiguity error if you're trying to do (foo is a)
 
that defeats the entire purpose of doing something clever :P
 
@Pavel C#: other is Point
@ConorO'Brien clever?
 
3:04 AM
clever being something that works for both cases
 
define "works for both cases"
like how does this not work for both cases
 
 
2 hours later…
4:44 AM
@Mego do reccomend, this is what cheddar does
 
 
2 hours later…
6:15 AM
0
Q: divide to make tcs more efficient

abhishek kumartcs has employees numbered from 1 to n . It wants to divide them into two non-empty teams. The team sizes may be unequal, but each employee must belong to exactly one team. For some small groups of employees, it's known that they would work more efficiently if all members of the group are on the...

 
 
3 hours later…
8:58 AM
0
A: Sandbox for Proposed Challenges

BubblerTriangular Lattice Points close to the Origin code-golf geometry Background A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles. The picture below is an example of a triangular grid. A triangular lattice point is a vertex of a triangle forming the tria...

 
 
2 hours later…
11:16 AM
0
Q: How to TIO for separated part of code

l4m2Usually I can see import lib f=func where the f= is using and left part is code. Do I always need to recount the bytes by myself and just leave a tio that don't point exactly to which place us counted bytes?

 
 
2 hours later…
12:49 PM
@Downgoat :O github.com/pnpm/pnpm
 
1:42 PM
CMC: Output 807925151782775182517871917216748799011102566742887100803258635688116378471697272329930035288072836592217949023047450487352988978762273027377203809661207078015771934182524902293754943759741302669901440959601689206919805466065493904045952358461904261764541146300907626072189397288526645215188809978098259638047858334741708560517124369664114237371404400883158051451945141483275654817711507853756464821604427918148590092961546433939958778807541147610092440330832180780678142117770505243128927543173283086741963564516417448376149931708824965955388129159735933388590053385830740116132961965
8 bytes in Jelly
 
english, 2 bytes: no
:p
 
@cairdcoinheringaahing SOGL, 4 bytes
 
1:57 PM
Try it online! bc, 6 bytes? 7 bytes?
 
@dzaima how does this work
 
@ASCII-only ⁶‛“ push 2046; ū 2^pop
 
@dzaima wow. imaginary chat star
 
 
1 hour later…
3:02 PM
0
Q: Rearrange number by binary 1's count and (increasing decimal value in case of same number of 1s)

ManubhargavI have read Sort numbers by binary 1's count (not a duplicate) Goal Sort the integers in ascending order by the number of 1's in their binary representations. For example, 7(dec) → 111(bin) and 8(dec) → 1000(bin), so 8 (which has single 1 in binary) would be ordered before 7 (which has triple ...

 
@cairdcoinheringaahing I'm curious: how do you need 8 bytes for this?
 
Is our how to tag customized?
 
@Dennis I forgot how bitshifting works: 11Ḷ2*æ«/
 
3:18 PM
2*⁽¥- saves three bytes.
 
@NewMainPosts Is "first to post" a valid winning condition?
(the obvious issue is it discourages competition)
-8
Q: New challenge type: Speed Code

The Guy with The HatThe objective is to create the code as fast as possible. How this could work is the questioner would first post a UTC time and date (in the near future, e.g. 24-48 hours), and possibly a topic. They would then write an edit to the post that would explain what the code should accomplish, and submi...

 
@user202729 I really like that idea of doing it in chat
It should probably be in one Language so that knowing a language with the right built-ins isn't too big of an advantage
 
@DJMcMayhem Actually, so that you won't get answers in 100 languages.
@NewMainPosts Changed to popcon. Pure popcon are off-topic?
 
I imagine you'll have at most 4-5 participants
 
19
Q: Guidelines for posting and closing popularity contests

quartataIn light of the controversy sparked by this question, I think we need to create a general "rule of thumb" policy on how objective a popularity-contest needs to be in order to be on-topic. The main issue, as I see it, is that people are not in agreement over whether an objective specification sh...

Can moderators close twice?
 
3:40 PM
What do you mean by close twice?
 
is there a room for python code golfing
 
Another interesting language (that seems to be picking up steam after it's recent update): Zig. A "better C" with nullable types, builtin testing, ability to use C headers etc. Seems to borrow some concepts from Go, like type extension methods.
 
@NoahCristino Just ask here may work... I don't think so.
 
ok
I forgot jelly :(
I stopping golfing for a couple months
 
3:55 PM
@mınxomaτ fascinating! esp. the types and variable assignment, var small: i2 = 0; is quite interesting
 
We can't even keep Code Golfer's Corner alive. Language-specific rooms don't stand a chance.
 
@ConorO'Brien I like flag-union types and especially the extended while loop with a separate update expression (and one keyword to unroll a loop!).
 
this language has so many cool things :o operators are pretty smart
 
@mınxomaτ I really think Rust is going to be the "Better C" of the future
 
I agree, or rather, the better C++. Because Rusts current complexity is breathtaking.
 
4:00 PM
yeah
 
Zig doesn't have a borrower system, I would describe it as a "more relaxed" C, or "sane C" if you will.
 
I've always found rust a bit weird, but I have yet to use it seriously
variables being immutable by default also rubs me the wrong way
 
@ConorO'Brien I love this. I love every language that does this
 
Oddly enough, I like that.
 
I just can't see the reasoning behind it. perhaps enlighten me?
 
4:03 PM
it's a much nicer world when all functions do is take input, and return output
like, you don't modify anything, you simply pass stuff along
 
do I have to do let mut in order to a C-style for loop? or does let only forbid reassignment by =?
 
why do you need a C-style for loop?
 
no idea
 
it's been a long time since I've written one of those
 
Esp. in languages that have LINQ or the pipe operator (|> <|). The flow of data becomes obvious and safe.
 
4:05 PM
just trying to understand how let limits you
 
@Dennis Was that always there?
 
@ConorO'Brien you mean in Javascript?
 
No, just added it.
 
Neat. Thanks
 
4:05 PM
@NathanMerrill no, I mean in rust. (why would I be suddenly talking about JS lol)
 
@ConorO'Brien sorry, I had just moved onto general programming, forgot we were talking about Rust :)
 
oh ok lol
 
so, let prevents reassignment
 
@Dennis Would you mind unfreezing MATL CHATL?
 
but it doesn't say anything about immutability
 
4:08 PM
@Dennis Thank you!
 
np
 
@Dennis Can you please add data-gramm_editor="false" to the code text area. This will disable Grammarly for everyone who has it enabled.
 
so you can do something like let a = something() and then a.setVar(4)
 
@NathanMerrill doesn't it? iirc bindings are immutable by default
 
right, but the object isn't constant
 
4:09 PM
ohh
 
the binding is immutable, the object isn't
 
ok lol that makes a lot more sense
 
Actually, I have a really good example why mutable bindings is a bad idea
 
@mınxomaτ Just Code or all text areas?
 
I was literally reading some code the other day that had a bug because of it
they were parsing some XML, reading it line by line
 
4:10 PM
@Dennis Just code, it doesn't pop up on any other field.
 
each element was either an <item> element, or a <group> with <item>s inside of it
so, they had a variable that stored the current group
and each time they encountered a new group element, they would reassign that variable
however, when they left the group, any <item> elements would be assigned to the old group
far better code would have been to recurse into the group, and simply return a list
 
but that's not really a problem with assignment is it? it seems to be a problem with code organization
 
no, it absolutely was
when you were outside of a group, those elements were supposed to be in the default group
when writing it with reassignment, they had to assign it back to the default group
but they forgot
if you do the recursive way, you don't mutate any variables
you can't forget stuff like that
you could say that that is "code organization", but that's exactly what "let" tries to do: organize your code so you don't have to modify existing variables and forget to modify them the right way
 
@mınxomaτ hm, I'd say that you can't actually prevent every other extension to mess up with stuff, so it's the responsibility of the user to turn the extension off, but then again I don't know if there's another reason to disable it like that
 
it still doesn't seem to be a problem with assignment. you suggest that recursion would have been a better approach; that may it be, the implementation of the approach is the problem (or, rather, the programmer). let seems to encourage a certain style of programming, but it doesn't fix the greater problem, which is simply a programming blunder
I suppose maybe it does fix it, if you consider that the language's syntax prevents problems
 
4:17 PM
blaming the programmer is easy. All programmers are lazy. When languages make the easy/default path the best one, the language is better for it
(I shouldn't say "All") :)
 
eh. I wouldn't say recursion is the easy/default path if this person chose a different path :P
 
ok, lets say that you only had the option of "let"
how would you parse that xml without calling another function?
 
@mınxomaτ Weird. Not counting the IDs, the text areas are identical... Does it work?
 
with recursion of course
 
@Dennis Indeed it does.
 
4:20 PM
but that's calling another function. My point is that it naturally guides programmers to do the right thing. That's really valuable
 
that's fair
 
the instant you allow reassignment, you also have to consider state as you think about your code. It's like saying "If so and so happens, then this will be X, so I need to do Y, but if something else happens, then this will be Z, and so on"
 
@EriktheOutgolfer Normally, I'd agree, but with more than 10 million users with chrome alone, it affects quite a lot of people.
 
@mınxomaτ they've done a good job advertising
 
I'm just not a big fan of the language by default limiting the ways a programmer can code. if I want to use an iterative/scopeful approach, I want to be able to do so :P
 
4:23 PM
yeah. Most languages allow you to do stuff like that, they just make it harder
(by requiring other keywords)
 
@Dennis hm, maybe the reason is that only the Code field is opened by default?
 
its like choosing your defaults: are you an immutable language by default, or a mutable one?
 
that's also fair
 
that said, if you do enforce immutability (or at least, track mutability), then you are able to make performance enhancements around it: You can memoize functions, it's easier to track the lifetime of objects, etc
 
Anonymous
Something that bothers me with a lot of languages: IMO, every iteration of a loop should get its own scope (while still being able to access variables from the enclosing scope)
 
4:30 PM
0
A: Sandbox for Proposed Challenges

l4m2Smallest code to import Given some head files that need to import, return the shortest code to do so. You are allowed to access include/ What more assumption necessary? (#if don't effect imported heads?) Time limit necessary? code-golf parsing

 
@Mego ...I'm confused. How are you accessing variables from past iterations?
 
C# does that to ensure thread safety in concurrent loops, like Parallel.For. The body is an anonymous function that can only mutate concurrent types or locked reference types from the outside scope.
 
Anonymous
@NathanMerrill Because PHP sucks
 
Anonymous
Loop bodies don't get their own scope
 
Anonymous
And it's not just PHP
 
Anonymous
 
@Mego Variables being default to "" is even worse.
 
Anonymous
@user202729 The default is actually one of FALSE, 0, "", or [], depending on the context where the variable is first used
 
Anonymous
Having any default at all is the biggest crime
 
the solution to that isn't scoping each loop, its compiling your language
 
Anonymous
4:42 PM
@NathanMerrill C is compiled, but suffers from the same issue
 
any compiler would yell at you saying that $c isn't defined
how do you access the variable without it being declared?
 
Anonymous
 
....I missed that message
 
Anonymous
You declare it in the loop, and conditionally set its value. But its value carries over through loop iterations.
 
yeah, default values should solve that IMO
 
Anonymous
4:44 PM
And it's not an optimization thing either - the same thing happens with -O0
 
IMO, giving each loop its own scope is expensive
 
Anonymous
Expensive, but elegant
 
I'd prefer to put a single scope around the the entire loop
seriously, though, both Java and C# will yet at you for both of those for trying to use a variable before its assigned
it's a compiler issue, not a runtime issue
 
Anonymous
Performance is the last thing I optimize for. Maintainability and the principle of least surprise are much higher on the list
 
right, but you can solve both of those issues on compilation
both of those is behavior that shouldn't even be compilable
allowing it to be compiled, and then do the wrong thing at runtime is far worse
 
Anonymous
Yes, and the fact that the behavior is compilable and produces an unexpected result is IMO a flaw in both languages
 
@Mego oh I agree. But once you've ensured that variables within the loop must be assigned before use, then you don't have to assign a new scope every loop
 
Anonymous
My solution would be twofold: 1. require variables to be initialized before use (either by a default value, or by having an assignment with the declaration), and 2. have each iteration have its own scope
 
yeah, but 2. gives you no benefit
there's no functional difference between {forloop(statement)} and forloop({statement})
 
Anonymous
Clearly it does - C has #1, but still has the same defect
 
4:49 PM
it doesn't require them to be initialized
 
Anonymous
Because it initializes them with a default value
 
Anonymous
Which is NULL for a pointer, which is shown with the first iteration of the loop in my C example
 
initialization of default value should happen on declaration
which means each time that loop iterated, it should have reassigned it to the default value
 
Anonymous
It should have, but it did not, because C silently ignores variable redeclaration inside of a loop body across iterations
 
and I know you say that performance isn't an issue, but it's a primary concern of every modern compiler
when you're talking about assigning N scopes instead of 1, you absolutely choose 1
 
Anonymous
4:55 PM
Reinitializing every loop-local variable each iteration would not be much different performance-wise than making an entirely new scope - in fact, it's essentially the same thing
 
true, but you may not end up assigning each variable each loop.
I'd be rather interested to see what languages actually do
like, I could see it going either way
because if you simply create a new scope and allocate a large chunk of memory all at once, that might be really efficient.
as opposed to overwriting an existing chunk repeatedly
dunno
 
5:36 PM
i learned how to use gdb and debugged a bug that was present in my minesweeper game yay
 
6:05 PM
0
A: Sandbox for Proposed Challenges

l4m2No title Given a function with boolean inputs a1, ..., an and a boolean output, output an array of numbers 0 to n satisfying: For each item in the truth value, if (we repeatedly remove two adjacent numbers x and y satisfying that, for each integer n between x+0.5 and y+0.5, an=1), we can get an...

 
Has the esolangs chatroom frozen?
nvm it is
 
6:27 PM
Need me to thaw something?
 
@Dennis Thanks
 
6:39 PM
0
Q: All Light All Light All Light!

musicman523This challenge is completely ripped offheavily inspired by All Light, developed by Soulgit Games. Challenge You are an electrician, and it's your job to wire up all the lights to the battery. The lights and battery are laid out in a grid. You can connect a light or battery to the nearest ligh...

 
7:14 PM
1 message moved to Jelly
 
what a practical reply...
 
7:33 PM
0
A: Sandbox for Proposed Challenges

Asone TuhidPrime Factor Encoding You goal is to encode a string of bits as a single integer using primes. How? Hold a prime (starting with 2) Have a list For each bit in the input If it's the same as the previous bit, add the prime you're holding to the list If it's different, hold the next prime and ...

 
Anonymous
7:57 PM
I just got new glasses and getting adjusted to them is giving me a headache :/
 
enchroma?
 
Anonymous
I wish :P Just a normal prescription
 
Anonymous
Enchroma glasses are super expensive, super thick, and aren't prescription
 
ah :/ looks like your eyes have more issues than deuteranopia then, I'd say you seem to be very courageous when coping with that
 
Anonymous
Deuteranopia, myopia, and astigmatism
 
Anonymous
8:04 PM
Basically my eyes fail at everything slightly
 
Holy crap
 
well, while I don't have any eyesight issues, I would disagree that those are slight, how you even manage to overcome those issues is something to admire greatly
 
Anonymous
My myopia isn't that bad though - my prescription is only ~3.5. My wife's eyesight is much worse - she has ~5.5 prescription
 
Anonymous
@EriktheOutgolfer Glasses solve myopia, paying extra for glasses solves the astigmatism, and not dealing with anything important where I'd need to discern colors solves the colorblindness
 
I'm really lucky to not have any vision problems at all.
Or physical ailments in general for that matter (unless you count asthma, but mine is very very minor)
 
Anonymous
8:08 PM
I've considered laser eye surgery, but it's super expensive
 
Anonymous
My only ailments are my minor eye problems, seasonal allergies, and a weakened ankle due to 3 years of marching band in high school
 
how often do you march
at least in our high school, we will only ever have to march 4 times, unless we don't pass a class
 
Anonymous
Not anymore, but daily practices, weekly football games, and monthly competitions during the first semester of each of those 3 times
 
and for some reason there are long-lasting effects?
 
@Mego What exactly do those numbers mean?
 
Anonymous
8:12 PM
We marched using glide step, which is a bit rough on ankles. To make it worse, we also used what we called "stab stops", where we'd step with the ball of our right foot to halt or redirect momentum when transitioning between forms.
 
Anonymous
@DJMcMayhem Magnification strength of the lenses - it's not 3.5x, but there's a scale that I don't remember
 
@Mego We used glide step, as well, but not stab stops
 
Anonymous
Stab stops were damaging, because all that momentum just goes straight up into your ankle
 
I don't have any ailments, but I've had my fair share of injuries. I've broken my wrist, my elbow, my ankle, and my toe 3 times (the same one)
 
Anonymous
I've thankfully never broken anything - I've only had a hairline fracture of my foot (thanks again marching band)
 
8:21 PM
btw why didn't you (or a guardian of yours) opt out of it?
would they kick you off of high school or something?
 
Anonymous
No, I chose to do marching band. I really enjoyed it
 
...
 
Anonymous
It just came with its fair share of injuries
 
Anonymous
8:40 PM
I got a Rubik's cube today, and I have never felt dumber
 
on the bright side, there's the gift ;)
 
@Mego cubing is awesome :D kind of wack for beginners tho
 
but it has too many colors...
 
Anonymous
@EriktheOutgolfer I got one where the colors are distinct enough for me :P
 
@Mego Having colourblindness doesn't affect the Rubik's cube? Never mind then :P
 
8:52 PM
@Mego I just searched for "rubik's cube for deuteranopia" and it looks like people with healthier vision are practically incapable of solving them
 
I found this, which is color independent
 
9:10 PM
Why does Java have Factory classes when constructors exist? Did someone decide that Java just isn't verbose enough?
 
You use factories for generic construction
(and other various logic)
obviously you can just call new() on certain things
but if you are taking an Interface, you can't just call Interface.new()
 
Right, you call it on the implementation
 
so you take a factory for that interface, and then they can pass in either a factory for the one implementation or the other
 
Or one one of the implementations
Why not just find the implementation you want and call new on that
 
You don't necessarily know which implementation. That's the point of the pattern, to abstract it away
 
9:13 PM
it removes the responsibility of choosing the implementation from the class. (Sometimes you do want that class choosing the implementation, but sometimes that logic doesn't belong there)
 
Factories can also do things other than instantiation
 
yeah, I'll do the factory pattern if there are lots of options, or to do parsing logic, etc
 
btw you'll hate Go, it has "factories" up the ass
 
@ConorO'Brien oh, what I found is outright irrelevant
 
@EriktheOutgolfer ohh lol, yeah I can see what you thought there
 
9:15 PM
@quartata Is that because there's no generics?
 
no constructors
 
Well then
 
@ConorO'Brien probably "deuteranopia" isn't the best term, yeah, although it's very different from color blindness
 
@quartata are there private variables?
so I can ensure that somebody actually uses my factory?
 
yes. fields that start with lowercase are package access
 
9:18 PM
But no private access
?
 
@ConorO'Brien also...my god, how expensive is that rubik's cube, AU$12.5
 
that's pretty cheap for a cube iirc
 
No point
 
the valk power 3 m is like 40 usd
 
You're right, I would hate Go
 
9:19 PM
if you remove constructors, what's a private variable?
 
that's almost 10 dollars...if that's "pretty cheap" then bye bye rubik's cubes
 
One package is going to be one implementation more or less
 
because obviously somebody from the outside has to access the variable to assign them
 
@EriktheOutgolfer you can get bad cubes for cheaper, but most good ones are more expensive
 
@NathanMerrill methods you export can access it
 
9:21 PM
no right, I'm just saying how "private" doesn't make sense if you don't have constructors
 
really they talk about it as Field is exported field is not
 
@NathanMerrill Or call a Set method
 
@EriktheOutgolfer you can get "budget cubes" which are $5 to $10 usd. e.g. a yuxin fire is $5
 
yeah, truly private would be unusable
 
That's how Java works
 
9:23 PM
@ConorO'Brien I don't think I can use it without bying some lubricant and stuff or the "pro set-up" :P
 
@Pavel that's true. You'd basically make every object a zero-constructor object, but the pattern would a setAll() method that sets all of the method variables
 
@EriktheOutgolfer I have a cyclone boys 2x2 ($4.95) which needed no lube, and still works fine after all the abuse I've given it (travel, mainly). cyclone boys is a nice company for decent cubes, their 3x3's range from $2 (on some obscure site) to $10, and I expect much the same quality. no set up is usually required
 
but that said, private is about abstracting away implementation details. If you really have a setAll() function, you've lost that abstraction
 
You could have a switch to make the SetAll method callable only once to have fake public get; private set:
 
you really want that logic in each of your SetAll methods? Talk about overhead
 
9:27 PM
Then you have a pattern like a=new A(); a.init(args); instead of a=new A(args);
@NathanMerrill Or you could just make it completely "reset" the object so it's essentially a new one.
 
yeah. I think Go prefers immutable objects so all of these methods aren't really what they want
 
I should clarify that you can pass an initializer list:
 
Well you can't have immutable objects without constructors to set the initial values can you
 
x := Object{Field1: 1, Field2: 2}
@Pavel go's objects aren't immutable
 
Exactly
5 mins ago, by Nathan Merrill
yeah. I think Go prefers immutable objects so all of these methods aren't really what they want
 
9:39 PM
yeah, I'm looking through their docs, and I'm not seeing a ton on immutability, which surprises me
...Go has a huge emphasis on sending messages and such
which screams "immutability" to me
 
 
2 hours later…
Anonymous
 
@Mego Cool!
 
11:30 PM
Site analytics is being very weird right now
 
0
Q: Has anybody used PPCG.SE before April 5th?

Esolanging FruitI'm serious. Does anybody here remember viewing any pages on PPCG.SE before the fifth of this month? Because according to the site analytics (5k+ only), the only time anybody has ever visited or viewed pages on this site was between April 5th and April 10th, 2018. This is rather strange, beca...

 
11:50 PM
@Mego Same, many years ago! Except without the wife part.
 

« first day (2639 days earlier)      last day (2204 days later) »