the FFI (require ffi/unsafe) (define mci-send-string (get-ffi-obj "mciSendStringA" "Winmm" (_fun _string [_pointer = #f] [_int = 0] [_pointer = #f] -> [ret : _int]))) (mci-send-string "play sound.wav wait") Language extensions Racket's most notable feature is its ability to build new domain-specific and general-purpose languages. This is the result of combining a number of important features: a flexible module system that is used for linking code and for namespace management, an extensive macro system—functioning as a compiler-API—that can create new syntactic forms, a rich runtime system, providing features that language implementors can use, like (composable, delimited) continuations, resource management, etc., a way to specify (and implement) parsers for new language syntaxes. The module system plays an important role in combining these features, and making it possible to write code that spans across a number of modules, where each can be written in a different language. Such languages are used extensively in the Racket distribution and in user libraries. In fact, creating a new language is so straightforward, that there are some languages that have less than a handful of uses. Racket comes with a number of useful languages, some are very different from Racket's default language. Scribble Scribble, Racket's documentation system, comes in the form of a number of languages that are used to write prose. It is used for Racket's documentation, as well as writing books and articles. Actually, rather than a single "scribble" language, it is a family of (very similar) dialects, each for a different purpose. To run the following example, copy it into DrRacket and click one of the two scribble rendering buttons that will appear (PDF rendering requires pdfTeX). Alternatively, use the scribble executable on the file. #lang scribble/base @; Generate a PDF or an HTML document using `scribble' @(require (planet neil/numspell)) @title{99 Bottles of Beer} In case you need some @emph{blah blah} in your life. @(apply itemlist (for/list ([n (in-range 99 0 -1)]) (define N (number->english n)) (define N-- (number->english (sub1 n))) @item{@string-titlecase[N] bottles of beer on the wall, @N bottles of beer. Take one down, pass it around, @N-- bottles of beer on the wall.})) The most striking feature of the Scribble languages is their use of a new syntax, which is designed specifically for textually rich code. The syntax allows free-form text, string interpolation, customizable quotations, and is useful in other applications such as preprocessing text, generating text, and HTML template systems. Note