(def parse-site (url) (rev (tokens (cadr (tokens url [in _ #\/ #\?])) #\.))) (defmemo sitename (url) (and (valid-url url) (let toks (parse-site (rem #\space url)) (if (isa (saferead (car toks)) 'int) (tostring (prall toks "" ".")) (let (t1 t2 t3 . rest) toks (if (and (~in t3 nil "www") (or (mem t1 multi-tld-countries*) (mem t2 long-domains*))) (+ t3 "." t2 "." t1) (and t2 (+ t2 "." t1))))))))
(tostring (prall toks "" "."))
arc> (= toks (parse-site "http://74.125.95.132/")) ("132" "95" "125" "74") arc> (isa (saferead (car toks)) 'int) t arc> (tostring (prall toks "" ".")) "132.95.125.74"
-----