open(F,"find -type f|");
while (<F>) {
$_ = substr($_,2,-1);
print "$_\n" if $v;
push @{$dups{substr(`md5sum -b "$_"`,0,31)}}, $_;
}
close(F);
for every file in a directory it checksums the file, then adds the checksum as a key to a hash, the value being an array reference. the filename is then added to the array.
so basically the arrays have a list of files with the same checksum. i use this to find duplicates files.
(Forth for teh win! ) : add-one 1 + ; 1 add-one . ( n1 -- n2 )
Name:
Anonymous2006-01-15 6:51
>>86
Bump for Forth. I recently bought a Sparcstation and was well amused when I found that the boot prom was a goddamn forth interpreter :D
Name:
Anonymous2006-01-16 17:39
It's too bad Forth is on the highway to irrelevance. Other than a tiny embedded niche, is it used anywhere anymore?
Name:
Anonymous2006-01-16 18:32
n=gets.to_i;a=(2..n).to_a;a.each{|m|puts m; (m*2).step(n,m){|j|a.delete j}}
Name:
Anonymous2006-01-16 18:52
// I can guarauntee that the following is a variation of the very first "program" you wrote:
int main()
{
cout<<"Hello World"<<endl;
return 0;
}
Name:
Anonymous2006-01-16 20:26
10 ? "HELLO WORLD"
Name:
Anonymous2006-01-17 3:09
>>88
Truth. Still, how many people use a language doesn't have any bearing on how fun it is for you personally. And Forth is damn fun; it's like a low-level Lisp.
Name:
Sakamura2006-01-17 19:06
int total = 0;
for(int i=0; i < multiplier.itemCount(); i++)
{
total = Interger.parseInt(multiplier[i]) / i;
}
return total;
Name:
Anonymous2006-01-18 8:50
a: CALL 01404E20h ;Reference to Kernel.GrabPorn
JMP a
Name:
Anonymous2006-01-23 23:20
umm, so you all know that there is a solution to the recurrence relation for the fibonacci numbers right?
What is CS so obsessed with fibonacci numbers? It's used as an example everywhere.
Name:
Anonymous2006-01-24 6:45
Fib is a simple example of recursion, so all beginning textbooks like to cover it. Never mind the fact that there are much more useful examples of recursive functions, like recursive descent parsers.
Name:
Anonymous2006-01-24 8:36
>>99
Correction: fib is a great example of how it can be a disaster to define something recursively.
"First we define fib like this, recursively. Makes sense, right? But ZOMG, it is insanely inefficient!!!!111oneeleven! But look, all we have to do is use this accumulation variable and everything is all right!"
And then the student goes away thinking recursion is all about accumulation vars.
Name:
Anonymous2006-01-24 8:59
>>101
I went away thinking recursion sucked, and used iteration for everything for the next 5 years.
Name:
Anonymous2006-01-24 9:46
there are libraries nowadays that handle memoization of recursive functions for you, which helps take care of the inefficiency..
Name:
Anonymous2006-01-24 15:39
>>103
they are not as efficient as the iteration obviously
Name:
Anonymous2006-01-25 10:51
>>103
"memoize" is such a dumb sounding word
stop sucking MJD's dick
Name:
Anonymous2006-01-28 14:50
Computes arbitrarily large Fibonacci numbers in Brainfuck, I didnt write it: