Hacker News new | ask | show | jobs
by nielsbot 1384 days ago
maybe off-topic, but I think the Swift version looks nice:

    words.filter { WORDS.contains($0) }.forEach { w in
        ...
    }
1 comments

And then php:

    array_map(fn($match) => print($match), array_filter($words, fn($_) => in_array($_, WORDS)));
or less verbosely:

    array_map(fn($match) => print($match), array_intersect($words, WORDS));