123456789101112131415161718192021222324252627 |
- (import
- (except (rnrs base) map)
- (only (guile)
- lambda* λ
- unless))
- (define-syntax once!
- (λ (stx)
- (syntax-case stx ()
- [(once! exprs ... flag)
- (syntax
- (unless flag
- exprs ...
- (set! flag #t)))])))
- (define already-happened #f)
- (once! (simple-format (current-output-port) "~a\n" "This should only work once.")
- (simple-format (current-output-port) "~a\n" "With this second message.")
- already-happened)
- (once! (simple-format (current-output-port) "~a\n" "This should only work once.")
- already-happened)
|