« first day (4398 days earlier)      last day (742 days later) » 
00:00 - 18:0018:00 - 00:00

00:11
@lyxal very interesting news, what a coincidence that the name of the language is very similar to your username. off by only one letter, in fact.
Indeed, an extreme coincedence. How bizzare.
00:33
Could I receive some more feedback on my sandbox question? codegolf.meta.stackexchange.com/a/25536
 
2 hours later…
02:15
@lyxal Congrats!
 
1 hour later…
03:16
@lyxal hmm interesting
the name is very familiar but i cant pinpoint exactly where i heard it before
 
3 hours later…
06:05
LDQ: Say I have a list of items I want to fold by a function. And say that the function can actually be a list of functions. What should happen?
e.g. Should it cycle through the functions when folding?
Or should it consecutively map all functions and reduce by the last?
@lyxal That's what J does.
i would honestly vote for cycling if this wasn't in a stack language yeah
but since it is i feel like the utility is reduced since you can just dump a list onto the stack for the main use case i can think of
i.e. you have a list of known length and have specific things to do with the elements
but true cycling could still be good for something like an alternating sum
@UnrelatedString it would still be golfier though, right?
wouldn't it be like (i can't find reduce lambda in the docs so i'm just going to pretend it's r) r+|-|*|/; versus ÷+-*/
06:22
@UnrelatedString what if list length 5?
The lambda would cycle back to the +
yeah as i mentioned it is still new functionality if you do need it to actually cycle
@UnrelatedString Also it's not implemented at all yet :p
 
2 hours later…
08:07
LDQ When should closures compare equal?
The == operator should call both closures on every possible list of inputs and check if all of those results are true
Since that would either return false or never return, you can optimize that to just returning false
Ah yes of course
So closures should never compare equal
Serious answer: try to make it so your type system doesn't allow comparing closures at all, because that doesn't make much sense
Most languages seem to do it that way but you could just check if they are the same function and any bound variables are equal right?
You could check if they point to the exact same thing in memory ig
What is this for? What kind of language is it?
08:13
Practlang
So in JS this is false:
let f = (a)=>()=>a;
f(2)==f(2)
But it seems like you could just cheeck if the bound variable a is equal
Makes sense that it would be false
When would you need to compare closures, though?
You could return an object that wraps around the closure, if it's something special
A closure is already basically a object that wraps around a function
08:36
you could i guess like
attach the ast to the closure value and substitute in the values of the closed-over variables
but that seems like overkill for something that would almost never come up
like seriously, make them impossible to compare is the only sane answer
Comparing them is very useful though, even if it just checks identity. Eg. adding or removing a event listener
Comparing by AST seems problematic since you could make a minor change to one "copy" of a function and break a lot of logic that might depend on them being equal, or not equal
maybe a less insane alternative would be, if a closure is represented as a function pointer and the closed-over values, just comparing all of those raw
especially since a use case like that would probably really not want it to be possible to have "the same" closure written two different places
Yep that's my thoughts
I wonder why so few languages do it that way though, then I wouldn't need to useCallback every single function in react to make them compare equality properly
 
2 hours later…
10:25
0
Q: Should we update rules in faq about deleting answers?

EzioMercerIn the faq it says that we need to delete published answers After some researches I found these two questions: Should I delete my sandbox answers after posting the challenge? We Have a Messy Sandbox where the community votes to delete the answers in sandbox after publishing: But in reality a...

 
3 hours later…
12:57
0
Q: Print all pandigital numbers

mousetailGiven a base as input, output all pan-digital numbers. A number is pan-digital if it includes every digit in that base at least one. Every number is considered to contain infinite number of leading 0s. sequence rules apply. You may either: given a base and a index, print the n-th pan-digital numb...

 
1 hour later…
14:20
@mousetail Nah, removing an event listener by checking if the function's identical seems weird to me
Just either take or return an ID
Like setTimeout does, for example
@RydwolfPrograms That requires much more administration
On the user's part or the library's?
Users
I can't see how it'd be the former, and for the latter you literally just need a hashmap
For the libraries point of view it's the same
14:21
@mousetail You'd already need to store the listener function somewhere
It requires exactly zero additional work
It can be static though
Doesn't need to be a variable
Most langs allow immutable variables that you assign at runtime...
vals, lets without muts, consts, whatever your language calls them
Only if you have some kind of object to store them in
A typical GUI application mostly has event listeners adding and removing other event listeners
There is no real way to manage this without global variables which is bad
Then make it so you specify an ID. That also means you don't need to store a bunch of lambdas in variables which is weird and ugly
Those would be constants though
14:24
What would
Not variables so no issue to store them globally since they can never change
Not what I mean
I'm talking about the code's readability not its best-practice-y-ness
Nothing more readable than removeTimeout(updateScreen)
Literally nothing could possilbly be more readable
14:26
Yeah but what about const updateScreen = [big huge lambda]
That's very ugly
what?
I don't understand, big functions are a problem anywhere
You can define it as a normal function, it doesn't need to be a lambda
Only in languages where those are the same
I don't know any languages that have global statics but no first class functions
(Or a way to define them yourself)
(Like a class with one method)
Rust differentiates between functions and lambdas (/closures)
14:29
@mousetail just use hash(table|map)s for that
There are traits that encompass both though
@RydwolfPrograms i dont like that
I imagine a event listener function would accept both
@Seggan Well it's for a very good reason
Closures capture their environment
Normal functions don't which is pog and good
In fact, Bevy, a rust game engine, already does that and you can add and remove event listeners by identity
14:30
@RydwolfPrograms maybe for a low level lang, sure
No, requiring you to deliberately make your function rely on external values is good
Pure functions are good
but there shouldnt be a difference in a high level lang
@RydwolfPrograms yes
Yeah and this is a feature that makes pure functions much more the default
Closures are basically requireed to make pure functions useful
@Seggan It has little to do with low vs. high level
14:32
but i also dont want 2 lines of boilerplate to capture then like c++
2
Rust's closures are shorter than its normal functions :p
Also C++ sucks never insult Rust by bringing it up in the same conversation as it :p
> C++ sucks
couldnt agree more
We should create a meta post to decide on a name for OTTNB given that it doesn't seem to be dying off
Permission to do that?
still, i dont see the reason for distinguishing the types
@RydwolfPrograms What's wrong with OTTNB?
14:35
most (function/closure) applications shouldnt care about purity
@Adám Idk, feels a little boring. I'd always imagined it having a name, and we've brought it up a few times.
Off-Topic TNB was kinda just a placeholder
TTB?
@Seggan I can see the reason in languages where the exact memory something requires is important. But still you'd probably wrap it in some kind of wrapper like Box<dyn> so it doesn't matter normally
Thw Twentieth Byte is already the name of the mods' room
14:36
Oh.
And it's a little boring (sorry mods)
@mousetail yes, thats why i was talking about low/high level langs
@RydwolfPrograms well force them to rename it
I rather like OTTNB, as it can be (mis-)read in various fun ways, like Over The Top…
3
In a low level lang you'd probably want the same available just not by default
One practical advantage of having a unique name is it's easier to move things to it
Remember the DBA incident? :p
14:39
How about Golf Overflow?
Well if we're proposing names maybe I should create the meta post :p
Yes, sure. Let's make a mini election process for the name.
@RydwolfPrograms wasn't there a meta proposal to rename it?
There was one to "make it official" IIRC
Although I might've confused it with LDW.
14:43
> Should we "officially recognize" it and add it to the room description for TNB?
I'd say so.
The answer to which was "yes", so we should probably add it to the room description
Looks good?
Looks ok
Maybe expand to "Use [link] for off-topic"
14:45
^
How about "Go to [link] for off-topic discussion"?
"Use" feels vague
Sure, that works if it fits.
Utilise
Actually "use ... for off-topic discussion" seems fine
"go to" feels like it'd ruin our code quality
2
Maybe use "come from" like interecal?
14:47
room topic changed to The Nineteenth Byte: General discussion for codegolf.stackexchange.com | Guidelines: cgcc-se.github.io/chatiquette | Use chat.stackexchange.com/rooms/136286/off-topic-tnb for off-topic discussion (no tags)
3
So we can see how it looks
Can you put line breaks in?
I don't think so
@RydwolfPrograms Looks fine, but technically not correct, as small off-topic forrays are ok.
Barely any discussion here is on topic
Update the chatiquette maybe?
14:50
Yeah, we should probably add it to the "be on-topic" section
I'm thinking while we're at it we should fork a very similar chatiquette for OTTNB
@mousetail This one is ;-)
Since it's now RO'd by the same people, it should probably have the same rules
You cannot include line breaks
@RydwolfPrograms FINALLY
15:27
0
Q: What should we call Off-Topic TNB?

Rydwolf ProgramsSince we've decided to officially recognize TNB's off-topic room Off-Topic TNB, it might be a good time to give it its own name. We'll do this the same way we decided on TNB's name; post one room name per answer. If you think the current name is the best option, feel free to create an answer with...

(↑ is because starring the NP announcement shows a non-descript url)
One problem is that TNB is already a pun on off-topic CGCC
Since the 19th hole is where you'd go after you're done golfing
So we should rename OTTNB to TNB and TNB to "discussion of the other 18 holes"
 
2 hours later…
17:12
> Rust has successfully embodied everything I want to avoid in a PL -- godawful syntax, bloated semantics, a fanatical community that makes poor rationalizations for it sucking as bad as it does, the ad hoc feel of the whole thing. If a language promising memory safety is infuriating (or, as they put it euphemistically, "has a steep learning curve") to the point that it makes you just want to do the memory management, yourself, you know it's a turd.
i disagree that it has a steep learning curve
ive only wrestled with the borrow checker once
syntax is quite nice too
but it could be a bit cleaner
@Seggan that's impressively wrong, kudos to whoever wrote it q:
The fan base is a bit overzealous yes, but that's true for basically any language
id debate that point
rust fans are much more zealous about rust than any other lang ive seen (except lisps :P)
Python fans can be pretty crazy too about denying the language's weak points
tbh python doesnt have many weak points besides (imo) dynamic typing
17:21
That kind of points out Rust's surface level flaws while leaving out all the good stuff
even significant whitespace is somewhat nice (id not add it in a new lang tho)
Rust does a lot of things very well
Its traits and structs and enums and stuff are a great alternative to traditional OOP, it keeps a lot of the cool stuff from JS (which makes it feel nice to use to me) while dropping the jank, its compiler is amazing at helping you figure out bugs, etc.
yeah enums are real nice
though they could have been called differently
Rust's verbose syntax is the main real complaint in that paragraph, and that's a design choice
Not one I really like, but ¯\(o-o)/¯
im planning to implement smth similar to rusts enums using union types in rol
17:25
Unions are just worse enums
rol's enums will be your traditional java enums
@RydwolfPrograms but they are more versatile
In C you'd (almost) always combine your union with a enum, so it's basically the same thing with extra steps
I mean you can use unions to do stuff like turning a float into its binary representation, but that's cursed and unsafe
@RydwolfPrograms can you say e.x. type ast = Expr | Int | String in rust enums
17:27
Yes
enum AST {
    Expr(Expr),
    Int(i64),
    String(str)
}
Oh you mean typescript style unions not C style unions
Then yes I agree
@RydwolfPrograms yes but you still have to match on it to extract the string
@mousetail yeah those
maybe i shouldve said sum types
@Seggan In what situation would you not need to do the same thing with your way?
How would you know it's a string and not an int unless you were already matching something else?
as in i mean its still wrapped
you have to deconstruct it
i can just do node as String
sum types are also a good utility in general
Wouldn't that be a place to hide bugs?
17:35
especially since rol doesnt have static overloading
@RydwolfPrograms not if im sure
by ur definition, casts are a place to hide bugs :P
@Seggan How are you sure?
You need some sort of enum thing at some point, why not just bundle the union with it Rust-style
@Seggan (and they often are :p)
@RydwolfPrograms say if my function for some reason already knows the input node is a string?
@RydwolfPrograms i have java style enums
@Seggan Then why are you passing the sum type instead of just the string?
If anything it's good to discourage sum types in places where you know the type
maybe because the superclass requires the sum type?
@Seggan Sure and I'm arguing you shouldn't :p
17:41
@RydwolfPrograms agree
@Seggan Hm, that makes sense I guess. Still don't see how an if let or a match to get the string is any different from an as String in that situation
shorter, a bit clearer, automagic failure if im dumb
And at least the if let/match makes the fact it can error explicit
which would u rather see
var x = y as String or var x = if (y is String) ? y : throw TheCoderIsDumbError()?
Many Rust enums in libraries have .as_string()-like mathods btw
17:53
not surprised
but wouldnt it be nice to have it as a language feature? ;)
00:00 - 18:0018:00 - 00:00

« first day (4398 days earlier)      last day (742 days later) »