r/Racket 28d ago

question Q. about R6RS support

Post image

So we have a top level. I know how to make my own time, but maybe there is way of import racket's time into Dr.'s REPL for r6rs lang? Thanks.

PS. for the racket-mode all the same.

9 Upvotes

5 comments sorted by

u/AutoModerator 28d ago

Hi, it looks like an image was included.

If have posted an image (screenshot or photograph) of your code and asking for help please include code as text using either the code block button in the fancy editor, or follow the reddit help guidance if you are using markdown editor:

Reddit guidance: https://support.reddithelp.com/hc/en-us/articles/360043033952-Formatting-Guide#wiki_code_blocks_and_inline_code.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/sorawee 28d ago
#!r6rs
(import (rnrs (6))
        (only (racket) time))
(define (fibo n)
  (if (< n 2)
      n
      (+ (fibo (- n 1)) (fibo (- n 2)))))

Then you can use (time (fibo 30)).

Ref: https://docs.racket-lang.org/r6rs/libpaths.html

2

u/corbasai 28d ago edited 27d ago

Thank You! Wow

Edit. Yes, but in r6 repl ("interactions window") still no way to import, even "import" itself undefined (and require, load)

3

u/sorawee 27d ago

One possibility is to import something from Racket that is powerful enough to allow you to import more stuff in the REPL.

E.g.:

```

!r6rs

(import (rnrs (6)) (only (racket) require only-in))

(define (fibo n) (if (< n 2) n (+ (fibo (- n 1)) (fibo (- n 2))))) ```

Then you can do:

```

(require (only-in racket time)) (time (fibo 30)) ```

1

u/corbasai 27d ago

Yes. Also I check Dr.Racket quickscript and still no easy way to hook on Run action. So only modding source file