• Forum
  • Lounge
  • Computerphile's video about Imperative v

 
Computerphile's video about Imperative vs Functional

https://www.youtube.com/watch?v=sqV3pL5x8PI

Besides the obvious (and trivial) mistake with commas instead of semicolons, what are your thoughts?

I don't really have much to say but I'm interested what some of you more seasoned programmers have to say.
closed account (o1vk4iN6)
A bit pointless spending that much time comparing languages about summations when anyone with a mathematical background would just use (n(n+1)) / 2.
So to sum[10..20] I use (n(n+1))/2 ?
The C++ way is accumulate(boost::irange(10, 20), 0); :)
I don't see how that was called for but ok ;p
closed account (1yR4jE8b)
The thing that stuck out for me was that he started his Java loop at 0, so his first iteration was completely wasted.

I've been doing lots of ruby lately, which also has lots of functional style things in it.

(1..10).reduce(:+)
@LB I was trying to illustrate that folding transcends paradigms.

As for the video, it takes a whole lot of time to say very little of substance and partially misrepresents both paradigms. As much as I love pattern matching (why did Haskell designers have to limit it so much! ), it's not a defining or even common characteristic of functional programming.
Topic archived. No new replies allowed.