You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
beautiful-racket/beautiful-racket/br/demo/hdl/helper.rkt

21 lines
488 B
Racket

#lang racket/base
(provide (all-defined-out))
(define-values (input-wire input-wire? input-wire-get)
(make-impersonator-property 'input-wire))
(define (make-input)
(impersonate-procedure
(let ([val #f])
(λ ([arg #f])
(if arg
(set! val arg)
val)))
#f input-wire #t))
(module+ test
(require rackunit)
(define in-wire (make-input))
(define other (λ () (+ 2 2)))
(check-true (input-wire? in-wire))
(check-false (input-wire? other)))