this post was submitted on 13 Oct 2025
21 points (100.0% liked)
programming
276 readers
1 users here now
-
Post about programming, interesting repos, learning to program, etc. Let's try to keep free software posts in the c/libre comm unless the post is about the programming/is to the repo.
-
Do not doxx yourself by posting a repo that is yours and in any way leads to your personally identifying information. Use reports if necessary to alert mods to a potential doxxing.
-
Be kind, keep struggle sessions focused on the topic of programming.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Now I understand your confusion better:
(a b c)is a symbolic expression which evaluates to something else and will always be read a function call of a with args b and c.If you wanted to set
(a b c)as a list value in of it self you would write(quote (a b c))or'(a b c)as the syntactic shorthand. This is also an s-expression.When you write lisp, you're writing s-expressions that will be evaluated later. There are no statements in lisp, only expressions.
No, they don't enforce types via the interpreter, but they are not comments because they appear in documentation. Lisp has comments in addition to docstrings similar to Python.
Yes this is confusing because you have taken out the indentation
This is still unclear, but this is just to demonstrate how to follow lisp code.
I can't dig into the specific source, but the
macro_rulesname comes from scheme'ssyntax-rulesit wasn't an original invention by Rust or taken from C/Cpp. Lisps have also influenced design decisions like functions as first class citizens and closures (lambda expressions).Nope, the REPL is an evolving, adaptive environment that represents the totality of your program/project. So for example, you have a repl loaded while writing lisp code and you can evaluate an s expression at your cursor and the output will be computed by the repl. It encourages prototyping and iterating on smaller and smaller procedures to create larger ones.
This very much lends itself to favoring functional programming, but imperative lisps can also use the REPL to great effect.
This doesn't mean unit testing/integration tests/debuggers etc are not used, but the Lisp REPL is an example of interactive programming that isn't replicated by other C-likes unless you have heavy IDE support.
Apologies for nitpicking, but did you mean that all statements are expressions in Lisp? If there were no statements, surely it would be impossible to actually make things that do anything other than calculate some results, wouldn't it?
Yeah, that is what I did mean when I referred to the possibility of docstrings being mere 'comments'. I excluded their role in documentation, as I was only concerned with their direct effect on the code.
This seems to contradict the formatting used for examples that I see on the Guile Hoot page, as well as your prior
factorialexample. Wouldn't that mean that that example should have been formatted as something like the following?The Interpreter produces the side effects required when the program starts (it does the syscalls, state changes, etc) Haskell is a pure functional programming language that is not a lisp that has no statements but it can also make web applications, data crunching tools, and games.
Lisp can be used in an imperative context with mutability, so it's not locked into one style of programming or the other.
https://lisp-lang.org/style-guide/
Special forms like "if" and "defun" are highlighted in your editor. There also exists editor plugins that will let you edit lisp through s-expressions (being able to swap two s expressions rather than deleting one and then putting it in the desired place)
This is not the only style guide, each dialect has their own style guide.
The unreadable soup that lisp is may seem to be are macros (which requiring understanding the macro first before using). But macros without context are difficult in any language, not just lisp.
Going back to SXML, there is no special sauce that makes SXML what it is. It simply is a quoted representation of XML tags. There is no API or anything (outside of evaluating SXML to convert it into another representation)
Re: readability
Also OOP can be used in lisp in addition to imperative and functional.