chameleon transformation images

Expressing, combining, transforming values in racket/scheme

The video tutorials below are to help you learn how to express, transform, combine, and decompose values in the DrRacket programming environment. This is a lot more fun if you installh DrRacket for your computer platform, and work through the examples.

In case videos aren't your preferred source for learning, I've also included some other resources with each video.

express values video

Expresses bicycle, lizard, and giraffe images, the number five, the character string "string", as well as truth and lies. Once you're done with the video, you should be able to:

  • Represent images you copy inside the DrRacket programming environment, flip them, and find out how wide or tall they are
  • Represent exact numbers --- such as 5, 7, and 5/7 --- as well as inexact numbers, such as the square root of 133/59.
  • Represent strings, such as "counter-clockwise", and find out how many characters they contain.
  • Represent true and false, and toggle between them.

Here are some relevant non-video resources for this topic:

  • Pages 9–10 of Stephen Bloch's Chapter 1 of Picturing Programs introduce image manipulation.
  • Guide for Racket's 2htdp/image tools for manipulating images. These tools are automatically included if you (require picturing-programs). On the same page you'll find lots of other tools explained, including image-width and image-height.
  • Guide for Racket's Intermediate Student with lambda on sqrt and other numeric tools... Poke around enough and you'll also find stuff on strings, true, and false as well.

transform values video

Finds images on the web, or your hard drive, and flips, rotates, or scales them. Once you're done with the video, you should be able to:

  • Flip an image left-to-right or top-to-bottom.
  • Rotate an image, say, 270 degrees counter-clockwise.
  • Scale an image so that it is twice, or half, as large.
  • Scale an image so that it is shorter, but wider, than it was originally.

Non-video resources that are relevant to this topic:

  • Chapter 1 and Chapter 3 of Stephen Bloch's Picturing Programs gets you started on manipulating images and working in Doctor Racket.
  • Guide to Racket's 2htdp/image tools, which are included when you (require picturing-programs).

combine values video

Combines images, numbers, character strings, truth, or lies, and produces new values from them. Once your done with the video, try the following:

  • Place four images beside each other (it helps to choose small ones).
  • Place images above others.
  • Create a solid red circle of size 15. What do you figure the size number means?
  • Append three strings to produce "all together now" (notice the spaces).
  • Multiply the integers from 1 through 10. Add the same integers. What happens if you use the subtraction operator? What about division?
  • What values does (< 2 3 5 7) produce? What about (< 2 3 7 5)? Explain the results.

Non-video resources relevant to this topic:

decompose values video

Takes apart images, numbers, and strings of characters. Once you're done the video, try the following:

  • Crop 150 pixels off the top of an image that is at least 150 pixels tall.
  • Crop 200 pixels off the left of an image that is at least 200 pixels wide.
  • Examine the value pi, and then round it to the nearest integer. Convert to an exact number, if necessary.
  • Extract the substring fern from inferno

Non-video resources relevant to this topic:


Danny Heap
Last modified: Tue Sep 13 21:01:59 EDT 2016