Syntax for racket graphics

I am trying to follow the racquet documentation on how to use 2D graphics. Unfortunately, I can't get it to work (maybe something simple)

My code is:

#lang racket (require plot) (plot (function sin (-pi) pi #:label "y = sin(x)")) 

and error:

 compile: unbound identifier in module in: function 

I am new to racket / lisp, so if this is obvious, I just don't get it. I also tried inserting (require racket/gui/base) as well as (plot-new-window? #t) , but this also doesn't seem like a trick.

I am using racket v5.1.3 on Ubuntu 12.04. I do not use Dr. Racket

+4
source share
1 answer

The problem is that you are reading the documentation for 5.3.3, but 5.1.3 is installed.

In version 5.3.3 the program:

 #lang racket (require plot) (plot (function sin (- pi) pi #:label "y = sin(x)")) 

works as expected.

Either get the new version from http://racket-lang.org/download/ or take a look at the old documentation: http://download.racket-lang.org/docs/5.1.3/html/plot/plot.html?q = plot

+5
source

All Articles