3 ms·
>But even this article doesn't get the problem. It's not "there are too many parens" but more that everything in LISP looks the same when you're new, it's a jum
by flavio81 7y ago
>But even this article doesn't get the problem. It's not "there are too many parens" but more that everything in LISP looks the same when you're new, it's a jumble of parens. Your brain isn't getting distinct markers to help learn the structures.
On a typical language you have "structures" you mention, like "if", "for", "switch". Lisp also has them, but they look more like function calls. The syntax has a lot of less noise.
Automatic indentation helps you visualize such "structures" in an easier way. It's not any more difficult than using a language like Python or C.
>And LISP, shares a problem with most dynamic languages that anything can kind of go anywhere.
Not really, because Common Lisp -the major Lisp dialect- is a strongly typed language, unlike the most popular dynamic languages: Javascript, PHP and Python and Ruby (Python & Ruby being 'duck typed' for the most part). And unlike the famous weakly-typed statically-typed language: C.
So no, "anything" can't go anywhere, because a type mismatch will cause a runtime error. And in CL you can correct runtime errors by modifying the source code and resuming program execution (without having to restart the complete program), so no big deal either.
The most common data construct, the Lisp list, accepts any kind of data type inside, but Lisp also has structs, objects and arrays, all of which can be defined for specific data types. Note that the ANSI Common Lisp standard includes extensive support for type declarations.
Not to mention that Lisp, unlike other languages (Java, C++ -- i'm looking at you guys) don't erase types at runtime. Lisp works with values (not variables) , and values are typed. Any value, in Lisp, carries its type information at runtime.
- ben509 7y ago> The syntax has a lot less noise. Note here how you unconsciously use "has" instead of "have", that kind of grammatical noise exists because those small redundancies help us understand each other. I think the reason very few computer languages use parens is because they're harder to read by virtue of having less grammatical redundancy. (At the other end of the spectrum, languages like COBOL are hard to read because they're swamped in redundancy.) > So no, "anything" can't go anywhere, because a type mismatch will cause a runtime error. I should have been clearer: it can go anywhere while you're writing it, so you have to run it to find out. That's the problem people also have with other dynamic languages when they're working on non-trivial codebases. Also, because types are rarely declared up front, you're often paging through code to figure out what type should go some place. > And in CL you can correct runtime errors by modifying the source code and resuming program execution (without having to restart the complete program), so no big deal either. I agree that's an amazing feature few langauges have been able to copy, but it seems like it wasn't enough.