Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data for Erann Gat's chellenge (phone numbers & dictionary).

3 views
Skip to first unread message

Szymon

unread,
Nov 15, 2004, 12:04:55 PM11/15/04
to

Hi.

Please send me (data[*] or link) to oryginal data.

I wrote solution but I do not have any data to test
and measure it.


[*] 1) file with words.
2) file with phone numbers.

3) file with solution (numbers + words not code).

(3) -> because I think I misundersood the chellenge.
My solution is too short, and I wrote it too
fast.

TIA, Szymon.

;;; *NOT TESTED AS WHOLE* _must_ have bugs...

(defpackage "WORDS" (:use "WORDS"))
(defun DO-IT (&key (words-file "dictionary.txt")
(numbers-file "phone-numbers.txt")
(->file "chellenge-output.txt"))
(labels ((word2num (word)
(loop for c across (delete-if-not #'alpha-char-p word)
for r = (+ 10 (char2num c)) then (+ (* 10 r) (char2num c))
finally (return r)))
(char2num (char)
(position-if (lambda (x) (find (char-upcase char) (symbol-name x)))
#(E JNQ RWX DSY FT AM CIV BKU LOP GHZ))))
(with-open-file (s words-file)
(loop for word = (read-line s nil) while word do
(setf (symbol-value (intern (string-upcase word) "WORDS")) (word2num word)))))
(let ((pnums (make-hash-table))
(num-list (with-open-file (s numbers-file)
(loop for num = (delete #\- (read-line s nil)) while num
collect (parse-integer num)))))
(do-symbols (s "WORDS")
(dolist (i (remove-if-not (lambda (n) (eql (symbol-value s) n)) num-list))
(push s (gethash i pnums))))
(with-open-file (s ->file :direction :output :if-exists :overwrite :if-does-not-exist :create)
(maphash (lambda (num lst) (format s "~A: ~{~A~}~%" num lst)) pnums))))

David Sletten

unread,
Nov 17, 2004, 3:22:25 AM11/17/04
to
Szymon wrote:

> Hi.
>
> Please send me (data[*] or link) to oryginal data.
>

In case you missed it, he's changed his name:
http://www.flownet.com/ron/eg-rg-faq

David Sletten

Pascal Bourguignon

unread,
Nov 17, 2004, 11:00:56 AM11/17/04
to
David Sletten <da...@slytobias.com> writes:

Indeed, better to refer him as the lisp programmer formerly known as Erann Gat.
;-)

--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.

Christopher C. Stacy

unread,
Nov 17, 2004, 2:02:54 PM11/17/04
to
Pascal Bourguignon <sp...@mouse-potato.com> writes:

> David Sletten <da...@slytobias.com> writes:
>
> > Szymon wrote:
> >
> > > Hi.
> > > Please send me (data[*] or link) to oryginal data.
> > >
> > In case you missed it, he's changed his name:
> > http://www.flownet.com/ron/eg-rg-faq
>
> Indeed, better to refer him as the lisp programmer formerly known as Erann Gat.

What symbol does he use?
(And can it be written without Unicode?)

Ron Garret

unread,
Nov 18, 2004, 9:48:01 PM11/18/04
to
In article <876547j...@eva.rplacd.net>, Szymon <r5z-u2...@o2.pl>
wrote:

> Hi.
>
> Please send me (data[*] or link) to oryginal data.

I'm just heading out of town and I'll be off line until December 8, but
if you haven't managed to find a copy before then drop me a line and
I'll dig the files out of my archives.

rg

Thomas Gagne

unread,
Feb 8, 2005, 11:08:58 PM2/8/05
to Ron Garret
Did anyone get the data yet? Remove the dashes from my email address and
please email!

Ron Garret

unread,
Feb 9, 2005, 3:36:12 AM2/9/05
to
In article <42098CDA...@wide-open-west.com>,
Thomas Gagne <tga...@wide-open-west.com> wrote:

> Did anyone get the data yet?

Due to popular demand (two people have asked for it now) I've posted it
on the Web:

http://www.flownet.com/ron/papers/lisp-java/

rg

0 new messages