« first day (2457 days earlier)      last day (2369 days later) » 
00:00 - 15:0015:00 - 00:00

12:09 AM
@Mego can you write if x*x-y*y?
@Pavel isn't using the wrong format specifiers ub?
 
Probably
But ub doesn't mean random shit
 
@HelkaHomba keyboard every time. which is really awkward whenever I have to use a Mac...
@Pavel it's not printf's fault you're lying to it
 
12:24 AM
@Pavel yeah actually it does
In the case of abs you're telling it to interpret the bytes of the floating point number as an integer
that's going to give garbage
Same here pretty much
 
@quartata I thought undefined behavior was allowed to do literally anything according to the language spec, including for example formatting your hard drive
 
I mean it is
I'm just saying what's actually going on here
which is, in fact, random shit
 
yeah. well, i guess if you are using one specific compiler and you read IEEE 754 you could use that "feature" sensibly
 
People do
Actually a common idiom:
union { float f; int x; } blah; <do bit twiddling on blah.x>
Since you can't use bitwise ops on floats
 
12:59 AM
Well time to try adding types to Proton
 
1:22 AM
I'm about to implement Proton types on the Proton-code side; suggestions?
Examples (this code would be within a "constructor" function):
Given typename TypeName
new TypeName(1, 2, 3)
new TypeName{"a": 1, "b": 2, "c": 3}
new TypeName({"a": 1, "b": 2, "c": 3})
etc, new suggestions also welcome
also, how to declare a type?
 
Maybe start thinking about what kind of typing discipline you want first
That will affect syntax a bit
 
Hm... Could you elaborate?
like wdym by typing discipline? like static/dynamic?
 
That's one aspect
 
There's usually four to consider
 
1:25 AM
okay
 
The first you've already highlighted is when types are resolved: static means at compile time (although interpreted languages can do it too -- after parsing, before execution), dynamic means at run time as you go
 
hm ok. i'm almost certainly doing dynamic.
 
The second is what you do when a type error occurs: strong means you throw an exception, weak means you try to resolve it via coercion
The third (and most complicated) is how to identify whether types are compatible
 
What exactly is coercion?
 
It's like what JS does when it turns a int into a string or vice versa
 
1:29 AM
oh ok
 
Although not all weakly typed languages do coercion in that sense
Weak can just mean any means of enforcing types other than just failing
C for instance is traditionally considered a weakly typed language
 
okay. I'll probably try to do some sort of coercion-ish thing, maybe let the user decide how to coerce things if something fails
 
Anyways, onto the third part:
Nominal means that types can only be compatible if the types in question refer to the exact same type with the same name
Structural means that types are compatible if they have all the same fields and methods
 
Okay. So can you give an example of an expression that would create different behaviour between the two?
 
Duck means that types are compatible as long as they have the field or method in question that's being referenced
 
1:32 AM
@ConorO'Brien do you know how overriding generators would work can I still call super.foo() to yield or do I need to do like yield* super.foo()?
 
class A {
    int x;
    int y;
}

class B {
    int x;
    int y;
}
Under nominal typing, these are different types. Under (pure) structural typing, these are equivalent.
The fourth and final is how types are notated
 
wait ducktyping is a thing? :o
 
Manifest means you explicitly name your types
Inferred means they're, well, inferred
 
hm ok
 
@HyperNeutrino yea
Python is dynamic, strong, duck
 
1:33 AM
wait so how would having two structurally equivalent classes change behavior?
I can't think of a case right now where duck/structural/nominal would cause different behaviour in two cases (such as fine/error)
 
How would typescript work. You can name interfaces (but not types), but for an object to implement an interface, all it needs to do if have at least the members of the interface.
 
@Pavel Interfaces are a form of structural typing in Go at least
this sounds similar to Go
@HyperNeutrino It changes how you think about types
 
Typescript: What if we took JavaScript, and made the types somewhat sane?
 
Oh okay. So it doesn't really affect program behaviour in most cases?
 
You're no longer looking for specifically a string, or a number
You're looking for something that can do what a string does
 
1:35 AM
oh
hm that makes sense. yeah I like duck better
 
It can lead to much more flexible code in some cases
Duck is kind of a weaker version of structural typing
Not all of the fields and methods have to be there, just the ones that are relevant in this case
It's kind of a natural consequence of the "looking up methods and fields at runtime" approach
If you've written in Python, you get how this works
 
Anonymous
@quartata Like fast inverse sqrt :P
 
In computer programming, duck typing is an application of the duck test in type safety. It requires that type checking be deferred to runtime, and is implemented by means of dynamic typing or reflection . Duck typing is concerned with establishing the suitability of an object for some purpose, using the principle, "If it walks like a duck and it quacks like a duck, then it must be a duck." With normal typing, suitability is assumed to be determined by an object's type only. In duck typing, an object's suitability is determined by the presence of certain methods and properties (with appropriate...
 
I'm building a dynamically typed language that compiles to C#. The return type of everything is dynamic, except when it's IEnumerable<dynamic>.
 
@Mego Actually the original implementation in Q3A uses a cast
But you could it with a union
 
Anonymous
1:37 AM
@quartata You beat me to literally those exact words
 
rewhhrfhahahaha
 
Anonymous
(before the edit)
 
I mean I do have an unfair advantage of having looked this up a couple hours ago
 
@quartata Did you say there are 4 categories?
 
There's a frankly godawful amount of boilerplate used to coerce method references into a type that can be fit in a variable of type dynamic, you're normally not allowed to do that.
 
1:38 AM
I'm not that much of a loser when it comes to old games
 
Anonymous
I'd imagine that casting versus using a union would produce nearly-identical assembly, especially with optimization
 
@HyperNeutrino yeah, you might have missed the fourth
 
oh ok
 
5 mins ago, by quartata
The fourth and final is how types are notated
That doesn't really apply to you though
 
oh riiiiight yeah im dumb
 
1:38 AM
Since you're not using static typing
You could do a form of manifest typing
 
@quartata How many kinds are there?
 
Like the new type hints in Python
@Pavel Really only two that matter: manifest and inferred
I don't know anything else at least
 
So inferred is like JS, since objects don't have named types.
 
Not really
Inferred is like Haskell
The types are there but the compiler does special type inference to discover them
 
actually, what would be the classification of a system where an object doesn't really have a type, just a dict of attribute names to values with defaults based on its "type"?
 
1:40 AM
The fourth category really only matters in static typing
 
@quartata So like C# var
 
Anonymous
@HyperNeutrino That's the protoype pattern
 
Or C++ auto
 
hm ok
 
@HyperNeutrino People call this "untyped" but really it's dynamic duck typing
the end result at least
 
1:41 AM
oh ok
that was what I had in mind actually; should've mentioned that earlier. but yeah
 
Lua ( LOO-ə, from Portuguese: lua [ˈlu.(w)ɐ] meaning moon) is a lightweight, multi-paradigm programming language designed primarily for embedded systems and clients. Lua is cross-platform, since the interpreter is written in ANSI C, and has a relatively simple C API. Lua was originally designed in 1993 as a language for extending software applications to meet the increasing demand for customization at the time. It provided the basic facilities of most procedural programming languages, but more complicated or domain-specific features were not included; rather, it included mechanisms for extending...
 
I think it kinda resembles Ruby but I'm not sure
 
(a language that does this)
 
oh I was going to say Ruby/Lua but too lazy to type lol
anyway brb o/
 
Anonymous
@Pavel Not really. That's just telling the compiler "figure it out, I don't feel like typing the type." The type is inserted by the compiler - it's not really inferred the same way that Haskell infers types.
 
1:42 AM
For one it won't infer any kind of generics obviously
Haskell can do that
 
Why not? var foo = new List<string>() totally makes foo a List<string>
 
But you specified that generic.
 
oic what you mean
 
Inference would be if you just did ["1", "2", MaybeSomeSubclassOfStringIfYouWantToBeFancy("3")] and it figured that shit out
How the inference works depends on the behavior of the type system as a whole tho
 
It kinda does that. var foo = new[]{"1", "2", MaybeSomeSubclassOfStringIfYouWantToBeFancy("3")} instead of var foo = new string[]{"1", "2", MaybeSomeSubclassOfStringIfYouWantToBeFancy("3")}
But I see your point
 
1:45 AM
In type theory, a type system is said to have the principal type property if, given a term and an environment, there exists a principal type for this term in this environment, i.e. a type such that all other types for this term in this environment are an instance of the principal type. The principal type property is a desirable one for a type system, as it provides a way to type expressions in a given environment with a type which encompasses all of the expressions' possible types, instead of having several incomparable possible types. Type inference for systems with the principal type property...
relevant, this is the type you're basically trying to find
ignore the terrible wording, basically it's just saying "what's the most general way we can type this value"
 
Just assume it's Object. 10/10 works every time.
 
Haha, that's true
I'm assuming languages like C# don't count Object as a parent for this purpose
I guess "most general" is misleading
 
I'm guessing this is harder with structural typing than manifest typing with explicit inheritence specification.
 
I think you meant nominal?
 
probably
 
1:51 AM
But yes, you're right. Go can do inference on assignments much like C#'s var but not on function parameters
 
I'm guessing there aren't many statically-typed languages where f(var x, var y) works. Even for haskell that has to be specified, iirc
 
Nope. It's better if you do though
 
That's pretty cool.
 
Anonymous
@Pavel It can be inferred, but it can't take any type as arguments, since there's no overloading
 
Anonymous
C++ can kind of do it with templates, but templates are a huge hack
 
1:53 AM
"""huge""""
understatement of the decade right here
 
All I remember from Haskell is an annoying error where I didn't realize that an int can't just always be coerced into a float.
 
Anonymous
Templates are a yuge yack
 
Anonymous
@Pavel Nope, no implicit coercion/casting
 
I wasted hours of my life because of this.
 
Anonymous
The key to writing good Haskell is to think about functions as stringing together combinators and not think too much about the underlying types. Think about the operations, not the data.
 
Anonymous
1:56 AM
But also keep in mind the input and output types of the functions/combinators so that you can make sure you're combining them correctly
 
You know, I think I'm not even going to have "types", just meta tables that you can combine together and constructors just have to return the tables correctly
 
This sounds suspciously like JavaScript "object"s
 
Those are terrible
 
partially where this idea came from too lol
@Pavel :(
 
1:58 AM
Dictionaries are dictionaries.
 
oh I was planning to have objects just be dictionaries
 
@HyperNeutrino This is Lua
This is very much Lua
 
and .ident to mean ["ident"]
 
JS doesn't do it nearly as pure as that tbh
 
@HyperNeutrino Excatly that's terrible.
 
1:59 AM
It has constructors and other garbage and the prototypes aren't as powerful
 
Perfect so at least I'm not the only one with this idea see other people did it surely that's a good idea
 
@Neil Why is keyboard & Mac bad?
 
Now not saying it's a good idea
But it works well enough for small-scale scripting
 
I mean probably actually those will just be the default behaviours but you can still override them like in Python
hey look proton actually can now start up without crashing
that means the basics of the "type" system are working
 
2:03 AM
._.
any reasons why objects shouldn't just be dicts of their attributes
 
Because inheritence, and being able to reasonably define functions for objects.
 
inheritance can be implemented probably
as long as I make each dict remember its parent
 
Just not the kind of inheritance you're thinking of
 
oh well gtg
 
Prototype-based programming is a style of object-oriented programming in which behaviour reuse (known as inheritance) is performed via a process of reusing existing objects via delegation that serve as prototypes. This model can also be known as prototypal, prototype-oriented, classless, or instance-based programming. Delegation is the language feature that supports prototype-based programming. Prototype object oriented programming uses generalized objects, which can then be cloned and extended. Using fruit as an example, a "fruit" object would represent the properties and functionality of fruit...
 
2:05 AM
o/
hm I'll see how this goes I guess
wait I think I'm dumb or something like that
why am I making a wrapper called "ProtonObject" when really it's just a dict lol
 
2:22 AM
o/
Funky is looking rather good I think.
 
hi
new changes since I last was trying it out?
 
Many bugfixes.
 
There isn't any documentation yet, correct?
 
Sadly, correct.
 
2:28 AM
Will you call it Tacomentation?
 
No.
 
darn
anyway wifi cutting out soon so cya o/
 
Comment syntax?
 
N/A
(I never actually considered a comment syntax whilst writing it)
 
2:35 AM
Bitwise Xor?
 
a~b
(Lua style)
(There's still no way to take input outside of functions)
 
@ATaco Why does it have different result when I omit the `;` after the outer `for` loop?
https://tio.run/##dU/RSsQwEHy@fMVYEHavLeYiHCe9E/wRoa1WQ21OzjtEpN9ep4nUJx@S7GRmZ2e7S@i/pqm7hPbsjwEv7ROkLtAovs3q89W/PUMaXB1g48@qxQE1rtFUBDVBLBoWLYuRpzajMYvhg7X27nYHCbE/UBiQw1EXPggsO7rjCTIQuAoD9lRUyPMhDYxkn8h@IftE/prMdw4RCShBKsdGsUbCw4K5HJ1KbAqO4aM6Zx9TbHFU0EjJsPHR6VrSG6U3W1UuNsU4PgaHxx7OznG84v3kw1ngC2Qo75EVf6uTVZP975uZ6Qc
 
It's trying to call the result of the for loop.
(Which is why Semicolons exist in the first place)
 
What is for loop result?
 
The last expression called in the loop.
In this case, ans = ans + (((n - k) + 1) * ((n - m) + 1) * gcd(k - 1, m - 1));.
Even though it's not a function.
 
2:51 AM
Does funky have `return` keyword, and how to use it? (in the later function)
https://tio.run/##dU/RSsQwEHxuvmIsCLuXFnMRROmd4I8Iab2eoTYntUVE@u11m0h98iHJTmZ3dqadQve1LO0UmtFfAs7NC8gVqBnfKvt89W8nUI2rI0z8yRoc4XCNuhLgBMSilqKRYpYznMZpCHCVmpXahJ@MMQ@396AQdYIMBGhYlbnwIcDIZHsZQL0AW6HHQToqaN2nxZHsEtltZJfIX5H11iCigBJCaewZOyTcb1hCilKJfSFr5GFeM8zJPpGVFlFioWTy2fKO0ht7b@6YWaIt0ZCP1uFxgDWrIc94H3wYCb5AjvIRefEXXlhW@f/CuVp@AA
 
@user202729 No, sadly.
I've been thinking of how to implement it, but it's a bit painful.
 
Why does it "magically" works in the first function? (I know there are little error checking)
 
It thinks return is a variable.
So it's parsing that expression, which conveniently does nothing, then parses the next expression.
And this is used as an output
 
Feature request: += and similar.
 
It's planned, don't worry.
It will (for the most part), just be changing the assignment token to "assignment": "expression: operator? '=' expression",
Alright, code for that is implemented.
 
I know, but I want the program to also run in JS. That's why I used return.
 
Oh, but it's a gosh darn polyglot.
10/10
 
@ATaco why are you writing this in JS
Like I thought you liked Lua
 
I do, but I prefer regex over lua patterns.
 
3:12 AM
It would have been fine if ran with LuaJIT
@ATaco nnhhh
 
And LuaJIT is heresy.
 
Why are you not using an actual lexer
 
Give me 5.3 or give me death.
Because I had no need to, when I could write my own.
And the idea was for me to write my own.
 
I know it's a Perl idiom to write lexers using regex and redo but that's just to do the loop in C and not Perl
Regex is an imperfect tool at best for this
 
Regex is just used to match tokens, the heavy lifting is done semi-sanely.
(It only took me two tries to fix the $O\left(n^2\right)$ time complexity!)
 
3:16 AM
Also what does Lua 5.3 have that you want, just curious
I know some of the things were ported
 
Bitwise Functions.
And better whitespace handling.
 
bit.* is there
 
It's longer. And only from 5.2. And only in LuaJIT.
 
Gosh, really? /s
 
How often do you use it tho
 
3:18 AM
I use the better whitespace handling more than I use the bitwise functions tbh.
 
Like I'm pretty obsessive about my bit hacks and even I find myself using it rarely
 
Anyway, it's my choice what i write my languages in, it's also fairly varied.
RProgN1 was lua, RProgN2 was Java, TacO and Threead were Lua, ReRegex was Java, MaybeLater was Javascript.
 
I know I know I just mean @Downgoat can testify that making languages in JS is pain
 
Yeah but I'm Taco and that doesn't stop me.
Funky is a beautiful language. It doesn't care where it was born.
I've now pushed the += syntax.
 
@ATaco Does that include the ++ syntax.
 
3:27 AM
++ was already added.
 
I see.
 
3:55 AM
@quartata it’s not too bad with babel actually
You can plug-in away all the weird parts of JS
 
but you can't
also I thought we agreed cheddar was a mistake
2
ok well I don't agree with that but rather you did
anywho
 
 
no shit we're poor
geniuses
 
4:19 AM
0
Q: Measuring Sticky Tape in Bytes

12Me21This answer: https://codegolf.stackexchange.com/a/107882/64538 received a comment which reads: Hello, and welcome to PPCG! I don't know if tape is valid, but it should at least be 1 byte. I believe that this is a problem which needs addressing. Should the number of bytes correspond to the ...

 
5:01 AM
I should write a blog.
 
@ATaco y tho
 
 
4 hours later…
9:35 AM
@HelkaHomba it doesn't have a key to switch to an arbitrary window. there's one to switch apps, and one to cycle windows within an app, but that's not good enough
 
10:27 AM
Great, now I have not one but two commands to enter every time I reboot this
lm978@basement:~$ xinput set-prop 9 "Device Accel Constant Deceleration" 2.4
lm978@basement:~$ xmodmap -e 'add mod3 = Scroll_Lock'
 
@Pavel Maybe millennials are more energy-efficient. They don't waste calories on silly things like exercise.
 
 
1 hour later…
11:42 AM
@Dennis Hello! Could you please unfreeze CodeGolf Hackathon? Thanks!
Thanks a lot!
 
np
 
And lol that was fast
^ @EriktheOutgolfer @Adnan @cairdcoinheringaahing @Downgoat @H.PWiz @LeakyNun (I pinged you because you were the ones involved in Puzzle 1).
 
@Mr.Xcoder testcase for 3 is wrong: delta should be [1,1] and sum should be 2
 
@LeakyNun You are right, thanks!
 
12:20 PM
@LeakyNun Nice. I had the same byte count: RSµ²RḌDḣṫ³ḊIS
NVM mine doesn't work
 
@Mr.Xcoder well, it's weekend :p
 
Yes, the time PPCG sleeps
 
but if I'm correct dennis should be sleeping right now
 
@EriktheOutgolfer should. BTW It's like ~8 in the morning there isn't it?
 
@EriktheOutgolfer Dennis is such a good mod, he can mod in his sleep :P
 
12:32 PM
@Mr.Xcoder it was 6:44 when he posted that message
 
I have a quick question. Are questions required to go through the proposed challenges sandbox?
 
recommended
 
@SimplyBeautifulArt No, but it's recommended
ninja'd
@EriktheOutgolfer Wait, you know where (in the world) Dennis lives?
 
wait
it was actually 8:44 lol
he lives in asuncion paraguay
 
Wait he lives in Paraguay? I thought he lived in the USA
 
12:35 PM
No, he lives in Paraguay, but is German
 
@__@
 
1:14 PM
CMP: Has anyone ever undeleted one of your deleted posts?
 
@cairdcoinheringaahing No.
 
I remember getting really annoyed when v happened:
> Post Undeleted by HyperNeutrino, programmer5000, totallyhuman
Post Deleted by caird coinheringaahing
 
@EriktheOutgolfer Nice solution.
 
was based off of this
but then altered quite a bit so that I get 10 bytes
 
I think the Husk one can be golfed though, will try
 
1:25 PM
there isn't a "deltas" builtin in husk
 
I know.
 
it does seem a little bit filled with air
 
Yes it does
IDK though
 
but I tried a bit before adding it there
 
Of course you did...
 
1:28 PM
btw it's husk's ability to cut and a builtin for natural number sequence that makes it win
but the builtin is infinite, so I can't just "tail" like in jelly
 
@EriktheOutgolfer Your solution seems quite good, given that my first try is ΣẊ-↑↑Σḣ⁰ṁdN_⁰
(13 bytes)
or... ΣẊ-↑_⁰↑Σḣ⁰ṁdN
@EriktheOutgolfer Now my second try ties yours, ΣẊ-!CNṁdN (now it got pretty similar)
 
that was my first
 
But you decided to use a fancier built-in? :P
 
1:40 PM
although two Ns seemed wasteful
 
I will mention mine as an alternative
 
you can add it in as husk2 as well
 
@EriktheOutgolfer No, that's quite wasteful for 1 character. I will mention it directly in Husk.md
 
@EriktheOutgolfer Done.
gtg o/
 
2:13 PM
ಠ_ಠ I just read through the memes page, and realised just how old they all are
 
Practically all of them involve Alex A and Geobits, who are very inactive at the moment D:
 
Oh dear! *::scurries away::*
 
2:39 PM
@mınxomaτ what so now they censor your emotions?
because why else not make a big smile???
 
PEP8 (Python) is basically saying "Don't golf your code". Every single "Don't do X" is a tip for golfing in Python :P
CMC: Reverse an array using only ASCII characters in your code
 
Just use normal programming languages.
@cairdcoinheringaahing Jelly, 1 byte: U
 
@user202729 I realised after I posted it that U exists in Jelly. I had a 2 byte solution: m-
 
Pyke, 1 byte: _
 
Mathematica, 7 bytes: Reverse
 
2:47 PM
Python, 8 bytes: reversed
 
C++, ??? bytes: #include<vector>¶#include<algorithm>¶[](std::vector<int>a){std::reverse(a.begin‌​(),a.end());return a;} (not tested yet, hopefully correct)
 
> #include<algorithm>
C++ tells you what method to do code in?
 
I don't understand what you are asking.
 
@user202729 Never mind
 
@cairdcoinheringaahing 05ab1e, 1 byte: R
 
2:55 PM
8
A: Golf a number bigger than TREE(3)

Simply Beautiful ArtRuby, 348 bytes, fψ0(ψ9(9))(9) where f is the fast growing hierarchy and ψ is an ordinal collapsing function described below. Try it online! def f(b,n=0,x=0)c,d=b;n<1?(b.class!=Array):x>0?(n.times{n+=b==1?n:f(f(b,n),n,1)};n):f(b)?(b>1?b-1:n):b.size>2?h(n,c,d):f(d)?(d>1?[c,d-1]:d>0?c:[c,n]):[c,...

in Primes and Squares, 2 hours ago, by Simply Beautiful Art
Does anyone think my explanation is too advanced/complicated and that I need to dumb it down?
 
@SimplyBeautifulArt Explanations never need to be dumbed down. Some will understand, some won't. That's that.
 
:o okay then
 
00:00 - 15:0015:00 - 00:00

« first day (2457 days earlier)      last day (2369 days later) »