Hacker News new | ask | show | jobs
by nilliams 3742 days ago
Both are fairly unintelligible to me (probably partly due to my lack of interest in prime numbers), so it seems like splitting hairs to draw comparisons, but if I had to figure out what was going on, I'd rather be staring at this (~ES6):

    range(2, 100).filter(p => {
  
        // I'd probably stick a comment here to explain this ...
        // I'd split out this whole section into a named function once I understood it.
        return range(2, p)
            .map(q => p % q != 0)
            .all();

    })
I don't feel like I could iterate on understanding this problem so well in Python because I have to reach for one of 2 seemingly inferior solutions (list comprehensions or borked lambdas).