Ah, that make sense. It seems I can just use the '##sys#slot' procedure to accomplish all that tasks. Would you please elaborate about the "transformed name"? I see there are codes reference symbols like "##sys#slot" or "scheme#list", but I can't find document describe them. Is there any document I can look into? More specifically, how can I transfer "list" to "scheme#list"? Is there procedure can do that?

On 6/23/23 13:28, Shawn Wagner wrote:
Looks like unbound? and symbol-value take quoted symbols if passing them directly: And for list you have to use the transformed name scheme#list

#;2> (unbound? 'x)
#t
#;3> (define x 1)
#;4> (unbound? 'x)
#f
#;5> (symbol-value 'x)
1
#;6> (symbol-value 'scheme#list)
#<procedure (scheme#list . lst)>

On Thu, Jun 22, 2023 at 10:15 PM Pan Xie <xie...@skyguard.com.cn <mailto:xie...@skyguard.com.cn>> wrote:

    Hello

    I am new to CHICKEN scheme and here is a (very) quick question of
    how to
    check whether a symbol is bound.

    I know it doable but I can't find the way.

    I don't find the methods from the main CHICKEN manual document. Then I
    import the "symbol-value-utils" module. I believe the "unbound?" or
    "symbol-value" will do what I want, but to my surprise they does NOT:

    I expect `symbol-value' will give me value of a symbol, but it will
    throw exception for an
    undefined symbol, even I provide the default value:

    (symbol-value foo #f)
    Error: unbound variable: foo

    I expect (symbol-value (string->symbol "list")) will give me the list
    procedure, but what I get is '#f'

    (symbol-value (string->symbol "list"))
    #f

    I expect (unbound? foo) will return True value, but it just throw
    exception.

    Does CHICKEN scheme provide facilities that make user check whether
    arbitrary symbol is bound or get its value, just like the `boundp' or
    `symbol-value' in Common Lisp?

    Thanks
    Pan




Reply via email to