Perl One-Liner Screw

By Xah Lee. Date:

The Glauber [theglauber@my-deja.com] wrote:

P.S.: the Perl version is a "one liner":

$c{substr($_,0,5)}++; END { foreach $x (sort keys %c) {print "$x,$c{$x}\n"}}

Screw you with your screwing “one-liner”.

Erik Naggum [erik@naggum.net] wrote:

Perl looks the way it does because 110-baud Teletypes were once upon the time the best people had on Unix, and with lousy typers who had to correct their mistakes all the time, it made sense to abbreviate everything down to one or two characters. Lisp has a different heritage, to put it mildly: Better typers, better use of brainpower than to remember thousands of subtly similar abbreviations, better terminals. So we aren't as interested in one-liners with compact syntax, but for people who still live their lives as if all they can hope for is a 300-baud Teletype, the value of one-liners cannot be underestimated.

Oh gee, Erik, thanks: Screw you with your knee-jerking lame-o defense.

I have a screwing problem with screwing Perl folks with their screwing fatuous infatuation about “one-liners”.

Mr Glauber, can you explain to me what does “one-liners” mean?

Does it mean a program with no line-breaking character? Obviously not, because otherwise lots programs can instantaneously become one-liners. Does it mean a program with one syntactic block? Not, obviously because coating it with curly bracket doesn't cut it. Does it mean the program is within 80 characters? No, because that would be stupid, wouldn't it?

So it really cannot be defined syntactically, but with some conceptual involvement. Perhaps a smattering of all of the above, plus that the data flows through the program in some kind of one fell swoop idiom.

I'll tell you what: all programs in pure functional languages are all just one big single line by principle, and much in practice. (lisp is one example.)

your screwing one-liner hack done right should be:

(Sort[#,(OrderedQ@{Part[#1,1],Part[#2,2]})&]&)@
  MapIndexed[({#2,StringTake[#1,5]}&),input]

or in FullForm:

Function[Sort[Slot[1],Function[OrderedQ[List[Part[Slot[1],1],Part[Slot[2],2]
]]]]][MapIndexed[Function[List[Slot[2],StringTake[Slot[1],5]]],input]]

The above example is from Mathematica. This cannot be done in Perl because it lacks gazillion build-in FUNCTIONS. But if one forces, you get:

#/usr/local/bin/perl
use strict; #oh my god, superb correct obfuscation but using strict too!
map {print "$_->[0], $_->[1]\n";} sort {$a->[1] cmp $b->[1]}
@{ &{sub {my @result; for( my $i=0; $i < scalar @{$_[0]->[0]}; $i++)
{push @result, [$_[0]->[0]->[$i],$_[0]->[1]->[$i]]} return \@result}} (
&{sub {return [[1.. (scalar @_)], [@_]]}} (map {substr($_,0,5)} <>)) };
__END__

That's how stupid (and inefficient) Perl really is if you want to do things correctly. (Note: in order to do a transposition on a 2D array, i couldn't avoid the variables @result and the for loop with $i.)

And by the way: idiomatic programing is the most screwing moronic idea too, and not so incidentally, very much exhorted by Perl-brain-washed retards.

I will have any perlers cut their own tongue, when they blurt out their screwing ass ignorance with Perl.

The three principle virtues of Perl programers: mundaneness, sloppiness, and fatuousness —Xah Lee

This article is originally a newsgroup post:

From: Xah Lee <xah@xahlee.org>
Newsgroups: comp.lang.lisp
Subject: Re: Q: on hashes and counting
Date: Mon, 06 Nov 2000 02:28:07 -0800
Message-ID: <B62BC7B7.3CBD%xah@xahlee.org>

Source groups.google.com