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!
So I just figured this out, I had to use the name ‘bind’ within the Binding type.
This work:
(begin (bind-name (bind ‘x (num 5))))