[plt-scheme] structure, procedure, and keyword arg

From: YC (yinso.chen at gmail.com)
Date: Wed Jul 16 17:08:07 EDT 2008

Hi -

it seems that the structs marked as procedures cannot accept keyword
arguments, even if the procedure in prop:procedure does.  Is this by design
or there is a different way to mark struct as keyword procedures?

Thanks,
yc

> (define-struct *res (filter args)
  #:property prop:procedure
  (lambda (s x #:error (e #f))
    (let ((res (apply (*res-filter s) (cons x (*res-args s)))))
      (if (not e)
          res
          (error 'restriction))))
  )
> (define color (make-*res (lambda (x enum) (member x enum)) '((red white
blue))))
> (color 'black #:error #t)
;; => error
procedure application: expected a procedure that accepts keyword arguments,
given #(struct:*res #<procedure:...t/valere/res1\
.ss:10:25> (red white blue)); arguments were: black #:error
#t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080716/252b249c/attachment.html>

Posted on the users mailing list.