In elisp, symbols serve as fundamental data structures that are more foundational compared to strings. This distinction often caused confusion for me until my encounter with the read function.

 ~ $ (type-of (read))
 symbol

The fact that the read function yields symbols instead of strings from user-input was a delightful revelation. This discovery convinces me that the fundamental nature of symbols in elisp when compared to strings.

  • 7890yuiop@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago
    (type-of (read "foo"))
    symbol
    
    (type-of (read "\"foo\""))
    string
    
    (type-of (read "42"))
    integer
    
    (type-of (read "[42]"))
    vector
    
    (type-of (read "(42)"))
    cons
    

    Etc, etc…

    The lisp reader reads text and it produces lisp objects of various types (which might later be evaluated as code).