Inlab: Simple Functions

  1. Define the function string-first, which takes as input a string and returns just the first character as a string. E.g., string-first of "hello" is "h".

  2. Define the function string-rest, which takes a string and returns a new string with everything but the first character of the original string. E.g., string-rest of "hello" is "ello".

  3. Define the function scaled-sin, which takes three numbers: mid, scale, and x, and computes sin(x) × scale + mid (which is the sin(x) centered at mid, scaled by scale).

  4. Define the function sin-ball, which takes a Number to pass on as the x input for a scaled-sin centered at 100 and scaled by 50, and produces an image of a circle placed on an empty scene at the resulting y-location (centered in the middle).