# R6RS and optional arguments with keywords (plot for example)

**URL:** <https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141>\
**Category:** Questions & Answers\
**Created:** [August 31, 2024, 11:22pm UTC](https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141 "2024-08-31T23:22:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [August 31, 2024, 11:22pm UTC](https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141/1 "2024-08-31T23:22:10Z")

</div>

hello,

i can not find a way to use all the feature of plot library in R6RS because i can not pass all the options. : is forbiden in R6RS and so #:something too

for example, this works:

```scheme
#!r6rs

(library (test-plot)

  (export)

  (import

   (rnrs base (6))
 
   (rnrs syntax-case (6))
   
   
   (only (rnrs io simple (6)) display newline)

   (plot)

   (only (racket math) pi)

  
   ) ; end import

  ;; display { } as they are.
  ;;(print-mpair-curly-braces #f)

  (display (plot (function sin (- pi) pi )))
  (newline)

) ; end module

```

but not this:

```scheme
#!r6rs

(library (test-plot)

  (export)

  (import

   (rnrs base (6))
 
   (rnrs syntax-case (6))
   
   
   (only (rnrs io simple (6)) display newline)

   (plot)

   (only (racket math) pi)

  
   ) ; end import

  ;; display { } as they are.
  ;;(print-mpair-curly-braces #f)

  (display (plot (function sin (- pi) pi #:label "y = sin(x)")))
  (newline)

) ; end REPL module

```

```scheme
Welcome to DrRacket, version 8.14 [cs].
Language: r6rs, with debugging; memory limit: 8192 MB.
. . illegal character after `#' in input: `:'

Interactions disabled.

```

i tried using Head patterns :

[https://docs.racket-lang.org/syntax/stxparse-patterns.html#(tech.\_head.\_pattern)](https://docs.racket-lang.org/syntax/stxparse-patterns.html#%28tech._head._pattern%29)

but i again blocked...

is there a way to pass the optional arguments of plot in R6RS?

regards,

---

<div class="post-metadata">

**Author:** ![SamPhillips](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samphillips/32/15_2.png) [@SamPhillips](https://racket.discourse.group/u/SamPhillips)\
**Post date:** [September 1, 2024, 3:55am UTC](https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141/2 "2024-09-01T03:55:19Z")

</div>

One way to make this work would be to build a macro that translates `name:` to `#:name` in function application.

Here is one way you could do it: [Keyword bridge for R6RS · GitHub](https://gist.github.com/samdphillips/baa4d71105e18644749d8aeebf92d845)

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [September 1, 2024, 10:31am UTC](https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141/3 "2024-09-01T10:31:59Z")

</div>

seems perfect (yet not tested because i'm asking about install) but (yet another different and general question) , i understand the main source is in kw.rkt (other file is R6RS example) how can i install it with the package manager ? is it possible to install this single file or should i put an info.rkt file with all the stuff that goes inside....

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [September 1, 2024, 1:04pm UTC](https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141/4 "2024-09-01T13:04:19Z")

</div>

i now know how to install it but i really have a problem with the linux version of racket , on Mac OS it run well, under linux the GUI of package manager make it crash, perheaps it is my new system, i do not know , i recorded a video of probleme,even if it brings no solution or clues :

[![](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/7/79ee0861770f35c31dcf8c1bef4d7222989c33d8.jpeg "Capture vidéo du 2024 09 01 13 46 24") ](https://www.youtube.com/watch?v=sGd1PCt10FA)

regards

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [September 1, 2024, 2:02pm UTC](https://racket.discourse.group/t/r6rs-and-optional-arguments-with-keywords-plot-for-example/3141/5 "2024-09-01T14:02:00Z")

</div>

it works... i got the daisies 😅 in R6RS, even with plot and mutable lists, i will make it a main example for the release of Scheme+ R6RS version for Racket soon :

 ![Capture d’écran du 2024-09-01 15-58-56](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/c/ce7c084b79e97d0f166aa48b92a3fb2d14a8057b.jpeg)

```scheme
;; multichrome plot
		  
		  (define-kwish kw-points points) ;; R6RS does not allow #:something keywords, this creates a new function
		  
		  (define plt
		    
		    (plot
		     (mlist->list ; in R6RS we must convert list from mutable to immutable ones to use with Racket library
		      (map (lambda (point)
			     
			     (kw-points ;(points
			      (mlist->list (list point))
			      ;;#:alpha 0.4
			      ;; R6RS does not allow #:something keywords
			      ;;#:sym 'fullcircle1
			      ;;#:color (compute-rgb-color-from-hsv point max-norm-x-y) ;; change the color of a point according to its co-ordinate
			      ;; we use as replacement 
			      sym: 'fullcircle1
			      color: (compute-rgb-color-from-hsv point max-norm-x-y) ;; change the color of a point according to its co-ordinate
			      ))
			   lst-points))))
		  

```
