
@jlw has joined the channel

Another possible solution, that doesn’t make use of dynamic-wind, would be a computational contract that prohibits calls to control operators: https://www.sciencedirect.com/science/article/pii/S0167642313002347\|https://www.sciencedirect.com/science/article/pii/S0167642313002347

Racket doesn’t have an implementation of computational contracts, but it’s on my TODO list for next year :grinning:

I once made a very crude contract, in the same vein as a computational contract, that could be used to prevent a procedure from being called except in certain special forms.

But it sounds like computational contracts are what I need.

Hello, does anyone have access to the code-listings for all the PoC’s talked about in http://mballantyne.net/publications/extdsls-oopsla2020.pdf? I tried sleuthing on Michael’s github and was able to find ee-lib
, and a few others but was wondering whether there was anything else?


Fantastic! I’ve never seen Zenodo before.


Hi there! Is it possible to have parallel queries in SQLite? For instance, in the snippet bellow I’m querying in a thread and it takes 45s seconds to complete. #:use-place #t
ensures this thread does not block and I’m able to immediately issue another query, but this second one waits for the completion of the first…
Thanks in advance!
(define conn
(virtual-connection
(lambda ()
(sqlite3-connect #:database "/my/database/file.db"
#:use-place #t))))
;; takes 45 seconds to return a value
(void (thread (lambda () (query-value conn "select count(*) from my_expensive_view"))))
;; connects immediately, but returns a value after 45s
(query-value conn "select sqlite_version()")

Did you start estimating of how many coder×weeks this should take to upgrade Racket/gui?

My initial estimate is “a lot”

yeah, sounds like it… :confused:

Reading the list quickly, what gets printed on my retina is “Stop using Gtk…”

Well, GTK2, which is just now EOL, is 18 years old, which would suggest that we have at least 7 more years of support for GTK3.

Hopefully, in the meantime those who have transited will provide useful feedback on how to make this process less painful

Good afternoon, my macro fellows, is it possible to match at least 1 -
using syntax-case
? (foo-macro 10 --------- 20)

You can write arbitrary code, so yes.

#lang racket
(define-syntax foo-macro
(lambda (stx)
(syntax-case stx ()
[(_ n1 dash n2)
(and (identifier? #'dash)
(regexp-match "^-+$" (symbol->string (syntax-e #'dash))))
#'(list n1 n2)]
[_ #'#f])))
(foo-macro 10 --- 20)
(foo-macro 10 +++ 20)

Ah, I see. Thanks! I am spoiled by syntax-parse

Is it normal for raco pkg install graph
to take 30+ minutes of CPU time ? I think all of the other packages I’ve installed have been relatively quick. I’m on Racket v7.9 [cs] if it matters.

Mine finished in 26s, on Macbook Pro M1

soegaard@mbp2 ~ % raco pkg install graph
raco pkg install: package is already installed
package: graph
Was instantaneous here :wink:

lol

Ok, it must be stuck then :(

raco setup: 7 making: <pkgs>/collections-lib/data
raco setup: 7 making: <pkgs>/collections-lib/data/collection
raco setup: 6 making: <pkgs>/functional-lib/data
raco setup: 5 making: <pkgs>/gen-queue-lib/data
raco setup: 5 making: <pkgs>/gen-queue-lib/data/gen-queue
raco setup: 4 making: <pkgs>/graph-doc/graph
raco setup: 3 making: <pkgs>/graph-lib/graph
raco setup: 2 making: <pkgs>/graph-test/tests
raco setup: 1 making: <pkgs>/syntax-macro-lang/tests
raco setup: 1 making: <pkgs>/syntax-macro-lang/tests/syntax
raco setup: 1 making: <pkgs>/syntax-macro-lang/tests/syntax/macro-lang
raco setup: 4 making: <pkgs>/graph-doc/graph/scribblings
raco setup: 7 making: <pkgs>/collections-lib/data/collection/experimental
raco setup: 7 making: <pkgs>/collections-lib/data/collection/private

(7.5 here !?!)

Hmm… I killed the process and re-ran it, now it says “already installed”; I’m skeptical.

Oh, yeah, if you raco pkg install
already, you can’t run it again

I think you should do raco setup --pkgs graph

I just used undirected-graph
, and it worked, but maybe part of the package didn’t get installed? I’ll try setup

Well, for one thing, I think the documentation has not been built yet. And some files might not have been compiled, so it might take long compilation when you use it in your program

Could it possibly be building from source instead of pre-built stuff?

I don’t think so. My Racket is built from source too

raco setup --pkgs graph
appears to be making everything

rip

@benj.calderon has joined the channel

@sorawee do you know why it would make everything instead of just graph
and its dependencies?

I probably should’ve just uninstalled and reinstalled.

When that happens to me, it’s because I change the core Racket source code

@stchang thoughts?

@badkins Are you running CS (as opposed to BC)?

Yes 7.9 CS

As far as I know, graph
is broken for CS.

That’s a pity.

It uses make-sized-byte-string
- shouldn’t be difficult to fix, and I think the problem has been reported, but I’m not sure.

I was able to use (maximum-bipartite-matching (undirected-graph '( ... )))
, and it gave a result. Not the result I was expecting, but I probably gave it incorrect input.

Maybe I haven’t exercised the part that uses make-sized-byte-string
, but the following worked fine on 7.9 CS: #lang racket
(require graph)
(define g (undirected-graph '((2 "c") (3 "c") (1 "r") (2 "r") (3 "r") (3 "s"))))
(maximum-bipartite-matching g)
;; => '((1 "r") (3 "s") (2 "c"))

“rip” indeed. 52 minutes and counting! :) Fortunately, I was able to use teh graph
module while it’s running

I’ve been reading about <https://docs.racket-lang.org/rebellion/Streaming_Computations.html?q=rebellion|Rebellion’s Streaming Computations> and the <https://docs.racket-lang.org/collections/index.html?q=generic%20collection|Generic Collections library> and I’m wondering, has there been any interest/discussion about integrating them?

I would like to, but that would probably look more like designing a new generic collections API than integrating with that existing one, since that library isn’t maintained by the author anymore

You could write a generic collection reducer yourself like this:
(define (into-collection collection)
(make-fold-reducer conj collection))

And then you’d get this:
(into-collection '()) == into-list
(into-collection (set)) == into-set
... etc.

Ah, that’s too bad that it’s no longer maintained, I was hoping to use it to implement sequences in my lang.

Not maintained, but Alexis still accepts PRs I think.

On an unrelated note… I’ve read about them in a few places, but I don’t really understand “disappeared uses” / “disappeared bindings” and what syntax-parse
is doing with the related #:track-literals
option.

Here’s a simple example

#lang racket
(require (for-syntax syntax/parse))
(define >> #f)
(define-syntax (foo stx)
(syntax-parse stx
#:literals (>>)
[(_ a >> b) #'(define a b)]
[(_ a b c) #'(a b c)]))
(foo y >> 2)
(foo + 2 3)
y

The macro foo
is supposed to be either function application or define
, depending on the presence of >>

Now, in DrRacket, try to hover over >>
in (foo y >> 2)
. You will notice that nothing happens

But when you add #:track-literals
, there will be an arrow from >>
to (define >> #f)

It’s called “disappeared” because as (foo y >> 2)
expands to (define y 2)
, the >>
disappears

DrRacket figures out how to draw the arrows by looking at your program after it’s been expanded. So it can’t see anything that disappears during expansion. But it can see syntax properties, so it looks for a disappeared-uses syntax property which macros can shove stuff into to tell DrRacket about the ghosts of departed bindings.

And #:track-literals
option of syntax-parse
simply adds these syntax properties so that you don’t need to add them yourself.

(It should have been the default but it wasn’t implemented at first and there wasn’t a backwards compatible way to make it happen automatically)

Thank-you for the clarification.

Does anyone run into bugs by forgetting to use ~@
to splice in a pattern variable bound to a splicing syntax class? I keep forgetting that splicing classes are implicitly wrapped in a list.

There is a benchmark against Brainfuck-Mandelbrot translates to different languages. Found some interesting results there.
RPython-JIT is roughly equal to our Racket FP version. “Translated to C (-O0)” is roughly equal to our Racket-imperative version. “Translated to C (-O1)” only takes 1.3s. https://github.com/pablojorge/brainfuck#benchmark