Scripsit ille aut illa ristan (kesuari) <THE-THING-IN-BRACKETS-IN-MY-NAME / yahoo.com.au>:
> Rudolf Polzer wraet:
> > Scripsit ille aut illa oug Kearns <djkea2 / mugca.its.monash.edu.au>:
> >>http://groups.yahoo.com/group/judoscript/message/295
> > 
> > What does stand there? I get a cyclic redirect.
> 
> Copy-paste with selected headers.

Thanks.

> -----------wc.judo-----------------------------
> 
> do #args[0] as lines {
> ::lines++;
> ::words += $_.split('\\S+').length();
> ::chars += $_.length;
> }
> . lines, ' ', words, ' ', chars;

OK, looks "usual" and does only take memory for one line (?).

> ------------wc.ruby---------------------------------------
> 
> nl = nw = nc = 0
> loop do
> data = (STDIN.read(4096) or break) << (STDIN.gets || "")
> nc += data.length
> nl += data.count("\n")
> ((data.strip! || data).tr!("\n", " ") || data).squeeze!
> nw += data.count(" ") + 1
> end
> puts "#{nl} #{nw} #{nc}"

Wtf? Is that the "How to do it the most complicated way" contest?

lines = words = chars = 0
ARGF.each_line() do |l|
  lines += 1
  words += l.split(/\s+/).length()
  chars += l.length()
end
puts "#{lines} #{words} #{chars}"

SAME code. The only difference is the initialization at the top.

Yes, we already know the "optimized for size" version of that.
  
> ------------wc.perl----------------------------------------
> use strict;
> 
> my($nl, $nw, $nc);
> while (read(STDIN, $_, 4095)) {
> $_ .= <STDIN>;
> $nl += scalar(split(/\n/));
> $nc += length;
> $nw += scalar(split);
> }
> print "$nl $nw $nc\n";

use strict;
my ($lines, $words, $chars) = (0, 0, 0);
while(<STDIN>)
{
  ++$lines;
  $words += split /\S+/, $_;
  $chars += length $_;
}
print "$lines $words $chars\n";

Again: the SAME code. So where does Judo make a difference here?


-- 
Beelzebub has a devil put aside for me