![]() |
![]() |
|
home—info—lectures—exams—archive
; grow-fires : (-> (list-of fire) (list-of fire)) ; Return the result of applying `grow-fire` to each element of `data`. ; (define (grow-fires lof) …) ; draw-fires : (-> (list-of fire) scene scene) ; Return the result of calling `draw-fire` for each fire onto sc. ; (define (draw-fires lof sc) …) ; map : (-> (-> α β) (list-of α) (list-of β)) ; Return the result of applying `g` to each element of `data`. ; (define (map f data) …) |
(map sqr (list 3 4 5)) = (list 9 15 25) (foldl + 0 (list 3 4 5)) = 12 |
- Sexpr: data-def'n. Example: html. (see ~/Library/Preferences/.GlobalPreferences.plist.orig) Data def'n, "S Expression": An sexpr is: - an atom, or - a list-of-sexpr) A list-of-sexpr) is: - empty, or - (cons sexpr list-of-sexpr) An atom is: - a number - a symbol - a String - a boolean - a structure - an image - empty (!) Same data def'n, written in BNF [Reading: §3.1-§3.3 ] sexpr ::= atom | sexprList sexprList ::= empty | (cons sexpr sexprList) atom ::= ... To do: Code which processes s-exprs. (Really, same as file and family-trees.) Write total-count -- using map, and (apply + ...) Write equal? -- using map, and (apply and ...). Wait, need andmap.
home—info—lectures—exams—archive
©2008, Ian Barland, Radford University Last modified 2008.Oct.10 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |