(when (= i secret) (send f show #f))) ; success => close window (for ([i (in-range 10)]) ; create all buttons (make-object button% (format "~a" i) p (make-check i))) (send f show #t) ; show the window to start the application The GUI can be hand-coded in this way or with the help of a GUI designer program available on PLaneT. Slideshow Slide-based presentations can also be developed in Racket using the slideshow language, much like Beamer, but with Racket's programmatic facilities. Elements of the slides are pictures that can be combined. For example, the following program displays in full-screen a title slide, followed by a slide with some pictures. The vc-append and hc-append functions combine pictures vertically and horizontally, respectively, and centered on the other axis. #lang slideshow (slide (text "Slideshow" 'roman 56) (text "Making presentations in Racket" 'roman 40)) (slide #:title "Some pictures" (apply vc-append (for/list ([i 5]) (define (scale+color p c) (colorize (scale p (/ (add1 i) 5)) c)) (hc-append (scale+color (filled-rectangle 100 50) "darkblue") (scale+color (disk 100) "darkgreen") (scale+color (arrow 100 (/ pi 6)) "darkred") )))) Extension packages also exist on PLaneT, for example to include LaTeX elements. Foreign function interface Racket features a foreign function interface that is based on libffi. The interface allows writing unsafe low-level C-like code, that can allocate memory, dereference pointers, call out to functions in shared libraries, and send out callbacks to Racket functions (using libffi closures). The core implementation is a thin layer atop libffi (written in C), and the full interface is then implemented via Racket code. The interface uses macros extensively, resulting in an expressive Racket-based interface description language. This language has a number of useful features, such as uniform representation for higher-order functions (avoiding the pitfalls when callbacks and callouts are different), struct definitions that are similar to plain Racket structs, and custom function types that can represent input and output pointers, implicit arguments (e.g., an argument that provides the number of elements in a vector that is passed as another argument). By using this interface to access underlying GUI toolkits, Racket implements its own GUI layer completely in Racket. The FFI can be used in a number of different ways: from writing a complete glue layer for a library (as done for Racket's OpenGL binding), to quickly pulling out a single foreign function. An example of the latter approach: #lang racket/base ;; Simple use of