The Most Average Function There Is - Andrei Alexandrescu

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 32

  • @gordian99
    @gordian99 3 роки тому +10

    His comments starting at the 54 minute mark really hit home. "I want work to be visibly done in code." He talks about looking at a the C++ standard library implementation of a red/black tree and seeing that the "is red" flag was stored in the last bit of a pointer (to a node apparently) in order to save space. But when he, then, spent 15 minutes trying to figure out where the flag was being set, he couldn't. "You don't know where work is being done. Crack open boost. Crack open GCC. You don't know where work is being done"

  • @leffivanov3127
    @leffivanov3127 5 років тому +16

    The funny and at the same time sad thing about this talk is that a lot of people care about Rust because of as Andrei said "great marketing" and so few (in comparison with Rust) people care about D.

    • @BatmanAoD
      @BatmanAoD 5 років тому +1

      Rust and D are quite different, though, and there are many reasons to care about one or the other but not both.

    • @user-ov5nd1fb7s
      @user-ov5nd1fb7s 4 роки тому +4

      I would suggest that people care about Rust because it works and it's memory management is superior to anything else out there.

    • @VioletGiraffe
      @VioletGiraffe 4 роки тому +2

      @@user-ov5nd1fb7s, that is highly opinionated.

    • @user-ov5nd1fb7s
      @user-ov5nd1fb7s 4 роки тому

      @@VioletGiraffe ok, let's say that it's up there with the best. The point is that it's not "all marketing".

    • @GeorgeTsiros
      @GeorgeTsiros 3 роки тому +2

      rust lost me when the first, literally the absolute first, rust statement that is shown in the introduction ( doc.rust-lang.org/book/ch01-02-hello-world.html ) is a _fucking macro_ . Seriously, who thought it was a good idea?

  • @per.nordlow
    @per.nordlow 2 роки тому

    Thank you, Andrei.

  • @TheDarkOne629
    @TheDarkOne629 4 роки тому +2

    Thanks for the great talk. Now let's get me fired from my job.
    Calculates the average of a sequence of numbers in a lisp without getting the size twice:
    ```
    (defn avg
    [numbers]
    (if (empty? numbers)
    0
    (apply /
    (reduce
    (fn [[sum cnt] num]
    [(+' sum num) (inc' cnt)])
    '(0.0, 0)
    numbers))))
    ```
    The +' and inc' functions do automatic conversion into bigger types (BigDecimal and BigInteger in this case) as necessary. The whole monster still only works on numeric types that Clojure supports.
    It's probably the same as the Haskell code you showed, but I can't read that.

    • @TheDarkOne629
      @TheDarkOne629 3 роки тому +1

      @FichDich InDemArsch Cooler Name. Sehr erwachsen. :D

  • @madpad759
    @madpad759 4 роки тому

    This is a really great talk.

  • @dodsjanne
    @dodsjanne 2 роки тому

    Great talk! D rox!

  • @olleharstedt3750
    @olleharstedt3750 3 роки тому +1

    No average of complex numbers?

  •  5 років тому +9

    Although I have great respect for Mr. Alexandrescu I found the talk very difficult to follow and to understand the points that he was trying to make. There are a lot of small minutia which can be had even in such a small and simple function as a function to compute average and I expected some sort of comprehensive (or concise) overview of how each language does it according to parameters set by Mr. Alexandrescu ... however this did not happen (at least as far as I can see).
    I think that some more preparation should have gone into the talk. As it is, I find that it is mostly oriented towards being (slightly) provocative and (somewhat) funny but too confusing to enjoy.

  • @Voy2378
    @Voy2378 5 років тому +8

    Alexandrescu is turning into a Stepanov... ranting old man... Algorithm he criticizes can sum 1000 of INT_MAX/5 values without overflow, his simple for loop can not.