css.ss
(module css mzscheme

  (require "private/require.ss")
  (require-contracts)
  (require-parameters)

  ;; css/c : FlatContract
  ;; Recognizes representations of Cascading Style Sheets.
  (define css/c
    (listof (cons/c symbol? (listof (list/c symbol? string?)))))

  (provide/contract
   [css/c flat-contract?]
   [css? predicate/c]
   [write-css ([css/c] [output-port?] . opt-> . void?)])

  ;; A Cascading Style Sheet (CSS) is a (Listof StyleDefn)
  ;; A Style Definition (StyleDefn) is a (cons Selector (Listof PropDefn))
  ;; A Selector is a Symbol
  ;; A Property Definition (PropDefn) is a (list PropName PropVal)
  ;; A Property Name (PropName) is a Symbol
  ;; A Property Value (PropVal) is a String

  ;; css? : Any -> Boolean
  ;; Reports whether a value is a CSS.
  (define css? (predicate-of css/c))

  ;; write-css : CSS [OutputPort] -> Void
  ;; Writes a CSS datastructure as a proper text Cascading Style Sheet.
  (define write-css
    (param-lambda (css [output => current-output-port])
      (for-each write-style-defn css)))

  ;; write-style-defn : StyleDefn [OutputPort] -> Void
  ;; Writes a style definition to a Cascading Style Sheet.
  (define write-style-defn
    (param-lambda (style-defn [output => current-output-port])
      (write-selector (car style-defn))
      (display " {")
      (for-each write-prop-defn (cdr style-defn))
      (display " }\n")))

  ;; write-selector : Selector [OutputPort] -> Void
  ;; Writes a selector to a Cascading Style Sheet.
  (define write-selector display)

  ;; write-prop-defn : PropDefn [OutputPort] -> Void
  ;; Writes a property definition to a Cascading Style Sheet.
  (define write-prop-defn
    (param-lambda (prop-defn [output => current-output-port])
      (display " ")
      (write-prop-name (car prop-defn))
      (display " : ")
      (write-prop-val (cadr prop-defn))
      (display ";")))

  ;; write-prop-name : PropName [OutputPort] -> Void
  ;; Writes a property name to a Cascading Style Sheet.
  (define write-prop-name display)

  ;; write-prop-val : PropVal [OutputPort] -> Void
  ;; Writes a property value to a Cascading Style Sheet.
  (define write-prop-val display)

  )