The Most Average Function There Is - Andrei Alexandrescu

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ค. 2024
  • What makes a programming language desirable for you? There is no right or wrong answer; ten people may have eleven different reasons. And that's brilliant.
    This talk discusses a few possible takes on the question - things like affiliation to mathematics, intuitive looks, good introspection, and proportional response. Along the way we try to implement literally the most average function there is, and take an irreverent look at how a variety of languages would implement it idiomatically. Don't attend if you're easy to offend. Above all, don't forget: your notion of what makes a language good may be different. And that's brilliant.
    Save the date for NDC TechTown 2020 (31st of August - 3rd of September)
    Check out more of our talks at:
    ndctechtown.com/
    www.ndcconferences.com/
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 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"

  • @per.nordlow
    @per.nordlow 2 ปีที่แล้ว

    Thank you, Andrei.

  • @madpad759
    @madpad759 3 ปีที่แล้ว

    This is a really great talk.

  • @dodsjanne
    @dodsjanne 2 ปีที่แล้ว

    Great talk! D rox!

  • @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

  • @leffivanov3127
    @leffivanov3127 4 ปีที่แล้ว +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 4 ปีที่แล้ว +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?

  • @olleharstedt3750
    @olleharstedt3750 2 ปีที่แล้ว +1

    No average of complex numbers?

  •  4 ปีที่แล้ว +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 4 ปีที่แล้ว +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.