Re: mental hashing for paper address books (with Python)
Dave Long <[email protected]>
| Newsgroups | gmane.culture.people.kragen.discuss |
|---|---|
| Message-ID | <[email protected]> |
> ... but alphabetized
> address books on paper are a pain because moving entries up and down
> the page to insert a new entry is, at best, very time-consuming.
At some point I was reading an old book on pre-automation business
practices, and found that at least some enterprises had developed a
hashing system exactly in order to prevent contention in front of
physical cabinets by the filing clerks. Can't recall what they
called the technique then, however.
-Dave
PS. better environment management; unf. render is not quite foldl1:
#!/usr/bin/python
"Telegram problem, aka fmt."
bol = lambda s : ('\n'+s).rfind('\n')-1
render = lambda f,ws : reduce(f,ws[1:],''.join(ws[:1]))
tgram = lambda f,max : render(lambda s,w: s+" \n"[len(s+w)-bol(s)>max]
+w,
f.read().split())
if __name__ == '__main__':
import sys
print tgram(sys.stdin,72)
--
To unsubscribe: http://lists.canonical.org/mailman/listinfo/kragen-discuss