(re-sent after joining mailing list) On Sat, May 19, 2012 at 10:46:11AM -0400, Danny Heap wrote:
I wrote a small module for the convenience of my students in manipulating image color-lists in 2htdp/image. I want them to be able to create a new color one band at a time, and in my draft I have, for instance: ; new-red : number color -> color ; Produces a new color by replacing ; the red intensity of col by val. (define (new-red val col) ...) Is there a convention for naming, rather than new-???, that makes it obvious that there is no mutation going on? I'm not fond of the de-banged set-??? since that raises the (absent) mutation question. So, I don't think I want set-red, for example. Some suggestions I'm considering other than new-red: (with-red val col) (update-with-red val col) (replace-red val col) Each of these has an unfortunate connation of mutation for me, but if there's an established convention, I'll use (and teach) that. I also included an image comprehension, for/image, to suppress the details of image->color-list, followed by color-list->bitmap, in transforming an image. I read some of the discussion on preferring map over the for- comprehensions, but I want to allow my students to transform colors at the expression level, without the overhead of functions, named or anonymous. Are there grievous pedagogical implications I should be aware of? -- Danny Heap BA4270 416-978-5899 h...@cs.utoronto.ca http://www.cs.utoronto.ca/~heap ____________________ Racket Users list: http://lists.racket-lang.org/users