You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pollen/tutorial/index.html.pmd

41 lines
1.9 KiB
Plaintext

11 years ago
#lang pollen
![](space.jpg)
Introduction
============
This tutorial provides a brief introduction to the Racket programming language by using one of its picture-drawing libraries. Even if you dont intend to use Racket for your artistic endeavours, the picture library supports interesting and enlightening examples. After all, a picture is worth five hundred "hello world"s.
Along the same lines, we assume that you will run the examples using [DrRacket](http://racket-lang.org/). Using DrRacket is the fastest way to get a sense of what the language and system feels like, even if you eventually use Racket with Emacs, vi, or some other editor.
## Ready...
[Download Racket](http://racket-lang.org/), install, and then start DrRacket.
## Set...
> See [the DrRacket documentation](file:///Users/MB/git/racket/racket/doc/drracket/interface-essentials.html) for a brief overview of the DrRacket IDE.
To draw pictures, we must first load some picture functions, which are part of a library for creating slide presentations. Copy the following into the *definitions area*, which is the top text area that you see in DrRacket:
```
#lang slideshow
```
Then click the Run button. Youll see the text caret move to the bottom text area, which is the *interactions area*.
If youve used DrRacket before, you might need to reset DrRacket to use the language declared in the source via the **Language|Choose Language...** menu item before clicking **Run**.
## Go!
When you type an expression after the > in the interactions window and hit Enter, DrRacket evaluates the expression and prints its result. An expression can be just a value, such as the number 5 or the string "art gallery":
```
> 5
5
> "art gallery"
"art gallery"
```
An expression can also be a function call. To call a function, put an open parenthesis before the function name, then expressions for the function arguments, and then a close parenthesis.