DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Build Logo Using Flickr Alphabet Pictures In NewLISP

10.05.2006
| 5786 views |
  • submit to reddit
        // it uses my FLICKR context for newLISP
// demo available at http://terpri.com
(define (alphabet-flickr myletter, alph y myurl)
    (setq alph (xml-digest (FLICKR "flickr.groups.pools.getPhotos" nil
                  (append "group_id=27034531@N00&tags=" myletter))))
    (setq alph (clean nil? (map (lambda(x) (if (= myletter ((x (chop(ref 'title x))) 1)) x)) (\
2 -1 (alph 0 2)))))
    (setq y (first (randomize (sequence 0 (length alph)))))
    (setq y (alph y 1))
    (setq myurl (format "http://static.flickr.com/%s/%s_%s_s.jpg"
                       (lookup 'server y)(lookup 'id y)(lookup 'secret y)))
    (println "<img src=" myurl " border=0>"))

    (if (= page-name "Home")
      (begin
            (println {<div class="flickr_banner">})
            (map (lambda (x) (alphabet-flickr x)) '("T" "E" "R" "P" "R" "I"))
            (println "</div>")))