J
Jim Weirich
I cranked out a quick bit of ugly code (see
below). Obviously it's crude -- e.g., it doesn't
take note of strings or comments (and it's not
clear what it should do if it did).
I did something like this a while back when a Java programmer complained
about all that "line noise" in Ruby. I pointed out that Java used much
more puncuation than the typical Ruby program and wrote the following
program to demonstrate...
#!/usr/bin/env ruby
ARGV.each { |fn|
noise = open(fn) { |file| file.read }.gsub(/[A-Za-z0-9_ \t\n]/m, "")
puts "#{fn} (#{noise.size}): #{noise}"
}
Runnnig this over a set of programs written in different languages
gives...
animal.cc (83):
#<>{)=;};:{);};:){::<<"\";}:{);};:){::<<"\";}(){*[]={,};(=;<;++)[]->();;}
Animal.java (67):
{{();}{(){..("");}}{(){..("");}}([]){[]=[]{(),()};(=;<.;++)[].();}}
animal.pl (41): ;{{};}{"\";};{{};}{"\";};$(->,->){$->();}
animal.py (23): ):""):""[(),()]:.()
animal.rb (10): """"[.,.].
Onestepback.org is down at the moment, but I'll post the code for all
the animal programs there when it comes back online.