Wednesday, February 22, 2012

Phone book and newLISP

Work has a web-based phone book but ... it's web-based.  Gotta load up the page, enter the last name, hit 'go' ... all for a four-digit number.

Had a bash script for years; wget, grep-fu and voila. Good problem-space to try out new language on, like newLISP.

Doesn't spit back the actual data, yet, but getting this done up after a man-hour of study-time tickles me.

(print "Last name?")

(set 'lastname (read-line))

(println "Looking for " lastname)

(set 'phone (parse (read-file "/Users/bdunbar/foo/phone/phone.cfm") {\W} 0))

(set 'loc (find lastname phone 0))
(if loc
(println "Found name " (phone loc) " in directory.")
(println "Found nothing. Do you have the right spelling?"))

(println "finished.")




blog comments powered by Disqus