R6RS and optional arguments with keywords (plot for example)

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:

#!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:

#!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


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)

but i again blocked...

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

regards,

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

1 Like

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....

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 :

regards

it works... i got the daisies :sweat_smile: 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 :

;; 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))))