Assignment 2: Harder Scheme Problems

You may find it helpful to write "help functions" for some of these.
  1. Write a function reverse which accepts a list and returns the same list in reverse order. For example, (reverse '(a b c)) should return (c b a).
  2. A matrix can be represented as a list of lists, with each sublist being one row of the matrix. Write a function transpose which accepts a matrix and returns the transposed matrix. For example,
    (transpose '((a b c d) (e f g h) (i j k l)))
    
    should return:
    ((a e i) (b f j) (c g k) (d h l))
    
  3. Write a function skeletonize* which accepts a (possibly deeply-nested) list and returns a copy of the list with all the atoms removed (leaving only parentheses). For example,
    (skeletonize* '((a b (c (d)) () e) f))
    
    should return:
    (((()) ()))
    
Email a .scm file containing these definitions to me.
Last modified: Tue Jan 27 10:16:06 PST 2004