Comment

Comment by codesections

I just saw the code you added; here's a pretty literal translation into Raku in case you're curious (I'm assuming that `<blog posts objects>` is a stand in for omitted code)

    my @arr = [blog_post_objects];
    
    # Author may be Nil
    my $author-count = +arr.map(*<author>).grep(*.defined).unique;
(Though note that this would only exclude undefined authors. In most situations, I'd probably either know that all defined authors are truthy (e.g., an object) or would want to exclude the falsy ones as well (e.g., empty string). in that case I'd use `.grep(?*)` save a few characters.)

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton