[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about how to check a symbol is bound
From: |
Kon Lovett |
Subject: |
Re: Question about how to check a symbol is bound |
Date: |
Fri, 23 Jun 2023 06:35:00 -0700 |
> On Jun 22, 2023, at 9:07 PM, Pan Xie <xiepan@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
#;2> (symbol-value 'foo #f)
#f
(symbol-value foo #f) is asking for the symbol-value of the derefed 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
#;6> (symbol-value (string->symbol (string-append "scheme" "#" "list")))
#<procedure (scheme#list . lst)>
>
> I expect (unbound? foo) will return True value, but it just throw exception.
#;7> (unbound? ‘foo)
#t
#;9> (unbound? (string->symbol (string-append "scheme" "#" "list")))
#f
>
> 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
>
>
- Question about how to check a symbol is bound, Pan Xie, 2023/06/23
- Re: Question about how to check a symbol is bound, Shawn Wagner, 2023/06/23
- Re: Question about how to check a symbol is bound, Pan, 2023/06/23
- Re: Question about how to check a symbol is bound, Peter Bex, 2023/06/23
- Re: Question about how to check a symbol is bound, Pan Xie, 2023/06/23
- Re: Question about how to check a symbol is bound, Lassi Kortela, 2023/06/23
- Re: Question about how to check a symbol is bound, Peter Bex, 2023/06/23
- Re: Question about how to check a symbol is bound, Thomas Chust, 2023/06/23
Re: Question about how to check a symbol is bound,
Kon Lovett <=