Hacker News new | ask | show | jobs
by pcwalton 2405 days ago
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!