
On my Manjaro [Arch] GNU/Linux machine, I installed 8.1, overwriting the old 8.0. I used Unix-style install, default to /usr/bin, because apparently that’s what I did the last time. In the terminal, when I type racket
the banner comes up right away, but the prompt takes 43 seconds to appear. If I type drracket
I get this: $ drracket
standard-module-name-resolver: collection not found
for module path: (lib "drracket/drracket.rkt")
collection: "drracket"
in collection directories:
/home/gknauth/.racket/8.1/collects
/usr/share/racket/collects/

This time I used the .sh script from http://racket-lang.org\|racket-lang.org. Last time I must have used the GUI package manager from Manjaro. I’m going to try uninstalling from that first and then try re-installing.

I uninstalled from the Manjaro GUI, then since 8.1 wasn’t available yet on Manjaro/Arch, I re-ran the install script, installing to ~/Apps/racket–8.1, and everything’s fine now.

I think there are already some packages or tools for managing multiple Racket installations (e.g., multiple versions). Can someone remind me what they are?

Asking because I’ve accidentally ended up creating another one in the process of building a cross-compilation wrapper…

interesting - i started created one as well called raclette but I think nobody uses it besides me. :slightly_smiling_face:

i just use it to ease compilation of racket locally whenever i need one.

Although to be honest I haven’t touched it in a while.



Which is probably the one @mflatt was thinking of

wow - lol , everyone has their own… didn’t know that one from @asumu

I think something like rustup
+ integration with that for the raco
/racket
binaries would be really nice to have

how does raclette
work (great name btw)

The idea is really that you can just say - compile me this version and add these packages. Although I didn’t really advertise it because it’s missing some essential bits for public consumption and has been useful mostly for me.

So, it always at the moment compiles racket from source. Which some people might not want.

ah

However, I can choose, compile with ubsan or lto, or O0, or march=native, etc.

I think at some point @mflatt changed something in the build system that broke it and I haven’t had the time to fix it so… that’s antoher thing to do… :slightly_smiling_face:

but I agree that having something like rustup would be great.

the scripts I use (originally by Eli Barzilay) are really good for switching between lots of different installations, but don’t do the installation for you at all

Thanks! I doubt that raco cross
is going to be a replacement for what you use, but it will turn out to be a relatively simple way to get at a minimal Racket installation.

well we should think about how to integrate them, at some point

@dsmith has joined the channel

@popa.bogdanp I think the local_catalogs feature is duplicating things: https://github.com/racket/typed-racket/pull/1095/checks?check_run_id=2569198853#step:3:45

Also, it doesn’t seem to be working correctly, see: https://github.com/racket/typed-racket/pull/1095/checks#step:5:7 which should be using the local catalog

Here’s one with a lot more debugging output: https://github.com/racket/typed-racket/runs/2569526513?check_suite_focus=true

macro-defining macro shenanigans follow:
I’m writing a defmacro
form to make it possible to write un-hygienic (or manually hygienic, I guess) macros à la Clojure/Common Lisp (think targeted at students with no time to explain Racket’s awesome-but-complex macro system). Some examples:
;; numeric if
(defmacro (nif num-expr neg-expr z-expr pos-expr)
(let ([num-sym (genysm)])
`(let ([,num-sym ,num-expr])
(cond
[(negative? ,num-sym) ,neg-expr]
[(zero? ,num-sym) ,z-expr]
[(positive? ,num-sym) ,pos-expr]))))
;; anaphoric ->
(defmacro (a-> e . exprs)
(if (empty? exprs)
e
`(let ([that ,e])
(a-> ,(first exprs)
,@(rest exprs)))))
Anyway, I have things mostly working (:crossed_fingers: ?) except gensym
. The following version of nif
from above works, except we have that pesky little hard-coded name for the binding:
(defmacro (nif num-expr neg-expr z-expr pos-expr)
`(let ([num ,num-expr])
(cond
[(negative? num) ,neg-expr]
[(zero? num) ,z-expr]
[(positive? num) ,pos-expr])))
But when I try the manually hygienic version with gensym
, I get (from raco test
):
defmacro.rkt:31:18: genysm: reference to an unbound identifier
at phase: 1; the transformer environment
in: genysm
context...:
/Applications/Racket v8.0/share/pkgs/compiler-lib/compiler/commands/test.rkt:371:27
/Applications/Racket v8.0/share/pkgs/compiler-lib/compiler/commands/test.rkt:373:0: call-with-summary
.../private/map.rkt:40:19: loop
/Applications/Racket v8.0/share/pkgs/compiler-lib/compiler/commands/test.rkt:1101:1: test
body of "/Applications/Racket v8.0/share/pkgs/compiler-lib/compiler/commands/test.rkt"
/Applications/Racket v8.0/collects/raco/raco.rkt:41:0
body of "/Applications/Racket v8.0/collects/raco/raco.rkt"
body of "/Applications/Racket v8.0/collects/raco/main.rkt"
Thoughts? (source attached)

I did eventually realize that to get empty?
/first
/rest
working for a->
I had to (require (for-syntax racket))
, but that didn’t fix gensym

And I think gensym
works at syntax time, because (define-syntax (foo s) (datum->syntax s (gensym)))
expands (and then gives an error about the gensym)

What’s the difference between this defamacro and the builtin defmacro ?

Since Slack was dumb, here’s the source for defmacro
:
(define-syntax defmacro
(syntax-parser
[(_ (name:id param:id ...) body:expr ...+)
#'(define-syntax (name stx)
(syntax-parse stx
[(_ param ...)
(datum->syntax stx
(let ([param (syntax->datum #'param)]
...)
body ...)
stx)]))]
[(_ (name:id param:id ... . varargs:id) body:expr ...+)
#'(define-syntax (name stx)
(syntax-parse stx
[(_ param ... . varargs)
(datum->syntax stx
(let ([param (syntax->datum #'param)]
...
[varargs (syntax->datum #'varargs)])
body ...)
stx)]))]))

@soegaard2 there’s a builtin? :exploding_head:


well… nothing to see here… just a waste of an hour or two :slightly_smiling_face:

Still curious why this didn’t work, but at least I can stop working on it

Maybe the code for the builtin contains a clue?

But where is it …

The source is here https://github.com/racket/compatibility/blob/master/compatibility-lib/compatibility/defmacro.rkt, looking for clues now

No way—that builtin has the same issue.

genysm -> gensym

sigh thank you :tada: syntax highlighting wasn’t coloring, so I should have known…

The secret sauce is the hash table keeping track of the relation between the generated syntax objects and the original syntax.

how stupid is this on a scale of 10 to 1, 1 being most: download sexpr over http in macro, write sexpr to module file, require module in current program

also why isnt background expansion allowed to do that

I cant comment on stupid, but it at least sounds fun, if possibly insecure. I bet Paul Graham would have thoughts from back in the via web days

Seems reasonable. Background expansion won’t do that because you don’t really want to continually make network requests in the background

ok. unfortunately it means I don’t get any ide features :disappointed:

paul graham would say “ah yes, I have about 16 of those requests in my most recent image, and they randomly run at compile time or run time based on how many layers of macros they are inside of, and the mood of the compiler on that particular day”

@jagen315 Do you mean Dr Racket background expansion, or something else? What sort of IDE features do you have in mind?

@samth I think it might depend? On the requests (e.g. is there a cache, is an existing connection reused vs. created each time, etc.). And can the user disable it? But I don’t understand the context.

I recommend a cache that allows you to read from disk without hitting the network every time. That will both make background expansion work and is probably what you want anyway

Oh is this something ~= Dr Racket does background expansion in a sandbox that disallows network I/O, or something like that??

@samth I agree, but I can’t because the background expander throws an error when I try to open the socket (or open the file)

(Also, sorry I didn’t mean to “butt in”, but background expansion and IDEs are relevant to my interests, so curious!)

no worries. not butting in

Opening a socket will indeed error

Opening a file for writing will too

But reading a file won’t

So if you click the run button the first time, then background expansion won’t need to use the network or write to a file and will succeed

oh I see. so I’d just have to run the program once, and then I’d get my drracket arrows

Exactly

Yes

Also writing to files

#lang racket
(define width 2)
(define height 3)
(define lay 4)
(define 3d (make-vector 2 (make-vector lay (make-vector (* width height) 0))))
(define (2d->1d x y w)
(+ x (* w y)))
(define (mut 3d-index)
(define z (vector-ref 3d 3d-index))
(for ([y-index (range 0 height)])
(define row (vector-ref z y-index))
(for ([x-index (range 0 width)])
(define index-into-x (2d->1d x-index y-index width))
(vector-set! row index-into-x (random 0 20))
)))
(for ([i (range 0 (vector-length 3d))])
(mut i)
(println i)
(println (vector-ref 3d i)))
(println "final")
(println 3d)
how come the final resulting vector is not what i expect? 0
'#(#(5 2 1 4 5 6) #(5 2 1 4 5 6) #(5 2 1 4 5 6) #(5 2 1 4 5 6))
1
'#(#(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4))
"final"
'#(#(#(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4)) #(#(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4)))
;what i expect is a combination of both stacked other like this:
#(#(#(5 2 1 4 5 6) #(5 2 1 4 5 6) #(5 2 1 4 5 6) #(5 2 1 4 5 6))
#(#(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4) #(4 8 2 0 2 4)))
this is a small snippet from a sort of complex program converting maps. I know it can be done a different way and done better but right now I just wanna know why the resulting vec isnt what i expect it.. I’m printing the state of the vec right before i print final but yet they’re different

seems like someone on the discord said that the vectors are aliasing each other! How was I supposed to know >__>…. should probably put a warning that nested (define v (make-vector 2 (vector)))
might alias

> I think the local_catalogs feature is duplicating things: https://github.com/racket/typed-racket/pull/1095/checks?check_run_id=2569198853#step:3:45 I think that’s just an issue with the output. It’s showing both the output of the shell command as well as the console.log
s from the action. I’ll push a fix.

OK, both problems are fixed in v1.3.1
:
https://github.com/Bogdanp/typed-racket/runs/2573151117?check_suite_focus=true
The issue was that the action was only setting the catalogs in the user scope. Now it sets them in both scopes.

That’s a rite of passage :slightly_smiling_face:
Everyone faces that the first time they represent a board with a vector of vectors.

I do think adjusting the documentation to include the word “share” and show an example about this tricky behavior is worthwhile