
@zenspider Rather than trying to implement gen:graph
on your own data, could you not just convert your data to one of the graph
library’s built-in graphs for the purpose of calling graphviz
?

Is struct->vector helpful here?

@lexi.lambda to avoid the letter-boxing, I think you need some combination of -a
, -n
, -z
, and -r

@samth thanks, slideshow -anzrx
seems to have done the trick

maybe there should be an option for that

also it should be the default because i never want the other way

This program works: #lang racket/base (for/vector ([x (in-list ’(a b c))]) x)

But (define base-ns (module->namespace ‘racket/base)) (eval ’(for/vector ([x (in-list ’(a b c))]) x) base-ns)

../../Applications/Racket v6.12/collects/racket/private/kw.rkt:979:25: for/vector: undefined; cannot reference an identifier before its definition

@soegaard2 I can’t reproduce that behavior. Your second program works for me on both Racket 6.12 and Racket 7.

Also in the repl? (6.12)

@soegaard2 in the repl:
~ > racket
Welcome to Racket v6.12.
> (define base-ns (module->namespace 'racket/base))
> (eval '(for/vector ([x (in-list '(a b c))]) x) base-ns)
'#(a b c)
>

@lexi.lambda @minond.marcos thanks - I am playing around with (namespace-set-variable-value! ’for/vector hint-for/vector #f base-ns) i.e. replacing the value for for/vector. So I must have succeeded … I guess I’ll have to restart DrRacket to find out.

Yep. Works fine after a restart. Can’t remember the last time where doing something in one tab in DrRacket affected something in another tab.

DrRacket really shouldn’t let you do that, but we never took the plunge on having DrRacket set the code inspector (which would have prevented it).

@soegaard2 did you by any chance install files-viewer in DrRacket

I am asking because it happened to me once after running this plugin - still trying to replicate though

might have been just a fluke

@githree not yet

ok, never mind then

on my todo

I have a commit (not yet merged) for racket-mode: https://github.com/greghendershott/racket-mode/commit/8a74c8e06d6da8ca37626361ab7061c2af7f4c25 Does anyone have any opinions/ideas/suggestions? (I mean about the commit message, the packaging pros and cons. Although if you have Elisp comments that’s fine, too :smile:.)

@mflatt I’ve been discussing with @florence about trying to get a better understanding for why/when syntax-shift-phase-level
is relevant. One area I’ve realized I don’t really understand is how scopes and phases interact across modules, especially since the sets-of-scopes paper does not deal with modules.
I think understand that, within a module, there is both a phase-spanning module scope and a “multi-scope” that represents an infinite set of scopes, with one for each phase. I also believe I understand how this interacts with binding lookup and syntax-shift-phase-level
. What I definitely do not understand is what happens to the binding table when a module is imported at multiple phases.
If I write (module a racket/base (define x #f))
, then (require 'a (for-syntax 'a))
, then is the binding for x
added to the binding table twice, once for each instantiation? If so, how are these distinguished? Alternatively, is there only one binding, with the same phase-spanning scope and the same multi-scope, simply distinguished by some notion of a “current phase level” used at binding lookup time?

In that case, bindings are added twice: once using the phase–0 scope in the enclosing module’s multi-scope, and once using the phase–1 scope in the enclosing module’s multi-scope

Using syntax-shift-phase-level
is rare, but it happens internally when a module
form appears under a begin-for-syntax
, since the module body is always handled at phase level 0

So, in general, when a binding is added to the binding table, are multi-scopes “simplified” to the normal scopes associated with the “current phase”, for some meaning of current phase?

Yes: a set of multi-scopes plus a set of scopes is turned into just a set of scopes by extracting the phase-specific scope from each multi-scope; scope-set-at-fallback
does that

This seems fine. The risk of version skew is high, so the default should be to keep things in sync. It’s not clear to me that not doing that is worth it at all, even as a user option.

Okay, thanks! I think that clears up my confusion, then.

Where is the source for core Racket documentation? Specifically I am looking for the Scribble files for “Syntax: Meta-Programming Helpers”.

You can click the title to get an idea: '(lib "syntax/scribblings/syntax.scrbl")
. That leaves you with more search steps, though, to find https://github.com/racket/racket/blob/master/pkgs/racket-doc/syntax/scribblings/syntax.scrbl

@mflatt Thanks!

I’m trying to write
and read
back a path value, but getting a bad syntax because of #<
, is there a certain reader parameter that I need to set to read back that path value?

Like for instance : (let ((d (open-output-bytes))) (begin (write (build-path "/home/racket") d) (read (open-input-bytes (get-output-bytes d)))))

@cadr Paths are not readable. More generally, write
and read
are not a good choice for general-purpose serialization. They can, however, be used in combination with racket/serialize
to serialize other kinds of values, including paths.

@cadr in this case, you’re serializing something that’s not an arbitrary racket value, so you’ll have to come up with your own serialization

Thanks @lexi.lambda! I asked about the read/write because I’m making Pycket to create and use its own .zo
files and I’m basically using Racket’s compile-file
to do that (Pycket bootstraps Racket through the expander linklet, so it’s really Racket’s compile-file). The problem is when I run that on qq-and-or.rkt
for instance, it generates a bunch of srcloc
s which has paths in it and Pycket is having hard time reading them back to path objects using (again Racket’s) read
.

@samth That’s what I figured, doing exactly that now :slightly_smiling_face:

@cadr are those struct values with a custom-write?

@samth that’s a good point, though I’m not sure yet if they are