@pomlover

Mindbending, brilliant. After watching this talk, I need a vacation to recover.

@ruslany28781

I enjoyed the talk very much. I feel like 70-x assembler programmers may have felt when were shown higher level programming language. To understand how it works they had to compile the program in their mind to grasp how it works. I find myself compiling declarative to imperative C++ while watching the talk. It is so elegant and beautiful. Thank you!

@petergoldsborough389

Amazing speaker, so smooth, so nice to follow.

@nithishchauhan9937

Excellent work.... I really liked it... No loops, No states ,No if, Correct by construct. Super awesome.

@jjurksztowicz

Lex Luthor teaches C++ developers how to really use the STL... Ha! Kidding, great talk, great looking code. It'll take a while to paradigm shift, but D has shown this to be a very, very viable option for the future of the STL.

@Abdalic

Big thanks, been wating for F# seq in C++ for a long time........ and it's worth it !!!

@InXLsisDeo

This is functional programming style. The calendar example is a little contrived, but Eric Niebler used it to show off the power of the ranges concept. In real production code, you don't want to write all your code like that because even if it's very compact, it may be hard to read. However, whenever you have to do successive operations on whole ranges, this writing becomes easy to read because you reason on the whole tabular structure, you don't have to mess with iterators.

@PavloD-n6k

Thank you for sharing the videos from the conference!

@JonathanGeisler

Why doesn't the for_each in the interleave count as a loop?  We have to loop through all the different iterators to increment them when the outer iterator reaches the end of a row, so this seems like a loop to me.

@solderbuff

04:59 – oh, wow. Didn't know there is an influence of APL on C++11.

@VictorChavesVVBC

I think he meant for loops in the date generation logic, not in the output part.

@michaelchadwick1820

For the same reason the copy at the very top doesn't count as a loop--it's not a *raw* loop, where the user code is controlling the conditions and state of the loop.

@tosemusername

Expressively complex. But it's a library addition, so I'm more than happy to have it.

@jojo2150jofalschgesc

C++ may be a very old horse but it's certainly alive.

@cgoobes

They really need to CC these.

@digama0

Tried this challenge in haskell. Got it right on the first try (not counting compile errors), 36 lines. C++ functional style just can't compete with the real thing.

import Data.List
import Control.Monad.State.Strict

months :: [(String, Int)]
months = [
  ("January", 31), ("February", 28), ("March", 31), ("April", 30),
  ("May", 31), ("June", 30), ("July", 31), ("August", 31),
  ("September", 30), ("October", 31), ("November", 30), ("December", 31)]

layout1 :: (String, Int) -> Int -> ([String], Int)
layout1 (m, n) day = (header : map render (rows day n), (day + n) `mod` 7) where
  header =
    let w = length m
        left = 10 - w `div` 2
        right = 21 - w - left
    in replicate left ' ' ++ m ++ replicate right ' '
  rows :: Int -> Int -> [[Maybe Int]]
  rows day n = res ++ replicate (6 - length res) (replicate 7 Nothing) where
    xs = replicate day Nothing ++ map Just [1..n]
    res = go (length xs) xs
    go n ys | n <= 7 = [ys ++ replicate (7 - n) Nothing]
    go n ys = let (left, right) = splitAt 7 ys in left : go (n - 7) right
  render :: [Maybe Int] -> String
  render = concatMap go where
    go Nothing = "   "
    go (Just n) | n < 10 = " " ++ show n ++ " "
    go (Just n) = show n ++ " "

main :: IO ()
main = mapM_ putStrLn lines where
  layouts :: [[String]]
  layouts = evalState (mapM (state . layout1) months) 4
  chunks :: [[[String]]]
  chunks = takeWhile (not . null) $ unfoldr (Just . splitAt 3) layouts
  lines :: [String]
  lines = concatMap (map (intercalate " ") . transpose) chunks

@BurakovAS

@Nami Doc, why would it be undefined?

@ref2401

Dlang rocks!

@Ven_de_Thiel

44:33 isn't that "(++n_) %= ..." undefined behavior? :/

@dasnacl

The greater zero check shouldn't be existing as runtime check only, there should be some static error, too