Fair point but I didnโt use the comma because I was golfing. I did it because it was a one-liner that might be retyped and I didnโt want confusion between braces and parens when theyโre being eyeballed in the default #Mastodon proportional font (Roboto) or worse.
Gene Boggs
in reply to Ned Batchelder • • •HAMMER SMASHED FILESYSTEM ๐บ๐ฆ
in reply to Ned Batchelder • • •in #Perl that's 'print "2024\n"'
๐
Mark Gardner
in reply to HAMMER SMASHED FILESYSTEM ๐บ๐ฆ • • •Mark Gardner
in reply to Mark Gardner • • •@lkundrak But if you wanted to be cute like @nedbatโs #Python example, the #Perl one-liner is:
perl -MList::Util=sum -E 'say sum map $_ ** 3, 2..9'
Paul Evans
in reply to Mark Gardner • • •@mjgardner @lkundrak It may "waste" a character but i'd always write that as
map {$_**3} 2..9
because the braces make the deferred nature of the map expression really obvious. The comma form is way too subtle for casual users.
Mark Gardner
in reply to Paul Evans • • •Fair point but I didnโt use the comma because I was golfing. I did it because it was a one-liner that might be retyped and I didnโt want confusion between braces and parens when theyโre being eyeballed in the default #Mastodon proportional font (Roboto) or worse.
/cc @lkundrak, @nedbat
Paul Evans
in reply to Mark Gardner • • •