you are viewing a single comment's thread
view the rest of the comments
[–] [S] 2 points 1 month ago (7 children)

I wanted to learn lisp, but the default formatting is just terrible. If it had a different formatting and supported infix notation, it would be readable to me.

  • source
  • hideshow 7 child comments
  • [–] 4 points 1 month ago

    The polish notation is the simplest thing to wrap you head around. Instead of operations being special syntax exceptions, they're just functions! Functions that take parameters.

    the only syntax of lisps are (myfun p1 p2 p3)

    Mathematical operations are no exception (unlike otger languages). To make it simpler, think of it like this: + is just an alias (macro) for a function named plus which does addition. (plus 1 2 4 5) is the same as (+ 1 2 4 5). We don't use infix notation because then that would be a syntactic exepction (like other languages) while this is the only syntax we have in lisp, for everything it's really simple.

    and also, how is (1 + 2 + 4 + 5) (15 chars) better than (+ 1 2 4 5) (11 chars)? It's a conceptual shift and once you make it, it makes so much more sense.

  • source
  • parent
  • [–] 3 points 1 month ago (3 children)

    If it supported infix notation (outside of reader macros), it wouldn't be Lisp.

  • source
  • parent
  • hideshow 3 child comments
  • [–] [S] 2 points 1 month ago (2 children)

    Why not? Is LISPs only, and major quality, polish notation?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 1 month ago

    Yes. Well, sort of.

    The actual quality is homoiconicity, meaning that code in the language is represented in the language's own data structures (beyond the entire source file being a string). This enables structural macros - using the language to manipulate code before execution.

    Some languages have tried to do this without the language syntax actually being data structure literals. Rust does it, but a typical Lisp macro looks like a simple template where some things are marked to happen at compile-time and others get spliced in at runtime. Rust macros don't beyond the most trivial examples.

  • source
  • parent
  • [–] 3 points 1 month ago

    To add to the point about homoiconicity, both the article and my toplevel comment mention thread macros. The article talks about them being equivalent (syntactically at least) to method chaining, which I agree with.

    The thing is, to get method chaining, the language has to have an object system, and the functionality you want to use has to be written in an object-oriented style. To get a thread macro, you need ten lines of code (aside from the docstring and metadata).

  • source
  • parent