word-of-the-day.ss
dvanhorn <[email protected]>
| Newsgroups | gmane.org.ballistichelmet.lambda |
|---|---|
| Message-ID | <[email protected]> |
#! /home/cs/csugrads/dvanhorn/local/bin/mzscheme -r #| -*- Scheme -*- Copyright (c) 2004 David Van Horn Licensed under the Academic Free License version 2.0 Word of the Day [email protected] Mon Mar 22 22:04:40 EST 2004 This script spits out an HTML fragment reporting the word of the day, it's definition, and a link to wordsmith.org. The word of the day is provided as an RSS feed by wordsmith.org http://wordsmith.org/awad/rss1.xml Wordsmith.org is Copyright 1994-2004 Anu Garg <[email protected]> |# (require (lib "xml.ss" "xml") (lib "match.ss") (lib "url.ss" "net")) (define url (string->url "http://wordsmith.org/awad/rss1.xml")) (define (get-rss) (xml->xexpr ((eliminate-whitespace '(rss channel item) (lambda (x) x)) (document-element (call/input-url url get-pure-port read-xml))))) (match (get-rss) (('rss _ ('channel _ . items)) (for-each (match-lambda (('item _ ('title _ title) ('link _ link) ('description _ desc) . _) (printf "<tr><td class=\"submenu\">~n") (printf "<a href=\"~a\">~a</a><br />~a" link title desc) (printf "</td></tr>~n")) (_ (void))) items)))