[plt-scheme] R6RS and PLoT

From: David Van Horn (dvanhorn at ccs.neu.edu)
Date: Mon Feb 9 01:41:08 EST 2009

LordGeoffrey wrote:
> In R5RS, the example from the docs works fine:
> #lang scheme
> (require plot)
> (define data1 (list (vector 1 1 2)
>                    (vector 2 2 2)))
> (plot (error-bars data1))
> 
> 
> In R6RS, not so much success:
> #!r6rs
> (import (rnrs base (6))
>        (plot))
> (define data1 (list (vector 1 1 2)
>                    (vector 2 2 2)))
> (plot (error-bars data1))
> 
> Results in
> map: expects type <proper list> as 2nd argument, given: {#(1 1 2) #(2 2 
> 2)}; other arguments were: #<procedure:vector-y>

PLT Scheme and R6RS have different notions of the list datatype.  You 
have to convert between them when you pass an R6RS (mutable) list to a 
function expecting an immutable list:

#lang r6rs
(import (rnrs)
         (plot)
         (scheme mpair))

(define data1 (mlist->list (list (vector 1 1 2)
                                  (vector 2 2 2))))
(plot (error-bars data1))

This still doesn't show anything in the interactions window, but that is 
a separate issue.  You can use (display (plot ...)) to see the result.

David



Posted on the users mailing list.