Lab 3
1 Actual Brain Exercise
6.1.1.8

Lab 3

1 Actual Brain Exercise

  1. Develop the function rev-str-app, that accepts a list of strings and returns a single string combining the input strings in reverse order. Use string-append to join strings. So, calling the function with the list containing the strings "ball", "juice", and "frog" would produce the string "frogjuiceball". Follow the design recipe, including types, purpose statement, and test cases

  2. Develop a representation for processors; A processor can be either an Intel, an AMD, or an ARM. Each one has a single field that is a number [*]. Define these using a define-type.

  3. Develop the function onlyIntels, that consumes a list of processors and returns a list containing only the Intels.

  4. Develop the function onlyAMDs, that consumes a list of processors and returns a list containing only the AMDs.

  5. Abstract over the two of these to obtain the function onlyThese, that consumes a list of processors and a particular processor predicate f (e.g., AMD?)and returns a list containing only those elements of the list that satisfy f. (Note: you’re passing the function AMD? here. If this doesn’t make sense, ask for help!

  6. Develop the my-append function that consumes two lists and returns the result of appending the second one to the first. So, if called with the list [a,b,c] and the list [d,e,f], it would return [a,b,c,d,e,f].

  7. Develop the my-drop function that consumes a list and a number n and returns the list that remains after the first ’n’ elements of the input list. If the length of the input list is <= n, this function returns an empty list.

[*] I don’t care what the field is called. Actually, I don’t care whether they have fields or not, but experience shows that constructors with no arguments along with higher-order procedures confuse the heck out of students just getting used to Racket. If this doesn’t make sense to you, just take my advice and make up a field for each one.