1 Quick Example

RacketUI: Automated Web UI Generator

Nadeem Abdul Hamid <[email protected]>

RacketUI is intended to be a teachpack to provide facilities for the quick and easy generation of web interfaces for programs written in the HtDP (How to Design Programs) student languages of Racket (see ).

1 Quick Example

Consider the following program, which builds an acronym from the capitalized words in a list of strings (comments and test cases are omitted):

(define (acronym a-los)
  (cond [(empty? a-los) ""]
        [(cons? a-los)
          (cond
            [(string-upper-case? (string-ith (first a-los) 0))
             (string-append (string-ith (first a-los) 0)
                            (acronym (rest a-los)))]
            [else (acronym (rest a-los))])]))

An automatic web application for this can be generated using:

(require (planet nah22/racketui/web-launch))
 
(web-launch
 "Acronym Builder"
 (function "Produces an acronym of the capitalized words in the given list."
           (acronym ["Words" (listof+ ["Word" string+])]
                    ->["The acronym" string])))

Running this program should launch a web browser with an user interface allowing input of a list of words (strings) and the ability to apply the function to that input to view the result.