volkert
2020-7-4 07:09:19

DrRacket / Quickscript competition. @spdegabrielle

To learn quickscript, i started with this example from the quickscript docs (https://docs.racket-lang.org/quickscript/index.html)

(define-script reverse #:label "Reverse" (λ (selection) (list->string (reverse (string->list selection))))) After selecting some text and choosing the script, DrRacket gives me the following error in a message box.

Error in script file "/Users/X/Library/Preferences/quickscript/user-scripts/reverse.rkt": string->list: contract violation expected: string? given: '(#\q #\u #\i #\c #\k #\s #\c #\r #\i #\p #\t) In the REPL everything works fine.

> (list->string (reverse (string->list "quickscript"))) "tpircskciuq" Can please someone check, if it is a bug?

(DrRacket 7.7, macOS Catalina)


laurent.orseau
2020-7-4 07:28:20

Use (define-script reverse-selection instead of (define-script reverse


laurent.orseau
2020-7-4 07:29:15

Its a bug in the docs, it has been fixed but this will appear in the next version. The problem is that reverse is a reserved word of course :)


volkert
2020-7-4 10:00:51

I see. :-) Thank you for the hint.


soegaard2
2020-7-4 10:22:22

Thanks for the tips. I checked out hub it looks promising,


samth
2020-7-4 11:51:19

They have a new command line tool called gh but it’s less of a straight git replacement


brentgordon146
2020-7-4 15:18:39

tcp-connect: connection failed; host not found address: <http://www.reddit.com\|www.reddit.com> port number: 443 system error: Name or service not known; gai_err=-2 anyone can help me with this error I can curl and ping reddit just fine


popa.bogdanp
2020-7-4 15:20:17

I get the following error when I try to build CS on Windows (nmake win32-cs):

error: format string requires 0 arguments, given 1; arguments were: '\|{meta-parse-Rhs unique95301}\| "unrecognized pattern or template" '#s((\|{syntax-object bdehkef6almh6ypb-a}\| #(0 1)) (mref ,%sp ,%zero 4) ((#f . #0=(... context...: {meta-parse-Effect unique95497} {chi-macro unique21740} {syntax-type unique21739} {parse unique23441} {chi-body unique24044} {chi-frobs unique22556} {chi-body unique24044} C:\Users\User\Source\Repos\racket\racket\collects\racket\private\map.rkt:40:19: loop {chi-expr unique23225} {chi-frobs unique22556} {chi-body unique24044} {chi-frobs unique22556} {chi-body unique24044} {maplr unique23178} [repeats 176 more times] {chi-frobs unique22556} ... (this is on one of Microsoft’s Developer VMs running Windows 10, with the latest VS 2019, though I don’t think that matters in this case)


popa.bogdanp
2020-7-4 15:20:50

BC builds just fine and I can build the CS version on macOS from the same commit.


popa.bogdanp
2020-7-4 15:23:35

Looks like a DNS resolution issue. What happens if you run dig <http://www.reddit.com\|www.reddit.com> from the command line?


popa.bogdanp
2020-7-4 15:26:36

This gets printed right after

Load <http://cpcommonize.ss\|cpcommonize.ss> Load <http://cpnanopass.ss\|cpnanopass.ss>


popa.bogdanp
2020-7-4 15:33:17

Ah, I didn’t notice your note about curl the first time. I believe this can also happen when the process runs out of file descriptors.


popa.bogdanp
2020-7-4 15:35:45

(for/list ([i (in-range 100000)]) (define-values (in out) (tcp-connect "<http://www.reddit.com\|www.reddit.com>" 443)) (displayln i) (list in out)) This reproduces the failure on my machine and it fails right around the 250th iteration. On macOS, the default limit for open FDs is 256.


mflatt
2020-7-4 15:36:03

I don’t have a good guess, yet. What commits do you have for your racket checkout and racket/racket/src/build/ChezScheme checkout?


popa.bogdanp
2020-7-4 15:37:46

The latest one from racket/racket is 497bb25917 and for ChezScheme it’s 0f3ff69d4247ec695087953892839d680ed32fff.


brentgordon146
2020-7-4 15:49:52

ok thanks I’ve restarted Dr.Racket to see if that changes anything


popa.bogdanp
2020-7-4 15:52:17

You’re probably going to have to make sure your code closes any ports it’s done with or, if you’re writing a crawler and you want to be able to crawl many pages concurrently, you might want to adjust the limit to some higher value (assuming you are on macOS, I think the limits on Linux are higher by default).


mflatt
2020-7-4 15:55:16

And this is 64-bit Windows?


popa.bogdanp
2020-7-4 15:55:29

Yes


mflatt
2020-7-4 15:56:55

I see that error when I try to build 32-bit Windows, so I can fix it. Meanwhile, maybe you’ve accidentally selected the 32-bit compiler on Windows when you wanted the 64-bit compiler?


popa.bogdanp
2020-7-4 15:57:35

It’s definitely possible. Let me check


popa.bogdanp
2020-7-4 15:59:22

Yep, it looks like I’ve been running the x86 version of nmake all along, which I assume means my env vars are set up to point to the 32 bit versions of everything.


popa.bogdanp
2020-7-4 16:01:18

Yup. I hadn’t run mscvprep.bat x86_amd64 so it must’ve defaulted to the vars for x86 .


mflatt
2020-7-4 16:13:03

Now fixed for 32-bit Windows. Thanks for the report!


popa.bogdanp
2020-7-4 16:14:29

Thanks! Also, it looks like msvcprep doesn’t work in Power Shell because vcvarsall doesn’t work in PS. Should I add a note to the README in worksp about that?


mflatt
2020-7-4 16:21:18

Sure, unless you know a reasonably simple way of making it work.


samdphillips
2020-7-4 22:10:16

This is a weird one. On DrRacket 7.7(BC) Windows 10, open the “Package Manager”, click on “Currently Installed”, scroll down with the scroll wheel stops scrolling about 1/5 through the list. Manually moving the scroll control and you can continue to scroll with the scroll wheel, but if you scroll all the way back to the top it won’t let you use the wheel to scroll down again. Anyone seen this behavior before?