this post was submitted on 17 Oct 2023
3 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] carlgay@alien.top 1 points 1 year ago (8 children)

(read) returns whatever the type of its input was. If you enter a string literal it returns a string, if you enter a symbol literal it returns a symbol, if you enter a numeric literal it returns a number, etc.

[–] AbstProcDo@alien.top 1 points 1 year ago (3 children)

I assume the read function initially reads the input as a symbol type, and subsequently, during the evaluation process, converts it into the corresponding data type. This two-step process involves reading the input as a symbol and then evaluating it to obtain the appropriate type.

[–] lispm@alien.top 1 points 1 year ago

Why would you assume that?

load more comments (2 replies)
load more comments (6 replies)