|There's more than one way to do things|
Re: FP languages have a bottom-up bias?by BrowserUk (Pope)
|on Jun 27, 2005 at 22:59 UTC||Need Help??|
Yep! There are several possible explainations I guess.
Perhaps you could show me the steps you would take to tackling the sort of problem I have been trying to get to grips with?
For the purpose of the exercise, I decided to index the words in a bunch of files. To get a start on the exercise, in Perl, I decided to just count the words, here simply defined as whitespace delimited groups of characters, and write the results to a file. This allows me to get something going and I can then work on refining the definition of a "word" and and decide how I am going to store the index.
My first attempt at writing this program (from scratch, just now) was:
I then ran a quick sanity check:
So far, so good. Now try it out:
Whoops! A quick look and I see I missed out the keyword pop in line 14:
Okay, I've got 1 file with bad permissions in the directory. And what ended up in words.index?
Okay. The word definition is ecclectic, but is seems to be doing what I set out to do, now I can start to refine it. Not a bad start for 10 minutes coding.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.