10 ms·
Getting Started with Lisp (2019)
- phoe-krk 6y ago> Thus, if you're looking to get started with programming in Common Lisp, then there are 2 options: The author misses the third, most classical, and constantly useful option: doing it all yourself. Despite the scary name, there's not all that much to do, and this approach is the most widely supported in the community. The checklist is: * SBCL/CCL (from your package manager or from official binaries), * Quicklisp (by downloading it from https://quicklisp.org/ https://quicklisp.org/), * Emacs (in any preferred way), * Slime/Sly (manually, or via `(ql:quickload quicklisp-slime-helper)`, or via using an Emacs distribution, such as Spacemacs with its common-lisp layer, which already contains preconfigured slime/sly). There, you're good to go. Using some sort of toolkit which enables interactive and incremental programming (such as Swank/Slynk on the Lisp side and any Slime/Sly client on the editor side) is an ABSOLUTE MUST while doing Lisp. If you're allergic to Emacs and therefore can't use Slime/Sly, use: * slimv/vlime for vim, * Alive for VSCode, * Slyblime for Sublime, * atom-slime for Atom.
- ngcc_hk 6y agoToo complicated. Those quicklisp and slime is not easy for starter (but sort of essential as lots of functions can be obtained via this distribution manager). The approach he tried is using as simple as one can. I guess the only thing missing is if you were mac and windows user ...
- phoe-krk 6y agoYes - Portacle is an amazing piece of software and also the way to go for someone who just wants to check Lisp out on Mac/Win/Linux, but it also has its issues, e.g. with some systems that depend on foreign libraries. Also, if someone already has emacs set up and preconfigured, there's no point in adding another emacs instance with a distinct configuration for long-term programming.
- rvense 6y agoI found getting slimv and sbcl running to be quite easy. If you're used to vim and console apps it's straight forward.
- susam 6y agoLast week, I shared a 35 line ~/.emacs (as a Show HN post) that turns Emacs into a Common Lisp development environment pretty quickly: https://github.com/susam/emacs4cl https://github.com/susam/emacs4cl . It provides a good middle ground between configuring Emacs manually by installing SLIME, Paredit, etc. yourself with M-x package-install commands and installing Portacle. It promotes a do-it-yourself approach to setting up Emacs for Common Lisp programming quickly while understanding each step of the set up process and each line of ~/.emacs well.
- wheresvic4 6y agoYes, this is definitely an option and it really should have been mentioned but given that even https://common-lisp.net/downloads https://common-lisp.net/downloads recommends that one use portacle to get going quickly for newbs, it seem prudent not go too far off-track :).
- varjag 6y agoThe dangling parens make me super skeptical about quality of the advice.
- wheresvic4 6y agoI would appreciate a little bit more detail here so that the article can be corrected. Could you point to which dangling parens need to be fixed?
- juki 6y ago(defun main () (format t "Hello world") ) Should be (defun main () (format t "Hello world")) The lisp community has very well established formatting conventions. You pretty much never see closing parens on their own line like this except when reading code written by beginners (or some special cases like package export lists for example, where one might want to leave the list "open" for adding new symbols, similar to a trailing comma in some other languages).
- tasuki 6y ago> The lisp community has very well established formatting conventions. You pretty much never see closing parens on their own line like this except when reading code written by beginners Why is that? Space efficiency? As an outsider, I find the "wrong" example more readable.
- lispm 6y agoOnce you use Lisp a bit, the parentheses fade away. It's like bicycle riding. As a beginner one thinks those supports wheels at the sides of the bicycle are absolutely necessary. One is constantly struggling to keep upright. Once you can ride a bike without them, one asks if they were ever necessary. Then one never thinks consciously about keeping balance.
- varjag 6y agoAs said in the sibling comment, it mostly fades away and you see the structure with indentation - very much how you would in Python.
- pjmlp 6y agoThe third, most important option is missing. Get the community editions of either Allegro or LispWorks and taste what the actual experience of Common Lisp development environments used to be like.
- phoe-krk 6y agoWhat are the major selling points of Allegro and LispWorks over Emacs with Slime/Sly with regard to the IDE point of view? (Asking so we can skip the graph database and GUI libraries; I'm particularly interested in the developer environment.)
- bitwize 6y agoActual IDEs, for one.
- phoe-krk 6y agoThat's not even an attempt at making an actual answer. Emacs + Slime already has a REPL, compilation and/or loading of select forms or whole files, syntax highlighting, auto-indentation, completions, debugger, inspector, stepping, cross-references, and most of the other fancy things that are usually associated with IDEs. What do Allegro and LispWorks have that Emacs + Slime don't? What are their selling points? What features make them unique?
- TurboHaskal 6y agoAllegro is the only Lisp with a RAD like GUI designer. Other than that, the IDE is alright but I hate how outdated it looks (they don't even have syntax highlighting and they expect me to put up with an ugly X11 app on macOS). Allegro's selling point is definitely not the IDE and I very much prefer Slime over it. LispWorks also has an interface builder but only works on Windows I'm afraid. I wouldn't say their IDE offers much over Slime if you are a power user, but I really like their function/class browser over using all the slime-who-* commands and how easy to use their debugger is. What sets it apart is that thanks to CAPI it is trivial to build graphical user interfaces to make your own development experience a bit nicer: for example opening up a filesystem dialog instead of asking the user to retype a string, building a graphical monitor to provide insights on the performance of your Lisp image... You get the picture. It feels very Smalltalk-ish.
- kimi 6y agoI'd start from here: https://clojure.org/guides/getting_started https://clojure.org/guides/getting_started
- zerr 6y agoClojure mindset/recommendations diverge from (any) Lisp though - they prefer using primitives everywhere instead of creating proper abstractions and mini libraries/languages as in any other Lisp. EDIT: real -> other
- phoe-krk 6y ago> as in any (real) Lisp While the OP, by "Lisp", means "Common Lisp" - you're aware that following this old meme of "Clojure is not a real Lisp" only causes interpersonal fires and brings no real benefit, I hope?
- zerr 6y agoEdited. Didn't know that topic is so sensitive :)
- phoe-krk 6y agoIt kinda is. There have been countless debates about Clojure not being a real Lisp, Scheme not being a real Lisp, Janet not being a real Lisp, Lisp not being a real Lisp, and IMO they've only created circle jerks, tons of "my Lisp has a longer cons cell than yours"-style arguments, and overall made the landscape a worse place. If you're interested, search for "is an acceptable Lisp" and/or "is not an acceptable Lisp" and read all the articles, their comment sections, and the Hacker News dumpster fires that ensued. Maybe they would be amusing if only they weren't happening in my language community.
- behnamoh 6y agoEvery now and then I see posts like this and yet, the Lisp languages never took off after the 2000s. I understand that there might be some value to learning Lisp, but much of the things that made Lisp attractive before are already available in Python, Java, etc. and I see no "enlightment" in learning Lisp. This comment is going to get downvoted heavily here, but it's high time every one accepted the fact that the Lisp family is almost dead and move on.
- phoe-krk 6y agoThe alternatives that you mention are still highly subpar when it comes to e.g. the incremental and interactive programming style that is highly common with Lisp. Java fails at it miserably by pretending to be a dynamic language, and I have not seen* Python used in a way in which one usually programs with Lisp - so, keeping the process alive all the time and sending commands to interact with it, like one does with Slime/Sly. This has some obvious negative consequences, such as high feedback loop time - in Lisp, the compilation delay is usually imperceptible, especially when compared to running javac or python. The "it's high time every one accepted X" is a meaningless comment because it presents an opinion as if it were a fact. Therefore, please accept my downvote. *if such toolkits exist, please point me towards them - I've always wanted to see one in practice.
- greggyb 6y agoIt's easy to get to a shallow similarity with Python. I use elpy for Python development in emacs. My development style is highly iterative and I tend toward functional paradigms. I build up a Python program by evaluating lots of small pieces, slowly building those into the structure of my program. I don't write code into a saved file without first evaluating it in a linked REPL session. Python does not support the same style of connecting to a live process, like Lisp does. Nor does it have the same facilities of redefining components in a running system. The surface level actions look similar between my Lisp development and my Python development.
- phoe-krk 6y ago
- Blikkentrekker 6y ago“Lisp dialects” is as if one talk about “dialects of curly braces languages”. I would argue that Python is closer to Scheme than Common Lisp is.
- kazinator 6y agoUntil you write a procedure that walks a structure using cons/car recursion, ha. :)
- Blikkentrekker 6y agoThat happens in so many languages bar the name and even in some Lisps they aren't called that. Even in Common Lisp, the names typically used are “first” and “rest”, not “car” and “cdr”
- phoe-krk 6y agoI must disagree. I see a lot of CAR and CDR calls in code that I see daily. Also, it's a style error to use FIRST and REST when one operates on cons cells, because those imply a different meaning - that one operates on lists. Sure, the language doesn't care whether you use CAR or FIRST, but the programmer does - and they might know that you treat a cons cell as a pair unto its own, rather than an element of a linked list.
- kazinator 6y agoFeel free to substitute the Python version of getting the first and rest of a list (well, the array that Python calls a list). My comment is not about names, but semantics.
- Blikkentrekker 6y ago`list[0]` and `list[1:]`? Almost any language has convenient ways to get the first element of a sequence, and all but the first, even C, this is not unusual at all to lisps.