chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about how to check a symbol is bound


From: Pan Xie
Subject: Question about how to check a symbol is bound
Date: Fri, 23 Jun 2023 12:07:37 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

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

[Prev in Thread] Current Thread [Next in Thread]