4 ms·
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 "compa
by hlieberman 10y 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?
- klibertp 10y agoThe same in J: +/*~((0&=&(2&|))@:[#])(1+i.4) 20 It's longer than APL version, but still cute! :)