4 ms·
I've never spent any serious time with Clojure/Lisp, and the nested parens have been a pretty major impediment. I'm curious if anyone's ever experimented with d
by lukifer 7y ago
I've never spent any serious time with Clojure/Lisp, and the nested parens have been a pretty major impediment. I'm curious if anyone's ever experimented with dialects that replace brackets with significant whitespace (newline+tabs), similar Python? I could also see a drag-and-drop coding GUI being pretty powerful.
I'm sure once one spends enough time with it, one starts to think in Lisp, and the desire to solve the "problem" disappears. :)
- vnorilo 7y agoIndeed. I came from C++, but I quite like homoiconic syntax by now. There have been alternative syntaxes [1] but their lack of popularity seems to align with your hypothesis. 1: https://dwheeler.com/readable/ https://dwheeler.com/readable/
- zdragnar 7y agoSignificant whitespace typically denotes blocks of statements or expressions. How do you use whitespace to represent a data structure? After all, the whole point is that literally everything, code included, is a list. (Edit: if all you want is homoiconicity, grab prolog, rebol or julia) There are plenty of non-paren functional and OO languages (f#, haskell, python, java) to replace functional and OO lisps depending on the itch you want to scratch. JavaScript has babel / babylon to generate a full AST to rewrite source code, though you need to either fork babylon or use sweet.js if you want your own macros.
- lvass 7y ago>How do you use whitespace to represent a data structure? SRFI-49[0] describes I-expressions, which can be mixed with S-expressions. I've tried it while learning Scheme, because parens didn't look good at first. My experience was that parens are an issue only until you get used to them, afterwards they're a boon. [0] https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-49/srfi-49.html
- tpfour 7y agoYou never spent much time with it and the parens are a major impediment? If you cannot overcome the "parens" (non) issue, I suppose the language is not for you. It really is not an issue, _at all_. I don't say this to be demeaning! I would say there are far more chances you really enjoy the language than not. Give it a try and stop worrying about the parenthesis and start thinking in terms of an AST. (let ((x 0)) (+ x 1)) If you want Python that's fine but there is definitely no problem with parens in Lisp/Scheme :)
- lukifer 7y agoHa, just thinking aloud! More of my own psychological barrier than a knock on Lisp. I do like it quite a lot, it's just completely alien compared to a life of experience with C-like languages.
- filoeleven 7y agoI found its alien nature to be kind of helpful in learning Clojure, actually. The paren position change really does melt away quickly, and in the meantime it was a good reminder that I was “not allowed” to do procedural code or mutate variables; I had to use a different mindset. Most people who check out Clojure have been coding for 10+ years, so you’re in good company as far as ingrained habits go. As others have said, the best way to check it out is to get a REPL running in a decent IDE and play with the language. There’s something quite intuitive in its workflow: knowing that you want to do something, though you’re not quite sure what it is yet, and typing a single ( gives you all the power and space you need to figure it out no matter how deep inside a code block you are.
- samatman 7y agoYes, Schemers have been working on sweet-expressions: https://srfi.schemers.org/srfi-110/srfi-110.html https://srfi.schemers.org/srfi-110/srfi-110.html They've been implemented for (at least) Racket: https://docs.racket-lang.org/sweet/index.html https://docs.racket-lang.org/sweet/index.html
- ken 7y agoYes, wanting to "solve" Lisp syntax has been a common initial response to Lisp for at least several decades. In 1993, Gabriel and Steele wrote: > we expect future generations of Lisp programmers to continue to reinvent Algol-style syntax for Lisp, over and over and over again, and we are equally confident that they will continue, after an initial period of infatuation, to reject it. (Perhaps this process should be regarded as a rite of passage for Lisp hackers.)