
Typically, yes, we’d use threads and channels for that

You should also look at delay/thread
, which handles some of the communication for you for simple situations like your example. The difference is that you need to use force
to get the value.

Awesome thanks for your reply, one more question, I’m not sure which way might be more Racket-y ?
(define g5 (delay/thread 5))
(define g6 (delay/thread 6))
(define g7 (delay/thread 7))
(define f5 (force g5))
(define f6 (force g6))
(define f7 (force g7))
(display (+ f5 f6 f7))
Or
(let* ([g5 (delay/thread 5)]
[g6 (delay/thread 6)]
[g7 (delay/thread 7)]
[f5 (force g5)]
[f6 (force g6)]
[f7 (force g7)])
(display (+ f5 f6 f7)))

The define
approach is recommended Racket style.


It’s very useful to know, thanks @notjack