Express basic computations over primitive values and their associated standard library functions.
As you may know, some children enjoy using a language called “Pig Latin” (or Igpay Atlinlay). The normal rules for Pig Latin are as follows:
We’re going to do a simpler version of Pig Latin. For any word, we’ll strip the first letter from the beginning of the word, add the letter to the end, and add “ay”.
> (define str "pig")
> (<your expression here> ...)
"igpay"
> (define str "slurp")
> (<your expression here> ...)
"lurpsay"
> (define str "append")
> (<your expression here> ...)
"ppendaay"
Write an expression (or multiple expressions) to create the simplified pig latin version of a string called str.
Express basic computations over primitive values and their associated standard library functions.
As you’ve learned by now, the Unicode collating sequence assigns different numbers to the letters of the alphabet than humans do. We think #\a is the first letter of the alphabet; Racket calls it number 97.
Write an expression (or series of expressions) that uses an integer, named val, between 1 and 26 and finds the corresponding capital letter in Enlish.
(#\A is 1, #\B is 2, and so on and so forth.)
You should not use magic numbers; don’t rely on a particular collating sequence. This means that your solution should not include a number such as 97 or 65. (You may, however, assume that the letters appear in sequence in the collating sequence.)
> (define val 1)
> (<your expression here> val)
#\A
> (define val 5)
> (<your expression here> val)
#\E