Hacker News new | ask | show | jobs
by hlieberman 3398 days ago
I mean, if you want something really compact, why not APL?

      +/{(0=2|⍵)×⍵*2}⍳4
20

Edit: My point here, besides simply the joy of trolling, is that "compactness" isn't a great metric for analyzing a programming language, or a framework even. My APL example isn't very compact for APL, yet it's certainly /way/ more compact than the Python, Elixir, or Ruby versions.

Still, it's hardly comprehensible to me as a beginner APL programmer -- and I wrote it, just now. It's probably /completely/ incomprehensible to anyone who hasn't written APL before. Is APL still "better", going only by compactness?

1 comments

The same in J:

    +/*~((0&=&(2&|))@:[#])(1+i.4)
    20
It's longer than APL version, but still cute! :)