;; ================================ ;; CMPU 145,Spring, 2019 ;; HW The Power Set ;; Due Date: Feb. 12 ;; Name: ;; ================================ #lang racket (include "asmt-helper.scm") (header "Power Set" "Template") (problem "(1) POWER-SET") ;; POWER-SET ;; ------------------------------ ;; INPUT: INPUTLIST, a list representing a set ;; OUTPUT: A list of lists representing the power set of INPUTLIST (i.e., the ;; set of all subsets of INPUTLIST) (define power-set (lambda (inputlist) (if (null? inputlist) ;; Base Case: The input list is empty, ;; Action: ;; Recursive Case: The input list has at least one element ;; Action: Use LET* and, perhaps, other api's we experimented with. ))) (tester '(power-set '())) (tester '(power-set '(a))) (tester '(power-set '(1 2))) (tester '(power-set '(X Y Z))) (newline) (tester '(length (power-set '(1 2 3 4 5 6)))) (tester '(length (power-set '(1 2 3 4 5 6 7 8 9 10))))