Live data from Hacker News

Ask HN: I want to start learning Lisp. Where do I begin?

news.ycombinator.com

51–60 of 211 posts

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#51

Earlier quoted context omitted.

How is it that you think Clojure has trouble doing things in a non-functional way? I'm just curious, as I work in Clojure primarily and may have a huge blind spot I'd love to clear out!

I don't have much of experience with Clojure myself - the above might be my first impressions from the little bit where I've tried it. Well, let me try to fix them then, and ask some questions. In Clojure, how do you usually approach problems that are shaped in an object-oriented way? In object-oriented languages, this usually includes either some sort of method calls (and therefore mutable state) or message passing…

What would be an example of "problems that are shaped in an object-oriented way"? That just doesn't sound like a thing to me. That may originate from a bias you may have from developing primarily in OO languages.

Clojure does have constructs to manage state. You don't need to shove it all into your function arguments.

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#52

Earlier quoted context omitted.

You could have an atom that holds the state and a function which can update that atom. You might do something like the elm architecture where you pass a message to a reducer which produces the new state that the atom is set to. All the logic is contained in the reducer and is pure and immutable and the state change happens at a single controlled point.

OK. If I understood correctly, then you limit the mutable state to one point, and use functional logic everywhere around it. You can also optionally close over the atom to achieve encapsulation. Thanks, TIL! That's equivalent to the "mostly functional" style that's doable in Common Lisp.

Exactly! This method of limiting the mutable part to one point is a pattern that is highly useful, and highly used, when working in clojurescript with react through reagent and re-frame, for example: you represent the whole state of your app in a tree of maps and define functions that, given a version of your app state, return the updated version. Then you just execute state-changing pure functions linked to a stream of events to move your one-point-mutable-app-state through a stream of valid states.

(and also obviously functions that map that state to HTML/CSS/SVG/etc.).

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#53

I'm just wondering, besides being more knowledgeable about languages in general, are there any use cases for Lisp dialects nowadays?

Some pointers: Scorecloud (https://scorecloud.com/), a music composition software (you sing, it writes music) comes from research, and is built in Common Lisp.

pgloader was rewritten from Python to Lisp: https://tapoueh.org/blog/2014/05/why-is-pgloader-so-much-fas... because of Python's poor performances and threading capacities.

A theorem prover used in the industry: https://github.com/acl2/acl2

A Lisp vendor selling semantic graph solutions: https://franz.com/ (see also its success stories for industry examples)

Here's a sadder story: a team switched from CL to Go for production, but still use CL for prototyping: https://lisp-journey.gitlab.io/blog/pro-mailing-list-on-comm...

Some use CL in bioinformatics (and claim it's the best tool for the job). For example, they create a new Lisp implementation: https://github.com/clasp-developers/clasp

More success stories: https://lisp-lang.org/success/

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#54

Earlier quoted context omitted.

You could have an atom that holds the state and a function which can update that atom. You might do something like the elm architecture where you pass a message to a reducer which produces the new state that the atom is set to. All the logic is contained in the reducer and is pure and immutable and the state change happens at a single controlled point.

OK. If I understood correctly, then you limit the mutable state to one point, and use functional logic everywhere around it. You can also optionally close over the atom to achieve encapsulation. Thanks, TIL! That's equivalent to the "mostly functional" style that's doable in Common Lisp.

Exactly. Functional programming is pretty much all about being very mindful of when to use state vs pure functions.

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#55

Earlier quoted context omitted.

I don't have much of experience with Clojure myself - the above might be my first impressions from the little bit where I've tried it. Well, let me try to fix them then, and ask some questions. In Clojure, how do you usually approach problems that are shaped in an object-oriented way? In object-oriented languages, this usually includes either some sort of method calls (and therefore mutable state) or message passing…

What would be an example of "problems that are shaped in an object-oriented way"? That just doesn't sound like a thing to me. That may originate from a bias you may have from developing primarily in OO languages. Clojure does have constructs to manage state. You don't need to shove it all into your function arguments.

Sorry for the mind shortcut. By that, I meant all sorts of problems where multiple state-bearing entities communicate via message passing - usually implemented via method calls in OO languages.

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#56
post #6

Is there a good argument against Clojure in this case? My impression is that it's a good lisp and you can get actual work done in it which is an advantage over some of the other options.

I tried Clojure a bit and, compared to CL, I find it bloated :S Installing a library takes ages, a lot of memory, and I can't do it from the REPL (so I must quit my development environment, and start it again). CL feels very snappy. I can even install a new library to a running web app. I know it's dangerous, but it works and it helped me already :)

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#57
I think you can use whatever to do Lisp. I'd start with something simple like Scheme, and definitely by watching and doing the SICP lecture recordings from now 34 (!) years ago: https://ocw.mit.edu/courses/electrical-engineering-and-compu...

Once you think you grok it, you can pick a Lisp that's closest to what other tools and frameworks you're used to. For me, I never actually did anything in Lisp for production use, but learned a lot from playing with various flavors of it.

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#58
Switch from vim to use evil-mode in emacs, perhaps via the spacemacs or doom emacs emacs starter projects. These present the vim editing interface, but implemented in emacs.

Then you're using emacs. Play around with emacs lisp customizing it and writing utilities for yourself to do editing tasks and whatever else you can think of. The community of emacs lisp programmers has lots of common lisp programmers. It's a serious-enough lisp to get started with, with sophisticated macros and several features from common lisp.

Make sure you use paredit. It's basically essential when learning lisp to use an editor that automatically matches parens and keeps them balanced. Beginners who complain about the parens are making that mistake.

Re: Ask HN: I want to start learning Lisp. Where do I begin?

#59

I think you can use whatever to do Lisp. I'd start with something simple like Scheme, and definitely by watching and doing the SICP lecture recordings from now 34 (!) years ago: https://ocw.mit.edu/courses/electrical-engineering-and-compu... Once you think you grok it, you can pick a Lisp that's closest to what other tools and frameworks you're used to. For me, I never actually did anything in Lisp for production use…

> I think you can use whatever to do Lisp.

I'm not sure about that. You need an editor that automatically matches parens and other paired delimiters and keeps them balanced, like paredit.

Post reply on HN