
Hi, is this supposed to type-check? (it currently does) : #lang typed/racket/base
(: test1 (->* [Integer]
[Integer
Integer]
Integer))
(define (test1 a [b 'symbol])
(cond
[(and a b) 1]
[else 2]))
(define (run1)
(test1 0 1 2))
I expected that the arity mismatch and type mismatch for the second argument would be caught. I can make an argument for the default argument. Also for a more restrictive type arity definition, but not a more permissive as I have here.

That arity mismatch should definitely be caught

I’m curious how frequently used the generic-bind package is. I was reviewing/tweaking some old code that was discussed <https://groups.google.com/g/racket-users/c/6Lk1BHmpNjc/m/CTO-fwzZUfUJ|on the mailing list> and came across both https://github.com/AlexKnauth/defpat\|defpat and https://docs.racket-lang.org/generic-bind/index.html\|generic-bind . Given Racket’s capabilities, I would think nice deconstruction forms would be commonly used, but my impression is that they aren’t. I’m curious if I’m wrong, or if right, why.

It’s nice that I don’t have to create a custom stream, but I think I’m not crazy enough about the syntax to use it i.e. (neighbor dst)
vs. ($ (cons neighbor dst))
(for/list ([ (neighbor dst) (pair-stream pairs) ])
(cons p dst))
(~for/list ([ ($ (cons neighbor dst)) pairs ])
(cons p dst))

What is the best way to dynamically read the program and convert it into Racket code and evaluate it? I use eval to evaluate a code snippet and experience performance degradation.
cpu time: 466 → cpu time: 2565
Only measure the execution time, not compile time.

My first thought is that your program isn’t in a module, and that’s causing the slowdown

Yes, I just wrap whole code into a block and evaluate it with (eval code ns)
. How can I improve it?

Well, first check if my hypothesis is right

But if so, you would need to put the code in a module

Thanks, I wrapped it with (module temp racket …)
, now it performs the same.

Are there best practices for documenting a #lang
that reexports several functions from another library (e.g. the Racket stdlib)?

For example, should the language’s documentation provide its own documentation of those functions, or should it just link to the original library’s documentation?