Lecture overview -- Keyboard shortcut: 'u'  Previous page: Recursion -- Keyboard shortcut: 'p'  Next page: Tree processing (1) -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home    Lecture 3 - Page 17 : 42
Functional Programming in Scheme
Name binding, Recursion, Iteration, and Continuations
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)
     (let ((attr-name (car attr-p-list))
           (attr-value (cadr attr-p-list))
           (attr-rest (cddr attr-p-list)))
      (if (eq? attr-name 'href)
          (find-href-attribute attr-rest)))))

A function for extraction of the href attribute from a property list.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/href-extraction-dialogueAn example with property lists that represent HTML attributes in LAML.

As the last interaction, we see the function find-href-attribute in play.