3 ms·
I don't know about lumen, but i think in Scheme a symbol is "just" an immutable string, except that is used in a different ways for different purposes than stri
by brendyn 6y ago
I don't know about lumen, but i think in Scheme a symbol is "just" an immutable string, except that is used in a different ways for different purposes than strings which are for text.
Here is Guile Scheme (not sure if this is standard or Guile specific):
scheme@(guile-user)> 1e9
$2 = 1.0e9
scheme@(guile-user)> (string->symbol "1e9")
$3 = #{1e9}# ;; This the double quote equivalent for symbols.
scheme@(guile-user)> (define #{1e9}# "foo")
scheme@(guile-user)> #{1e9}#
$4 = "foo"
As you can see, 1e9 is read as a number, but that does not mean it cannot also be a symbol, it just requires us sneaking around the reader or using the quoting construct.