Stop show with sound -- Keyboard shortcut: 'x'  Next slide in show -- Keyboard shortcut: 'n'  45 secondsName binding, Recursion, Iteration, and Continuations - slide 17 : 42

List processing

A list is a recursive data structure

As a consequence list processing is done via recursive functions

We illustrate list processing by extracting attribute values from a LAML attribute property list

; Return the href attribute value from a property list
; Return #f if no href attribute is found.
; Pre-condition: attr-p-list is a property list - 
; of even length.  
(define (find-href-attribute attr-p-list)
 (if (null? attr-p-list)
     #f
     (let ((attr-name (car attr-p-list))
           (attr-value (cadr attr-p-list))
           (attr-rest (cddr attr-p-list)))
      (if (eq? attr-name 'href)
          attr-value
          (find-href-attribute attr-rest)))))
href-extraction-dialogue
An example with property lists that represent HTML attributes in LAML.