this post was submitted on 28 Nov 2023
1 points (100.0% liked)

Emacs

313 readers
2 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
 

I'm a "Neovim Refugee" trying to get a deeper/better understanding of how emacs lisp works and how i can use it to expand on my emacs setup. I have never done anything in lisp before and still struggle to understand how single quotes signify a function or what ever.

With that said, i was also planning on doing AoC this year. Originally i wanted to look into zig or go, but now think that this might be the opportunity to dive into lisp for a bit.

But with knowing basically nothing: Is this even "viable", or advisable? Should i be looking at common lisp instead? Or would you say that's a pretty dumb idea and i should rather learn it in a different way?

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

the quote is arguably the most important part of lisp as it allows symbolic processing (without that macros and eval wouldn't be a thing I reckon).

I'll try to provide a weird explanation. Consider this:

five = 4

So is this a four or a five? The value is four but it's assigned to a symbol "five". When dealing with values, "five + five" will be 8. However, what if I don't care about the values (at least yet)? then I'll be manipulating the expression in terms of the elements (symbols) themselves and not what they signify (values). At that level, we don't even know what + means. You assume it's a math operation because of the semantics you've been taught. for all we know it may be something else entirely, like a variable (did you know that some languages allow you to use chinese glyphs or norse runes for variables?).

So quote operator tells lisp that you don't want the "thing" to be evaluated into the value behind it. (quote five) isn't "4", it's literally the symbol "five". (quote (+ 1 2 3)) isn't 6, it's a list of +, 1, 2, and 3. You can eval that list so lisp executes it: (eval (quote (+ 1 2 3)). Also consider: (quote (1 + 2)) is perfectly fine, it's just a list, but you can't evaluate it as lisp doesn't have a function or operator named 1 (although you may be able to define it yourself)

It was a bit of a weird explanation but i hope it helps

This