• (disco) in reply to Magus

    :rolleyes:

  • (disco) in reply to bitti

    mi gleua li no la djulias

  • (disco) in reply to Buddy

    <That which matters most <is frequently what you miss <I wait in silence

  • (disco) in reply to Magus

    :rolleyeface:

  • (disco) in reply to Jarry
    Jarry:
    third, you are imposing your heteronormative styles as the only way

    I was all about imposing @buddy's bracing ways (as they are my ways, too), but I think I like your :trophy: even more.

  • (disco) in reply to presidentsdaughter
    presidentsdaughter:
    TRWTF is nobody being afraid WHY there is a 4K '0'-filled string in the first place...

    Because it's part of a program that's producing a binary file for output to a government system. The line is 4096 characters, and unused positions contain zeroes, so the program starts by creating a "blank" line and then replaces characters it cares about.

  • (disco) in reply to Placeholder
    Placeholder:
    The text length limit gets in the way, but the idea survives.

    Either this thread or that game ate an entire core of my cpu.

  • (disco) in reply to blakeyrat
    blakeyrat:
    I'm talking iPad and Android and Samsung and Kindle and yada yada.

    In Japan? Kairosoft has ported (I assume) all their 240x320 dumbphone games via some kind of emulator to Android rather than rewrite them.

    I mean, maybe they did rewrite them, but in that case why do they look like they should still be running on such an old phone?

  • (disco) in reply to Jarry
    Jarry:
    if you ain't gonna play this isn't fun

    : I do believe you have got it surrounded, Mr. Morden!

  • (disco) in reply to isthisunique

    This post is completely EVIL on a mobile device.

  • (disco) in reply to boomzilla

    The most important thing is: does that single-line-block style really work for you? Obviously the final line is not something I'd do in real life, but if I can get away with if (condition) { return value; } without annoying people too bad, that's a major victory for me.

  • (disco)

    This site is not optimized for mobile.

    [image]
  • (disco) in reply to mruhlin
    mruhlin:
    Generating 4096 zeros at runtime comes with a performance penalty.

    That depends on how good your optimiser is! The following is actually a string constant.

    format "%0*d" 4096 0
    

    (No, I'm not golfing this stuff.)

  • (disco)
    bitti:
    accalia:
    s = '0' * 4096
    

    if you're looking to golf, python is even better.

    Even though not shorter Julia is still better:

    s = "0"^4096
    

    Clearly string concatenation behaves more like multiplication (e.g. summation is supposed to be commutative, which concatenation clearly isn't). Therefore you get exponentiation when repeating concatenations.

    bitti:
    Exactly. That's the reason why Julia is saner, because it adheres mathematical conventions.

    Where in mathematics do we have a multiplication without an addition it is distributive over?

    And anyway, it should be either UPN, string number times, or the other way round, number times string. We say e. g. "I read this post five times", not "I read this post times five".

    Good ol' Excel, where string concatenation is done by the '&' infix operator or by the function CONCATENATE(), and multiple concatenation of the same string by REPT(), so there is no ambiguity.

    dkf:
    mruhlin:
    Generating 4096 zeros at runtime comes with a performance penalty.

    That depends on how good your optimiser is! The following is actually a string constant.

    format "%0*d" 4096 0
    

    Never buttume any optimization. Especially when you're developing for multiple platforms. (Unless inner platforms you built yourself, of course.)

    PJH:
    accalia:
    shouldn't that be kilokibibytes as you're only multiplying by 1024?

    HTH, HAND etc...

    Does anyone know who this law is named after: "As an online discussion among geeks grows longer, the probability of an xkcd quote approaches 1"

    [image] (source: https://xkcd.com/394/)
  • (disco) in reply to PWolff
    PWolff:
    Does anyone know who this law is named after:"As an online discussion among geeks grows longer, the probability of an xkcd quote approaches 1"

    Considering Bi units predate that cartoon by 10 years (and, of course, ignoring the fact that KiBi doesn't even appear in it,) I do believe you're the one invoking the law by mentioning it rather than that quote of mine which was in no way intended to reference it.

    And in answer to your question, it's a variant of Godwin, of which there are many - we even have/had one on here regarding any topic eventually revolving around some deficiency or other to do with Discourse.

  • (disco) in reply to PWolff
    PWolff:
    Never buttume any optimization. Especially when you're developing for multiple platforms. (Unless inner platforms you built yourself, of course.)
    % tcl::unsupported::disassemble script {format %0*d 4096 0}
    ByteCode 0x0x1008fd310, refCt 1, epoch 15, interp 0x0x100829a10 (epoch 15)
      Source "format %0*d 4096 0"
      Cmds 1, src 18, inst 3, litObjs 1, aux 0, stkDepth 1, code/src 0.00
      Commands 1:
          1: pc 0-1, src 0-17
      Command 1: "format %0*d 4096 0"
        (0) push1 0 	# "0000000000000000000000000000000000000000"...
        (2) done 
    

    It does what I said it does. I said it does that because I wrote that particular part of the optimiser. :smiley:

  • (disco) in reply to Buddy
    Buddy:
    The most important thing is: does that single-line-block style really work for you?

    It's better than leaving the braces out for a simple return statement or similar. I have few hard and fast rules, but always using braces is one. Line breaks and indenting can be more flexible depending on circumstances.

  • (disco) in reply to PWolff
    PWolff:
    Where in mathematics do we have a multiplication without an addition it is distributive over?

    What about complex numbers? I'm not sure, but I know that multiplying them is very weird compared to reals. Matrix multiplication and addition seem like they probably aren't closely coupled like that either. With multiplication you aren't even necessarily dealing with things of the same dimension.

  • (disco) in reply to boomzilla
    boomzilla:
    What about complex numbers? I'm not sure, but I know that multiplying them is very weird compared to reals.

    Complex number addition and multiplication are still pretty simple. They're associative and commutative and so on, so (A+B)*C = CA+CB even when working with complex numbers. The trick with multiplication is to use the polar form, so you can just add the angles and multiply the magnitudes.

    It's with quaternions that things go strange.

  • (disco) in reply to PWolff
    PWolff:
    "As an online discussion among geeks grows longer, the probability of an xkcd quote approaches 1"

    Isn't that @blakeyrat's first law?

  • (disco) in reply to PJH
    PJH:
    ignoring the fact that KiBi doesn't even appear in it

    to paraphrase Admiral Kirk, there's no such prefix.

  • (disco) in reply to Dreikin
    Dreikin:
    abarker:
    public String ZeroedBitString(double megaBytes)
    {
        int z = (int)Math.Floor(megaBytes * 1024);
        z = z * 2;
        var s;
        var c = 0;
        var l = 0;
        while (z-- > c++)
        {
            var s = l.ToString() + s;
        }
    
        return (string)s;
    }
    

    It's also off-by-one1.


    1: I hesistate to call it an error, given the number of intentional :wtf:s in this place.

    You're wrong.

    Console.WriteLine(ZeroedBitString(0.0009765625));
    > 0
    
    Console.WriteLine(ZeroedBitString(0.009765625));
    > 0000000000
    

    Note that 0.0009765625 * 1024 = 1 and 0.009765625 * 1024 = 10. It would appear that the output is exactly what one would expect.

    Now, there are two small bugs in the code, but off-by-one is not one of them. Here's the debugged code:

    public String ZeroedBitString(double megaBytes)
    {
        int z = (int)Math.Floor(megaBytes * 1024);
        z = z * 2;
        var s = "";
        var c = 0;
        var l = 0;
        while (z-- > c++)
        {
            s = l.ToString() + s;
        }
    
        return (string)s;
    }
    
  • (disco) in reply to abarker
    abarker:
    You're wrong.

    Yes, apparently I am. I can't remember exactly why I thought that, but I think I ran through it in my head with pre-(de-,in-)crement rather than post-(de-,in-)crement in the condition >.<

  • (disco) in reply to PWolff
    PWolff:
    Where in mathematics do we have a multiplication without an addition it is distributive over?
    Group theory, for one. I think also category theory, but I'm not really familiar with that area.

    Note that if it's commutative, we often write it as addition instead - thus supporting the argument that we should use addition syntax for commutative operations only, and multiplication syntax for non-commutative operations.

  • (disco) in reply to Scarlet_Manuka
    Scarlet_Manuka:
    Group theory, for one.

    If the structure has both proper addition and multiplication operations, it's a ring.

    https://en.wikipedia.org/wiki/Ring_(mathematics)

    Multiplication is necessarily an associative operation, and it needs to be distributive with respect to the ring's addition operation (which itself needs to be associative and commutative).

    I suppose you could call other things multiplication, but for the most part that would be the mathematical equivalent of a Humpty-Dumpty-ism: claiming that words mean what you mean them to mean, and not necessarily what anyone else understands by them.

  • (disco) in reply to accalia
    accalia:
    Not enterprisey enough
    const string zero0 = "";
    const string zero1 = zero0 + "0";
    const string zero2 = zero1 + "0";
    const string zero3 = zero2 + "0";
    const string zero4 = zero3 + "0";
    const string zero5 = zero4 + "0";
    const string zero6 = zero5 + "0";
    [elided to prevent post text overflow. thank discourse for that. 
    i was going to make you scroll for the whole thing]
    const string zero4094 = zero4093 + "0";
    const string zero4095 = zero4094 + "0";
    const string zero4096 = zero4095 + "0";
    

    Of course the way you would write this enterprisey solution in Perl 5 is:

    use 5.010;
    use strict;
    use warnings;
    use feature 'say';
    
    use constant zero0 => '';
    
    BEGIN {
      for (1..4096) {
        # use constant zero1 => zero0 . 0;
        # use constant zero2 => zero1 . 0;
        # use constant zero3 => zero2 . 0;
    
        my $prev = \&{"main::zero@{[ $_ - 1 ]}"};
        constant->import( "zero$_", $prev->() . 0 );
    
        # no strict 'refs';
        # constant->import( "zero$_", &{"zero@{[ $_ - 1 ]}"}() . 0 );
      }
    }
    
    my $s = zero4096;
    say length $s; # 4096␤
    

    In Perl 6

    use v6;
    
    # no real reason to declare it as a Str because it is a constant
    our Str constant \zero0 = '';
    
    BEGIN for 0 ^.. 4096 {
      # I'm not sure how to do this without using an EVAL
      EVAL qq:!b "our Str constant \zero$_ = zero{ $_ - 1 } ~ 0";
    }
    
    # Str does role Stringy, as does other string like types
    my Stringy $s = zero4096;
    say chars $s; # 4096␤
    

    I would advise against running this though, as it is currently quite slow while compiling with Rakudo, not to mention the memory bloat of all of those string objects.
    This is most likly in part due to Perl 6's Normalization Form Grapheme string representation which effectively requires at least 32 bits per character.
    (Implementations may be able to cheat where they can get away with it)


    Although any decent Perl 5/6 programmer would write it as:

    my $s = '0' x 4096;
    

    If it was actually supposed to be a binary string of 4096 nulls they might write it as:

    my $s = pack 'x' x 4096;
    

    Although in Perl 6 it may be more time efficient to write it as:

    my $s = Buf.new: 0 xx 4096;
    
  • (disco)
    1. [image] says that the new zero == 1.
  • (disco) in reply to b2gills
    b2gills:
    `no strict 'refs';`

    If you have to use this to do something, it is a strong indication that whatever you're about to do, you probably shouldn't.

  • (disco) in reply to HardwareGeek
    HardwareGeek:
    If you have to use thisPerl to do something, it is a strong indication that whatever you're about to do, you probably shouldn't.

    I feel cheap.

  • (disco) in reply to Magus

    https://what.thedailywtf.com/uploads/default/original/3X/0/c/0c91ace6f8109ef39af8239fa6a1d03e429c791c.png

    What is that thing and why do I hate it?

  • (disco) in reply to blakeyrat

    What's with the deliberate helplessness? Five seconds with Google answers your first question. A psychiatrist would be needed for the second.

    http://megaman.wikia.com/wiki/Trumpy

  • (disco) in reply to another_sam

    The blue one, Tuby, is the one on the battle chip Discord.

  • (disco) in reply to Magus
  • (disco) in reply to blakeyrat

    Yes, it has to do with someone that color!

  • (disco)

    Errr....

    [image]
  • (disco) in reply to sloosecannon

    Off-center phone layout? Yeah, that's weird. Zeroes going offscreen? Probably on purpose.

    But mostly, some moron isn't using Edge on 10. :wtf:

  • (disco) in reply to FrostCat
    FrostCat:
    In Japan? Kairosoft has ported (I assume) all their 240x320 dumbphone games via some kind of emulator to Android rather than rewrite them.

    I don't know if this has been fixed since I last played it, but Game Dev Story would instantly quit, no prompt, no save, whenever you hit the back button.

  • (disco) in reply to Magus

    Eh, it's OK but it's missing things I need. Namely AdBlock and LastPass. So I'm sticking with chrome for now

  • (disco) in reply to dkf

    And here I am, still wondering why the most WTFs of a WTF article are always found in the comments...

    Just because there are rings, this invalidates all conventions for groups? What kind of logic is that?

    For string composition we actually have a monoid, because there is no inverse element. But still the conventions for * and + for non-commutative and commutative algebras apply here.

  • Jack (unregistered)

    For somebody who doesn't know that the String constructor takes a second parameter, this is a pretty reasonable mistake, especially if they're using a vi/emacs macro.

Leave a comment on “The New Zero”

Log In or post as a guest

Replying to comment #:

« Return to Article