Hacker News new | past | comments | ask | show | jobs | submit login

Can you solve the exact same problem using Python list comprehensions or Rust iterators?

I'd like to see how solving this same problem in those languages is less of a nightmare.

I personally find that C loop quite readable compared with the same iteration being done in Rust.




This is a sum of absolute differences, so in Rust:

    let satd = d.iter().cloned().map(abs).sum();
As an added bonus, there's no undefined behavior!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: