
What is the reason why https://github.com/racket/racket/blob/master/racket/collects/pkg/private/new.rkt doesn’t use #lang at-exp racket/base
?

@samdphillips are you asking because of that “Because I wish I had @-expressions” comment? https://github.com/racket/racket/blob/master/racket/collects/pkg/private/new.rkt#L42

That and there is a lot of inline text in the file.

Maybe it’s so it will work in minimal racket?

I thought it may be for some bootstrapping reason, but that makes even more sense.

Right: at-exp
is in a package right now, and nothing in “collects” can depend on a package.

Hi, All. Is there a mutable version of for/hash
?

Sorry, I didn’t make myself clear.

There’s one called for/hash!
in someone’s package

As in, something like for/mutable-hash
that does the same thing as for/hash
but returns a mutable hash?


But no, there’s no built-in for/hash!

I mean what is the equivalent to for/hash that returns mutable hash tables?

There isn’t an equivalent built-in to racket. You can make your own for/xxx
forms using a library I wrote though.

for/fold with a mutable hash accumulator

I mean, do you really need an accumulator?

You can just use for
.

Or just for

Yup

this was a fun exercise: (require rebellion/collection/entry
rebellion/streaming/reducer)
(define (hash-set-entry! h e)
(hash-set! h (entry-key e) (entry-value e))
h)
(define into-mutable-hash
(make-effectful-fold-reducer make-hash hash-set-entry! values))
(define-syntaxes (for/mutable-hash for*/mutable-hash)
(make-reducer-based-for-comprehensions #'into-mutable-hash))
(for/mutable-hash ([...]) ...)

note: requires the for
loop to return an (entry k v)
struct in the loop body rather than (values k v)

That’s so much better, actually. I think for
should support splicing out, and that really should be implemented by values

(for/list ([i 5]) (values i (add1 1)))
produces
'(0 1 1 2 2 3 3 4 4 5)

But with the way values
is used right now (e.g., for for/hash
), it’s not possible to do that

@sorawee oh that’s a neat idea, I hadn’t thought of using values like that

would it only be for values
or would it be for arbitrary sequences?

I’d say only values

because you might want to produce a list of list of stuff

arbitrary sequences would mean it would be ambiguous if you mean (list a a b b)
or (list (a a) (b b))
I think

Yes

would it be acceptable if instead of this being built into for
or for*
, you had to use a variant of for
?

because I think you could do this with for/reducer

Wow, that’s cool

I still wish for a built-in support tho

thanks :D it was very fun to make

me too

Hi. Does anyone know if the Racket package server is having issues? It keeps saying “This package has been modified since the package index was last rebuilt. The next index refresh is scheduled for _____”, but the scheduled time keeps moving forward.

Last time I tried to make sense of when builds actually occur, I had given up because it was hours, maybe tens of hours, between a detected change on my package (git push) until the changes were available on the catalog. I wasn’t able to establish a pattern. So I am also interested how this works. :)

@stephen does it still update anyway? Maybe it’s just that you’re triggering a new refresh each time you look it up?

I’ve noticed this as well. No changes to any of my packages have been picked up by the package index in the last couple of days. The last-updated build information for some of the packages is out of sync with the build server, also.
For example, the index says deta-test has failing tests:
https://pkgd.racket-lang.org/pkgn/package/deta-test
but pkg-build reports no test failures:
https://pkg-build.racket-lang.org/server/built/test-success/deta-test.txt

I think the internal state of the index is currently messed up.

@winny the package index refreshes every 5 minutes and detects modified packages. Package builds run once a day and they entail rebuilding any modified packages up to that point. Package builds can take a long time because there are usually quite a few packages that need building.

cc @jeapostrophe