jeapostrophe
2018-10-10 08:29:18

I believe it is up?


ben
2018-10-10 13:52:24

hm, clicking “save changes” saves the version exception but the website eventually 502’s


redwynskaja
2018-10-10 18:05:30

Hi. Would it be possible to match against a hash (hash “a” 1 “b” 2 …) with syntax-parse?


redwynskaja
2018-10-10 18:25:31

My aim is to create a macro that rewrites (hash “a” 1 “b” 2 “c” 3 …) to [a 1] [b 2] [c 3] …


samth
2018-10-10 18:31:44

@redwynskaja yes, you’d want a pattern like (hash (~seq key val) ...)


redwynskaja
2018-10-10 18:32:08

hmm i feel like i already tried that.


redwynskaja
2018-10-10 18:33:40

This just gives a very unspecific syntax error: unpack-hash: bad syntax in: (unpack-hash pars) #(476 18)


samth
2018-10-10 18:34:20

that’s because pars isn’t that


redwynskaja
2018-10-10 18:34:28

And for testing i am just doing #’’key …


samth
2018-10-10 18:34:29

pars is an identifier


redwynskaja
2018-10-10 18:34:40

i defined (define pars (hash …))


samth
2018-10-10 18:34:48

what does (unpack-hash (hash ...)) do?


samth
2018-10-10 18:35:07

macros don’t look at what you defined it to be


samth
2018-10-10 18:35:19

they match the syntax of the arguments


samth
2018-10-10 18:35:35

which here is just an identifier


redwynskaja
2018-10-10 18:35:42

it does what i expect …


redwynskaja
2018-10-10 18:36:56

That works :_( so i was confused.


redwynskaja
2018-10-10 18:37:23

so a macro can not access anything i defined as described?


samth
2018-10-10 18:37:30

right


redwynskaja
2018-10-10 18:37:46

because the pars only exist at runtimeß


redwynskaja
2018-10-10 18:37:47

?


redwynskaja
2018-10-10 18:39:08

Thanks for clearing my understanding and the issue up :grinning:


samth
2018-10-10 18:40:20

yes, that’s correct


pocmatos
2018-10-10 20:06:01

How can I wait on an input port until there are bytes to consume? I see the eof-evt but that’s the opposite of what I need… I want to basically do a blocking read on an input port.


soegaard2
2018-10-10 20:06:55

Blocking read? But read, read-bytes etc block as standard.


samth
2018-10-10 20:07:33

you might also be interested in read-bytes-evt


pocmatos
2018-10-10 20:29:52

@soegaard2 doesn’t look like it, read is returning eof when there’s nothing in the fileport.


soegaard2
2018-10-10 20:30:13

that surprises me


ryanc
2018-10-10 20:30:43

“A port can be used as a synchronizable event. An input port is ready for synchronization when read-byte would not block…” (from http://docs.racket-lang.org/reference/ports.html)


pocmatos
2018-10-10 20:30:46

@samth but you need to set a certain number of bytes to read. i use fasl->s-exp to read from the port.


soegaard2
2018-10-10 20:32:15

is it a standard file or a file-stream-port ?


pocmatos
2018-10-10 20:32:56

@ryanc thanks, interestingly that seems to imply read blocks but not the way I am seeing it…


pocmatos
2018-10-10 20:33:06

@soegaard2 that’s a file-stream-port from a subprocess.


soegaard2
2018-10-10 20:33:14

hmm


lexi.lambda
2018-10-10 20:34:04

it won’t (or at least shouldn’t) return eof unless the other end of the port is genuinely closed.


pocmatos
2018-10-10 20:34:14

ok, let me do some further experimentation to see what’s happening…


pocmatos
2018-10-10 20:34:56

@lexi.lambda oh… good one, it might be closed in my specific example since the process died.


lexi.lambda
2018-10-10 20:35:33

yes, if the process is dead, and you’ve read everything that was in the port, then it would return #<eof>.


abmclin
2018-10-10 20:47:04

I’m seeing a behavior with local Racket installations I don’t understand why is happening.

To give a brief overview, I’m seeing this on a Windows machine, I have an existing test suite for an application. When I use a local Racket installation extracted from a current minimal release tar file downloaded from http://racket-lang.org\|racket-lang.org to run the suite, the test suite runs much slower compared to when the system Racket installed via standard Window installer is used to run the test suite; consistently an average of 5 mins versus 46 seconds test suite runtime when using local versus system Racket. I figure it’s probably an issue with zo files not being used even though the the tar file is bundled with zo files. When I run raco setup over the local racket installation, the test suite runs much faster, achieving parity with the system Racket times.

This has been the case for a while, across several Racket versions now. It was a nonissue, I had other things to worry about. Recently I copied the local Racket installation and the test suite to another location, when I reran the test suite, it ran much slower which surprised me. All of the source and zo files in the copied local Racket installation are identical to the original one yet the copied test suite is taking multiple minutes to complete instead of less than one minute as I had been expecting.

If I run raco setup again over the copy, the test suite runs quickly again. I find this puzzling, are zo files sensitive to their filesystem locations? Is there a reason why copying a Racket tree to another location would result in a behavior that suggests zo files are no longer being loaded?


samth
2018-10-10 20:48:24

@abmclin my initial guess is that the timestamps are off somewhere


samth
2018-10-10 20:48:34

Racket won’t use .zo files that are out of date


samth
2018-10-10 20:48:51

so if the .rkt file is newer than the .zo file, then it won’t use the .zo file


abmclin
2018-10-10 20:49:57

ok so maybe the copying process is copying zo files before rkt files which could account for that. It’s odd though, why would Windows copy zo files first before rkt files?


samth
2018-10-10 20:50:34

I don’t know


samth
2018-10-10 20:50:47

but that’s what I would look for if this happens again


abmclin
2018-10-10 20:51:24

I guess it shows that I cannot depend on the static relationship of files and their timestamps to be preserved across copies


samth
2018-10-10 20:53:23

again, I don’t actually know if this is what happened to you


samth
2018-10-10 20:53:27

but it’s a theory


abmclin
2018-10-10 20:53:45

I’m going to see if I can prove or disprove the theory


abmclin
2018-10-10 21:03:26

@samth ok if I make arrangements for the original timestamps to be preserved when copying the original local Racket installation and the test suite files, the runtime does not suffer, so this would be evidence in support of your theory. My additional supplemental guess is that unless sufficient care is taken, the order of which zo and rkt files are copied may be nondeterministic.


abmclin
2018-10-10 21:04:13

so it’s something for me to be aware of for the future


greg
2018-10-10 21:33:22

Or unless it is the current-read-interaction of certain #langs, which delimit expressions with eof :grin:


greg
2018-10-10 21:36:11

But that’s not a port, so yeah.