Skip to content

Instantly share code, notes, and snippets.

@dahu
Created January 4, 2013 12:07
Show Gist options
  • Save dahu/4452155 to your computer and use it in GitHub Desktop.
Save dahu/4452155 to your computer and use it in GitHub Desktop.
grab lorem ipsum from lipsum.com with newLISP
#!/usr/bin/newlisp
;; loremipsum.lsp - generator Lorem Ipsum dummy paragraphs / words / bytes.
;; by PapoAnaya Fri Nov 09, 2012 8:49 am
;;
;; Barry Arthur (20130104) - changed explicit nth access to unify
;; with implicit index vector.
;; Lorem Ipsum courtesy of www.lipsum.com by James Wilson
;;
;; @param what in "paras","words","bytes"
;; @param amount of paras/words/bytes (words minimum is 5, bytes it is 27)
;; @param start always start with 'Lorem Ipsum' "true"/"false"
(define (lipsum what amount start)
(setq lipsum-buffer (get-url (format "http://www.lipsum.com/feed/xml?what=%s&amount=%d&start=%s" what amount start)))
(setq lipsum-list (xml-parse lipsum-buffer 7))
((ref '(_ "lipsum" X) lipsum-list unify true) '(2 0 1)))
(println (lipsum (list "paras" (int (or (main-args 2) 2)) "true")))
(exit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment