Welcome to the CHICKEN Scheme pasting service

sxml-zipper pasted by DerGuteMoritz on Tue Jul 23 21:01:54 2013

(define (random-qwantz-quote)
  (and-let* ((x (call-with-input-request "http://www.qwantz.com/index.php" #f html->sxml))
             (x (sxml-zipper x))
             (x (find-first x (equals "randomquote")))
             (x (parent x (tag= 'div)))
             (x (find-all x (tag= 'a))))
    (text (last x))))

(random-qwantz-quote) => "Hey!  That's your cue, readers!"

-> -> -> pasted by DerGuteMoritz on Tue Jul 23 21:03:16 2013

(use clojurian-syntax)

(define (random-qwantz-quote)
  (-> (call-with-input-request "http://www.qwantz.com/index.php" #f  html->sxml)
      (sxml-zipper)
      (find-first (equals "randomquote"))
      (parent (tag= 'div))
      (find-all (tag= 'a))
      (last)
      (text)))

list-zipper pasted by DerGuteMoritz on Tue Jul 23 21:09:11 2013

(define zip (list-zipper '(a (b (c d)))))

(node (down (right (down zip)))) => b

(-> zip down right down node) => b

zipper navigation pasted by DerGuteMoritz on Tue Jul 23 22:23:36 2013

2> (list-zipper '(a (b (c d))))
#<zip (a (b (c d)))>
3> (down #2)
#<zip a>
4> (right #3)
#<zip (b (c d))>
5> (down #4)
#<zip b>
6> (right #5)
#<zip (c d)>
7> (down #6)
#<zip c>
8> (right #7)
#<zip d>
9> (up (up (up #8)))
#<zip (a (b (c d)))>

functional update added by DerGuteMoritz on Tue Jul 23 23:00:27 2013

2> (list-zipper '(a (b (c d))))
#<zip (a (b (c d)))>
3> (down (right (down #2)))
#<zip b>
4> (replace #3 'XX)
#<zip x>
5> (root #4)
#<zip (a (XX (c d)))>
6> #2
#<zip (a (b (c d)))>

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Given a list, which one-argument R5RS procedure returns the element at index 0?
Visually impaired? Let me spell it for you (wav file) download WAV