![]() |
![]() |
|
home—info—lectures—exams—hws—archive
IV: practice: blend3 (having a function call a function)
Include trivial test-cases first (if it doesn't pass, easy to debug)
V: practice: area-of-disk; area-of-ring
a(r) = pi*r^2 area-of-disk
area-of-ring(r2,r1)
Use check-within
VIa: types in scheme:
number (integer, rational, inexact, complex;
functions +, /;
number?, integer?, exact?, rational?; zero? positive?,
number->string, inexact->exact );
string (string-append, string=?, string?)
boolean (boolean=?, not, and, or)
symbols; only functions are symbol? and symbol=?; symbol->string
Used like enums, or to emphasize it's a tag that you'll
never do string-work on.
images (!) Use menu item 'scheme > insert image'
VIb: images, image-primitives
circle, rectangle
overlay/xy, image-width, image-height
VII: write image-functions
(define (align-h img1 img2)
(overlay/xy img1 (image-width img1) 0 img2))
Write align-v
board2x2
board4x4
board8x8
------------
Possibly to mention in future:
btw, compare these function calls to the sh:
find . -name \*.ps -print
find . -name \*.ps -print | grep -i wimpout
Note that args can be passed by position (first arg to 'find'),
or by name (the '-name' flag, in this case)
What about '-i wimpout'? What drawbacks to differenting a real filename
from flags starting with '-'?
Try:
cat > -i
hello
^D
grep hel -i
grep -- hel -i
What about a program, where the filname is in a variable?
Back to scheme:
let x = 3.
home—info—lectures—exams—hws—archive
| ©2009, Ian Barland, Radford University Last modified 2009.Sep.08 (Tue) |
Please mail any suggestions (incl. typos, broken links) to ibarland |
![]() |