I overestimate myself with the help of the Scheme, and I ran into a problem that probably reflects a fundamental misunderstanding on my part.
Let's say that I am doing the following in a schema (using Guile in this case, but this is the same in Chicken):
> (define x 5) > x 5 > (string->symbol "x") x > (+ 5 (string->symbol "x")) <unnamed port>:45:0: In procedure #<procedure 1b84960 at <current input>:45:0 ()>: <unnamed port>:45:0: In procedure +: Wrong type: x > (symbol? (string->symbol "x")) #t > (+ 5 x) ; here x is dereferenced to its value 5 10 > (+ 5 'x) ; here x is not dereferenced <unnamed port>:47:0: In procedure #<procedure 1c7ba60 at <current input>:47:0 ()>: <unnamed port>:47:0: In procedure +: Wrong type: x
I understand that string->symbol returns the character x , which is effectively quoted. However, I cannot figure out how to use the character returned by string->symbol in any later context. How can I calculate this character?
To indicate why I want to do this, it is that I am writing a C program with a built-in Guile. I would like to be able to access the characters defined in Guile by name from C using, for example, scm_from_*_symbol or scm_string_to_symbol . The reasons why these functions do not work, as I thought, they will be related to my main question above. There may be a better way to do what I want to do with Guile, but that's another question. Now I am interested in a fundamental question.
user626998
source share