mflatt
2017-7-15 11:39:50

@notjack For things like flushing output ports, the callback should be preserved for future flushes


zenspider
2017-7-15 22:05:23

How am I supposed to write this?

(define-syntax (function stx)
  (syntax-parse stx
    [(_ id:id)
    #'(if (identifier-binding #'id)
          (if (procedure? id)           ; blows up here for missing
              id
              (or 'ERROR (error 'function "~v is not a function" id)))
          `(function ,'id)
        )]))

(define x 42)
(define y (fn 'y (lambda (x) 42)))

(function x)                            ; 'ERROR
(function y)                            ; (function y)
(function missing)                      ; missing: unbound identifier in module

zenspider
2017-7-15 22:09:31

aaaaah… I push the #' down to the true and false results…


zenspider
2017-7-16 01:24:11
redex-check: /Users/ryan/Work/git/zenspider/schemers/racket-summerschool/driver.rkt:70
no counterexamples in 1000 attempts

notjack
2017-7-16 03:08:27

@mflatt I think I’m missing an understanding of when plumbers are flushed then. Wouldn’t an output port’s flush callback only be called just as a racket process was exiting or if someone manually called plumber-flush-all? Are there times other than exiting that plumbers are flushed automatically?