CS 2322 Laboratory Problem Set 8

October 20, 2011
Due: October 27, 2011

These problems are to be done on an individual basis following the Trinity University Academic Integrity Policy Laboratory problems should be submitted electronically (e-mail to cs2322@cs.trinity.edu) on or before the due date and should contain a problem write-up, source code to any programs and data sets used in solving the problem. The submitted files should be ASCII text files having Unix end-of-line characters (please convert all Windows and Mac text files to Unix format-I have found that Emacs seems to do a reasonable job of such conversions). If several files need to be submitted, put them in a directory having name your-last-name-problem-set-number and create a tar archive of this file system and attach it to your e-mail problem submission.

Case Conversion

Given the following facts:

   (a. i. ]) 'aAzZ'
97 65 122 90

We deduce that the lower case alphabetic characters occupy positions 97 through 122 in the ASCII code and the upper case alphabetic characters occupy positions 65 through 90 in the ASCII code. Moreover,

   (32 + ]) &. (a. & i.) 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
abcdefghijklmnopqrstuvwxyz

This shows that the upper case ASCII characters are located 32 positions below the corresponding lower case ASCII characters.

Define a monad to_lower which, when applied to a list of characters will convert all upper case characters to the corresponding lower case characters leaving all other characters unchanged.

Define a monad to_upper which, when applied to a list of characters will convert all lower case characters to the corresponding upper case characters leaving all other characters unchanged.

Define tacit versions of to_lower and to_upper.

Problem Set 8 Solution [ HTML ] [ PS ] [ PDF ]



John Howland 2011-10-12