The Most Average Function There Is - Andrei Alexandrescu

preview_player
Показать описание
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:
Рекомендации по теме
Комментарии
Автор

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"

gordian
Автор

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.

TheDarkOne
Автор

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.

leffivanov
Автор

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.

Автор

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.

Voy