CSC151 2007S, Class 35: Writing Script-Fu Procedures Admin: * Are there questions on the exam? * Problem 1 * Problem 2 "Unriffle" * What does "implement" mean? It means "write the procedure" a. Documented b. Tested c. (define unriffle (lambda (lst) ...)) * Local helpers? c. (define unriffle (letrec ((fred (lambda (...) ...)) (ginger (lambda (...) ...))) (lambda (lst) ...))) * Problem 3 - in-tree? * Can I use member? * You may not *call* member? or member * You may, however, use member? as a source of ideas (Which you need not cite.) * Examples for in-tree? > (in-tree? 'a null) #f > (in-tree? list null) #f > (in-tree? "I hate writing examples" null) #f > (in-tree? 'a (cons 'a 'b)) #t > (in-tree? 'a (cons 'b 'a)) #t > (in-tree? list (cons 'a "b")) #f > (in-tree? list (cons car cdr)) #f > (in-tree? "I hate writing examples" (cons "I hate" "writing examples")) #f > (in-tree? "I hate writing examples" (cons "I hate writing examples" "that are shorter than 200 lines")) #t > (in-tree? 'a (cons (cons 'b (cons 'c (cons 'a 'x))) (cons 'x 'y))) #t * I've had a request from one student to turn in the exam on Tuesday morning, so I'll be rearranging next week's schedule a bit. * I've been asked to meet with a department at 11, so I will be unavailable for office hours. Overview: * Reflections on the first Script-Fu Lab. * Writing procedures for Script-Fu. * Lab. /Reflection/ * What was your favorite part of yesterday's lab? * Seeing the amusing color names * "It was wicked fun" * What was your least favorite part of yesterday's lab? * Script-Fu console is "small" - only one line for the code * More trouble than its worth to draw something - I can select and stroke by hand much faster than I can do in code. * Error messages were not incredibly helpful * Missing it * What advantages, if any, are there from being able to write Script-Fu commands for GIMP? (As compared to doing things manually?) * "I can't draw a straight line, so it was helpful to have the computer do it for me." * When you care about precision (e.g., modern or premodern values), it's easier * Replication is easier * Code can provide a clearer explanation, too. * What advantages are there, if any, for being able to do manual stuff in addition to the Script-Fu? * What else would you like to learn about Script-Fu? * I won't necessarily follow your guidance, but I might. * "I'd like to do animation." * Yes the GIMP can do some forms of animation. * But Sam's not sure how - Other than draw, pause, erase, draw, pause, erase * What other commands would you like? /Step One: Procedures/ * To do manyinteresting things, you'll need to write procedure. * Procedures can combine operations * Proceduers can parametize operations E.g., for a simple animation, a "draw-frame" procedure might take the frame number as its parameter * The GIMP does not provide an easy way to write procedures. * So we write the procedures in DrScheme and load them into the GIMP