[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: symbol is nested in #{ ...... }#
From: |
Tomas Volf |
Subject: |
Re: symbol is nested in #{ ...... }# |
Date: |
Thu, 4 Jan 2024 11:40:53 +0100 |
On 2024-01-04 11:15:55 +0100, Damien Mattei wrote:
> Hi,
> why does
> (string->symbol "#:hello")
> $1 = #{#:hello}#
>
> gives #{#:hello}# in guile instead of #:hello ?
My understanding is that keywords are not the same as symbols, that is why you
get a different representation.
>
> like in Kawa or Racket
>
> i understand it is special to guile as i can write:
> scheme@(guile-user)> #:hello
> $1 = #:hello
>
> but then how can i generate a #:hello from a string or a list of char?
You need to create a symbol and after that a keyword from it:
scheme@(guile-user)> (eq? #:hello (symbol->keyword (string->symbol
"hello")))
$1 = #t
There might be a direct way, but this is what I managed to put together after
digging in the manual.
Have a nice day,
Tomas Volf
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
signature.asc
Description: PGP signature