Lecture overview -- Keyboard shortcut: 'u'  Previous page: Tables with higher-order functions -- Keyboard shortcut: 'p'  Next page: The function simple-html-table -- 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 4 - Page 31 : 34
Functional Programming in Scheme
Higher-order Functions
HTML element modifications

The idea behind the function modify-element is to perform an a priori binding of some attributes and some of the contents of a mirror function.

y:/Kurt/Files/courses/prog3/prog3-03/sources/notes/includes/interesting-stuff.scmThe function modify-element.


Expression

Value

(define td1 
 (modify-element td 
  'bgcolor (rgb-color-list red)
  'width 50))

(table 'border 5 
  (map (compose tr (gmap td1)) rows))
This is first row
This is second row
This is third row
This is fourth row
(define ol1 
  (modify-element ol 'type "A"))

(ol1 
 (map
   (compose li as-string)
   (number-interval 1 10)))
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
(define ul1 
  (modify-element ul 'type "square"))

(ul1 
 (map
  (compose li as-string)
  (number-interval 1 10)))
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Examples of element modification using the function modify-element.