From: Szymon
Subject: Data for Erann Gat's chellenge (phone numbers & dictionary).
Date:
Message-ID: <876547jb60.fsf@eva.rplacd.net>
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))))
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
David Sletten <·····@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.
;-)
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.
From: Christopher C. Stacy
Subject: Re: Data for Erann Gat's chellenge (phone numbers & dictionary).
Date:
Message-ID: <uvfc4fgdd.fsf@news.dtpq.com>
Pascal Bourguignon <····@mouse-potato.com> writes:
> David Sletten <·····@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?)
In article <··············@eva.rplacd.net>, Szymon <············@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
From: Thomas Gagne
Subject: Re: Data for Erann Gat's chellenge (phone numbers & dictionary).
Date:
Message-ID: <42098CDA.4060602@wide-open-west.com>
Did anyone get the data yet? Remove the dashes from my email address and
please email!
Ron Garret wrote:
> In article <··············@eva.rplacd.net>, Szymon <············@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
In article <················@wide-open-west.com>,
Thomas Gagne <······@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