A `define/delay` macro for this might be a good addition to `racket/promise`:
(define-simple-macro (define/delay id:id expr:expr)
(begin (define p (delay expr)) (define (id) (force p
(define/delay conf
(with-input-from-file "db.conf" read-json))
(conf) ;; forces promise
--
You received
On Wednesday, April 26, 2017 at 12:12:26 PM UTC+8, David K. Storrs wrote:
>
> I could do it with a parameter but that's only sweeping the above ugliness
> under the rug:
>
> (define conf (make-parameter #f))
>
> (define (read-conf)
> (or (conf)
> (begin
> (conf (with-inp
2 matches
Mail list logo