Live data from Hacker News

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

news.ycombinator.com

171–180 of 211 posts

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

#171
post #67

Earlier quoted context omitted.

The Hacker News Paul Graham?

He wrote his first product (Viaweb) in lisp and sold it to Yahoo!. (If a name has an exclamation and it's the last word in a sentence, do I follow it with a period like normal to avoid seeming overly enthusiastic?) He wrote two books on Common Lisp and has his own Lisp reading list: http://www.paulgraham.com/booklinks.html . There's also, one level higher, a set of lisp links: http://www.paulgraham.com/lisplinks.html

Yes, "!.". I still remember a math problem when I was a kid, in which a sentence ended with "4!"...

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

#172

The very reason I find Lisps enjoyable is all the things an editor can do for you with a Lisp. Smartparens, rainbow parens, easy eval of forms (+ pprinting, macroexpand, inline replace etc), jump to definition, for Clojure - contextual awareness of the namespace and REPL session you're in. Probably forgetting a number of things. Without these there wouldn't be much for me left to like about programming in a Lisp. As…

> Clojure IDE "Cursive" is supposed to be good, but never tried and not sure if you want to invest time in an ad hoc IDE.

Cursive is just a Clojure plugin for IntelliJ , nothing ad-hoc about it. IntelliJ is the favourite IDE for lots of people - especially Java devs - so it's an obvious choice for Clojure developers.

I've programmed Clojure professionally for several years now and have seen maybe 50 different editor setups in person and I've yet to be significantly impressed by emacs. It does seem to offer most of the stuff that comes out of the box in IntelliJ (with the Cursive plugin), but only after many hours of setup and days to weeks of getting comfortable inside its somewhat antiquated UI paradigm. Nothing against emacs, but I just haven't seen the great case for using it over something like Cursive, other than if you need to develop commercial software and don't wanna buy a commercial licence for Cursive. A bunch of people at my old job actually switched from emacs to IntelliJ a couple of years into their Clojure journey.

I do see the obvious advantage of using emacs if you're already a heavy emacs user, however. And if some Clojure-specific kiler feature pops up in emacs, I'll probably switch to emacs too. Until then, I'll stick to Cursive which covers all of my various Clojure needs very well out of the box.

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

#173
post #90

Earlier quoted context omitted.

SBCL is great, but one should not use an editor, which doesn't have proper paren matching and some indentation support. That is just making your life miserable. So SBCL+Slime+Emacs is a great combination. Or alternatively, get the free version of Lispworks.

Whoa, that's a big jump you made there from paren matching plus indentation to emacs. If he is just learning, emacs might be overkill. I was just simplifying the minimum requirements. But I agree with you about parens. This is not 100% popular but for a newbie I'd add the following recommendation: Make sure your editor has parinfer available. Not parindent, parinfer. People swear by parindent, but you don't need it o…

Yes, it is a step, but learning the very basics of emacs isn't that hard either. I just cannot bear the view of someone trying to edit Lisp code with an editor without the basic support. This easily leads to all the horror stories you can read on the internet about Lisp :). Also, with Slime you get a great integrated environment. You can evaluate functions directly from the sources. Unless you plan to go with one of the IDEs, Slime is a great Lisp environment. Once you know Emacs+Slime, you won't need any other environment, so why not start with it?

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

#174
post #73

This is a bit tangential but what helped me most in picking up Lisp was writing my own. Until I worked through Make A Lisp [0] I don't think I really "got" Lisp. You can work in whatever language you're familiar with. You build a Lisp similar to Clojure and learn a lot of important concepts by implementing them. [0] https://github.com/kanaka/mal

I didn't write my own but started hacking[0] on an existing implementation -- you learn quite a bit about the underlying language by tracking down bugs as you implement (or port) features in the interpreter. I was trying to get the parser up to an actual parser for the language (which produces a lot of 'language learning experiences') but got distracted with adding unicode support (which hasn't really taught me anything new about scheme...)

[0] https://github.com/eponymous/yocto-scheme

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

#175

I forgot to ask in my main question. I can't edit it anymore. I am seriously thinking of learnijg common lisp. Thank you for all the suggestions. Is it possible to build web apps in common lisp or any lisp? Any frameworks available? Is it possible to build multithreaded apps that use multiple CPU cores for performance? What is used? POSIX threads?

If you are thinking on doing web apps, I think Clojure is the best option, as it enables you to write clojure to target both server (either in clojure or clojurescript) and browser (with clojurescript, that compiles to javascript), and share code between those seamlessly (for example, protocols, specs, business logic, etc. that you may need in both sides). That's the most extended option by far, but I'm sure that you…

Yes, Clojure

> Is it possible to build web apps in common lisp or any lisp? Any frameworks available?

Clojure would be good because it has lots of users. Many web apps in production. It might be good to start out with luminus for Clojure, but maybe even before that, try to get a simple Ring and Compojure thing going where you can send a request and get feedback.

> Is it possible to build multithreaded apps that use multiple CPU cores for performance? What is used? POSIX threads?

Clojure is awesome for multi-threading. That's one reason Clojure is functional/immutable by default.

Also, you get access to many libraries in the language hosts (Java, Javascript). That could be a big reason for its success.

Good luck in your pursuit!

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

#176
If you're set on using vim slime is great. Basically you bring up the REPL in another tmux or screen split then you can just pipe your forms to it.

https://github.com/jpalardy/vim-slime

Here's a few previews for fun books I enjoyed, land of lisp and realm of racket by conrad barski

https://books.google.ca/books/about/Realm_of_Racket.html?id=...

https://books.google.ca/books?id=9apQfCRhvm0C&printsec=front...

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

#177
post #22

I would start with Scheme or Racket that is based on Scheme. I would start with any Scheme interpreter like Kawa or Guile. If I would recommend any book it would be Sketchy Scheme by Nils M Holm (that I've read recently) https://www.t3x.org/sketchy/ it start with basics but it have lot of details and advanced stuff about Scheme and how it works. It also as title suggest intro to functional programming. If you would l…

This book is also in archive.org:

https://ia800700.us.archive.org/33/items/sketchy-lisp/sketch...

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

#178

There are a lot of classics such as SICP and The Little Schemer, and I dearly love them all and consider them all to be canon that everybody should read at least twice. But, for an easy/fun on-ramp, I think that there are three new contenders that are much better for getting a feel for things. Pick one according to your tastes, or burn through them all in a couple weekends and then decide. If "functional programming…

Realm of Racket doesn't teach you about metaprogramming though.

Good point. For that part, my favorite guide is https://www.greghendershott.com/fear-of-macros/

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

#179

The very reason I find Lisps enjoyable is all the things an editor can do for you with a Lisp. Smartparens, rainbow parens, easy eval of forms (+ pprinting, macroexpand, inline replace etc), jump to definition, for Clojure - contextual awareness of the namespace and REPL session you're in. Probably forgetting a number of things. Without these there wouldn't be much for me left to like about programming in a Lisp. As…

> Clojure IDE "Cursive" is supposed to be good, but never tried and not sure if you want to invest time in an ad hoc IDE. Cursive is just a Clojure plugin for IntelliJ , nothing ad-hoc about it. IntelliJ is the favourite IDE for lots of people - especially Java devs - so it's an obvious choice for Clojure developers. I've programmed Clojure professionally for several years now and have seen maybe 50 different editor…

> Cursive is just a Clojure plugin for IntelliJ

Well, I'm ignorant about the IntelliJ ecosystem. Can I take some of what Cursive is providing and use it with Racket or Common Lisp?

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

#180

If you're on Arch Linux, you can install the `lisp` package from AUR, then type `lispi` and then `(+ 1 2)` for adding 1 and 2. Don't type in the backtick quotes. Press `ctrl-c` to quit. If you install `clojure` you can start the interpreter with `clj` and also type in similar expressions, like: (* 3 7) There are a couple of differences to Common Lisp, though. The fun thing about Lisp is that you can pass any number o…

For systems other than Arch, here are the wrapper scripts for SBCL that provides the `lisp` and `lispi` commands mentioned above.

lisp:

  #!/bin/sh
  #
  # SBCL wrapper script
  #
  filename="$1"
  mainfunction="${2:-main}"
  if [ -z $filename ]; then
    echo 'Please provide a filename as the first argument'
    exit 1
  fi
  if [ ! -f $filename ]; then
    echo "Could not find the file named \"$filename\""
    exit 1
  fi
  sbcl_path=$(which sbcl)
  if [ -z $sbcl_path ]; then
    echo 'sbcl is not in the PATH environment variable'
    exit 1
  fi
  if [ ! -x $sbcl_path ]; then
    echo "$sbcl_path is not executable"
    exit 1
  fi
  "$sbcl_path" \
    --noinform \
    --noprint \
    --no-userinit \
    --no-sysinit \
    --disable-debugger \
    --quit \
    --load "$filename" \
    --eval "($mainfunction)" \
    --end-toplevel-options
lispi:

  #!/bin/sh
  #
  # SBCL wrapper script
  #
  filename="$1"
  flag=""
  if [ ! -z $filename ]; then
    if [ ! -f $filename ]; then
      echo "Could not find $filename"
      exit 1
    fi
    flag="--load $filename"
  fi
  sbcl_path=$(which sbcl)
  if [ -z $sbcl_path ]; then
    echo 'sbcl is not in the PATH environment variable'
    exit 1
  fi
  if [ ! -x $sbcl_path ]; then
    echo "$sbcl_path is not executable"
    exit 1
  fi
  "$sbcl_path" --noinform $flag
Post reply on HN