Hi guys, 
I’m trying to understand an example from the Racket manuals. 

(struct mood-procedure (base rating)
  #:property prop:procedure (struct-field-index base))

(define happy+ (mood-procedure add1 10))
 
(happy+ 2) <= 3

How does this work? It appears that prop:procedure is predefined. It appears 
that prop:procedure is assigned the value of whatever is assigned to the base 
slot of the struct, in this case add1. But although mood-procedure is a struct, 
happy+ appears to be a procedure! If I make mood-procedure transparent then 
happy+ looks like this:

        (add1 #<procedure:add1> 10)

I’m not sure how the #:property kw made this transformation, nor what it means 
in terms of the uses of #:property. Any insight is appreciated.

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to