Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: vandys@vsta.org Newsgroups: comp.lang.forth Subject: Re: mr paysan where is your chip? Date: 16 Oct 2012 20:27:13 GMT Lines: 44 Message-ID: References: <6bef0964-011f-4020-9d31-f7c887a52946@googlegroups.com> <4626464.gGs9T4UXBT@sunwukong.fritz.box> <51932083.Wq75TzlriR@sunwukong.fritz.box> <5582590.oV2Wc04zOP@sunwukong.fritz.box> X-Trace: individual.net h6XFq0jZmtSa94wrph94Zw0EzOS+IZcnS5mJGJtLTym18ZveFnkfMVCFwfNLXZzOx+ X-Orig-Path: not-for-mail Cancel-Lock: sha1:3VNpLiAVjp0rwZ66PstoaeN0KDA= User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (Linux/3.2.0-32-generic-pae (i686)) Xref: csiph.com comp.lang.forth:16360 rickman wrote: > Are you suggesting that it just *sucks*??? For more and more applications, it would be the Wrong Choice. I just quickly typed in the following, which tallies use of words in input text, and then reports by word and then by count of incidences. I didn't have to think about word length limits or number of word limits, nor did I have to fuss with storage allocation and recovery. I used just low level Python data structures, not any prebuilt higher level classes. Languages need to climb a curve of expressiveness (generators and lambda were later additions to Python). At some point, they become unwieldy to further evolve, and then you look for the best points to carry forward into a new generation of programming language. Forth did OK as it evolved in place. We're to the point where it really needs to have its best bits carry forward to something new. I can't say how to do that; every time I attempt the exercise I map out something which sucks. The thing which is needed is obvious by its absence. Andy Valencia ================================== import sys res = {} for l in sys.stdin: for w in l.split(): res[w] = res.get(w, 0) + 1 print "Sorted by word:" for w in sorted(res.keys()): print w, res[w] print "Sorted by incidences:" for w,count in sorted(res.iteritems(), key=lambda tup: tup[1]): print w, count -- Andy Valencia Home page: http://www.vsta.org/andy/ To contact me: http://www.vsta.org/contact/andy.html