Extracting fields from a define-type object in Scheme
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-04-14T00:30:35Z
Indexed on
2010/04/14
0:33 UTC
Read the original article
Hit count: 305
Scheme
Hi,
I am trying to extract the field 'name' or 'named-expr' from the following object:
(bind 'x (num 5)) ;; note that this is not a list, but a type Binding
With the Binding definition:
(define-type Binding (bind (name symbol?) (named-expr WAE?)))
I have tried, but received the error "reference to an identifier before its definition: Binding-name." Here is what I tried typing:
(begin (Binding-name (bind 'x (num 5)))) (begin (define x (bind 'x (num 5))) (Binding-name x))
Thank you!
© Stack Overflow or respective owner