
Is there something like case
that works with arbitrary expressions, not datums? I’m trying to do something like…
(define status-not-enqueued 'not-enqueued)
(define status-enqueued 'enqueued)
(define status-processed 'processed)
(define status status-processed) ; imagine this being a much more interesting expression.
(case status
[(,status-not-enqueued) 1]
[(,status-enqueued) 2]
[(,status-processsed) 3]
[else 4])
But that obviously doesn’t work :slightly_smiling_face: The output is always 4. I don’t want to hardcode the 'not-enqueued
(and the other symbols) directly into the case
(in case I later decide a different representation for the different kinds of statuses) and I don’t want the repetition of using eq?
in a cond
. What’s the intended way to do something like this? Or am I stuck with using cond
?

Also, I tried joining the Discord but the invite doesn’t seem to work.


People usually use match
for this


Or the good old evcase
.

I think I’m going to use evcase
because that was exactly what I was looking for… (even if it is from a “legacy library”). Thanks both!

@spdegabrielle :point_up:

otherwise it’s probably just a matter of (define-syntax-rule (eqcase expr [val body ...] ...)
(let ([v expr])
(cond [(eq? v val) body ...] ...)))

Does this link work? https://discord.gg/6Zq8sH5\|https://discord.gg/6Zq8sH5

Nevermind… It’s just Discord giving unclear error messages. I was semi-logged in (as in: I had to enter my password again to open the discord web app, but I was still “logged in” as it was only asking for my password). Been a while since I used Discord.

(hash-ref
(hash status-not-enqueued 1
status-enqueued 2
status-processed 3)
status
4)

(hasheq
probably)

Thanks - that’s a relief.

Does the object oriented system support copy constructors?

No, because there’s no copy operation

Random thought/question (quought?)…has anyone tried making something like a mind map utility using racket, where there are graphics that can be moved around a canvas with click and drag or programmatically lay them out, clicking images can bring up menus or open other windows for navigation, etc.? Any small samples of this type of applications to use for guidance?

sounds like snips + pasteboard; see https://alex-hhh.github.io/2018/10/chess-game-using-racket-s-pasteboard.html

I’ll take a look, thanks!

I think someone did a long time ago - might be worth a google . Also this might be helpful https://docs.racket-lang.org/draw/Drawing_Conveniences.html#%28part._.Arrows%29\|https://docs.racket-lang.org/draw/Drawing_Conveniences.html#%28part._.Arrows%29
Probably want before curves too

Thank you!

Just to make sure: do we have something to union multiple free-id-tables, i.e. an equivalent to hash-union for hashes?