notjack
2020-7-15 08:44:15

update: I was able to get this to work using index*


spdegabrielle
2020-7-15 12:39:13

Call for help: if you are interested in entering the<https://icfpcontest2020.github.io/#/| icfp contest 2020 >and using racket - Participation requires using an approved docker container that mostly seems to require a specific format and can’t need an internet connection to work. • The good news is there is already a dockerised version of racket - both on docker and repo https://github.com/jackfirth/racket-docker https://github.com/icfpcontest2020/dockerfiles/issues/63#issuecomment-658656973


sorawee
2020-7-15 15:53:46

I’m experiencing a problem submitting a PR to Racket. In particular, it doesn’t know that my PR can be merged.


samth
2020-7-15 15:53:57

Here’s a discussion of background expansion for Rust in IntelliJ: https://blog.jetbrains.com/clion/2020/07/intellij-rust-0-3-new-macro-expansion-engine/


sorawee
2020-7-15 15:55:04

@samth: is it OK if I ask people (or actually, you) to try submitting a PR?


sorawee
2020-7-15 15:56:21

Oh, this might not be my fault: https://www.githubstatus.com/


sorawee
2020-7-15 15:56:38

Seems like there’s an issue with GitHub Actions right now



laurent.orseau
2020-7-15 17:14:53

I’m trying to start a repl at the end of a module, but this doesn’t seem to be enough: #lang racket (define var 10) (define-namespace-anchor a) (define ns (namespace-anchor-&gt;namespace a)) (parameterize ([current-eval (λ (x) (eval x ns))]) (read-eval-print-loop)) It prompts, but does not respond. What’s missing?


sorawee
2020-7-15 17:34:22

Reading the doc, I don’t think your current-eval is right


sorawee
2020-7-15 17:34:34

> A parameter that determines the current evaluation handler. The evaluation handler is a procedure that takes a top-level form and evaluates it, returning the resulting values. The evaluation handler is called by eval


sorawee
2020-7-15 17:35:01

It looks like the handler should be something more primitive than eval, so calling eval seems wrong to me


sorawee
2020-7-15 17:36:56

This works FWIW:


sorawee
2020-7-15 17:36:58

#lang racket (require racket/sandbox) (parameterize ([current-eval (make-evaluator 'racket/base)]) (read-eval-print-loop))


laurent.orseau
2020-7-15 17:39:17

Thanks. Sounds like you’re right, I was misled by the name


laurent.orseau
2020-7-15 17:42:21

I’ll just use my own repl instead: #lang racket (define var 10) (define (namespace-anchor-&gt;repl a) (define ns (namespace-anchor-&gt;namespace a)) (define (repl) (display "&gt; ") (with-handlers ([exn:fail? (λ (e) (displayln (exn-message e)) (repl))]) (define str (read-line)) (unless (eof-object? str) (define xs (with-input-from-string (string-append "(" str ")") read)) (for ([x (in-list xs)]) (writeln (eval x ns))) (repl)))) repl) (define-namespace-anchor a) (define repl (namespace-anchor-&gt;repl a)) (repl)


sorawee
2020-7-15 18:00:20

Probably need with-handlers to avoid error from both read and eval?


sorawee
2020-7-15 18:00:58

Also, what will happen when the input is 1 2?


laurent.orseau
2020-7-15 18:04:41

that’s all fine, it’s not for anyone else’s use :stuck_out_tongue:


laurent.orseau
2020-7-15 18:04:51

but yeah, it could be made more robust


laurent.orseau
2020-7-15 18:07:21

There ought to be a REPL functionality in Racket that does precisely all this though. Maybe it’s hidden somewhere?


laurent.orseau
2020-7-15 18:10:13

Alright, you got me, code above edited.



mflatt
2020-7-15 18:20:30

@laurent.orseau If you want a new eval handler that chains to the old one, you can use something like (parameterize ([current-eval (let ([old-eval (current-eval)]) (λ (x) ... (old-eval x) ...))]) ....) But for read-eval-print-loop, it turns out that the eval handler is too late to set the namespace, because the eval uses the current namespace with namespace-syntax-introduce before calling the eval handler. You may need something more like (parameterize ([current-namespace ns]) (read-eval-print-loop)) or a combination of current-namespace and current-eval.


laurent.orseau
2020-7-15 18:20:53

not exactly, this is a gui repl, I need a cmd line one


laurent.orseau
2020-7-15 18:20:58

thanks though :)


laurent.orseau
2020-7-15 18:23:18

Thanks. Just parameterizing the current-namespace doesn’t seem to be enough, it still hangs on reading


laurent.orseau
2020-7-15 18:23:31

(or before printing at least)


mflatt
2020-7-15 18:46:30

I see that, too, in DrRacket. I was trying command-line Racket before, and i’m not sure why DrRacket is different.


gfb
2020-7-15 19:58:04

any chance https://github.com/racket/drracket/issues/371 is related, and then possibly simpler to diagnose


sorawee
2020-7-15 23:42:36

@laurent.orseau: parameterizing current-namespace works for me.


alexharsanyi
2020-7-16 01:41:40

Could someone from the Racket team review this pull request for me? https://github.com/racket/plot/pull/62


samdphillips
2020-7-16 01:48:47

I haven’t read the implementation yet but this sounds awesome.