Re: Feeling stupid..
- From: "Maria R" <Maria.Reinhammar@xxxxxxxxxxx>
- Date: 29 Oct 2006 23:24:55 -0800
Thanks!
As I suspected, I had good reason for feeling a little bit stupid.. :o/
Shows how one can become blind for the obvious..
Also, what I meant with trivial, in Python (not a critique about
Prolog, just a mere observation ;o) :
def readAndCount(fd):
histo = dict()
for line in fd:
for token in line.split(' '):
histo[token] = not histo.get(token) and 1 or histo[token]
+1
return histo
def wc(filename):
return readAndCount(open(filename, "r"))
Regards//M
.
- Follow-Ups:
- Re: Feeling stupid..
- From: Markus Triska
- Re: Feeling stupid..
- References:
- Feeling stupid..
- From: Maria R
- Re: Feeling stupid..
- From: Markus Triska
- Feeling stupid..
- Prev by Date: Re: Prolog Visualizer
- Next by Date: Re: Feeling stupid..
- Previous by thread: Re: Feeling stupid..
- Next by thread: Re: Feeling stupid..
- Index(es):
Relevant Pages
|
|