News for hackers. Stuff that matters.
Re:Learning Lisp The Bump Free Way by chimeracoder on Wednesday April 24, 2013 @03:17PM (#5603379)
LISP (or Lisp) is a family of languages, not a single language. There are two main categories of Lisp dialects, the Lisp-1s and the Lisp-2s. Scheme is a Lisp-1.

Scheme is itself not a single language; it's a subcategory of Lisps. The main Scheme standard these days is R6RS (http://www.r6rs.org/), but different implementations may or may not comply with R6RS (Racket does not, for example, even though it was formerly known as PLT Scheme).

Common Lisp is the most well-known Lisp-2, and is what's generally implied when people say 'Lisp', even though that's technically a sloppy use of terminology.

Clojure is another dialect, but people generally specify Clojure and Scheme by name when referring to them. There is no logic behind these nuances of the terminology and their inconsistent usage; it's just what's evolved over the last 50+ years.

So, to answer your question, there's no reason why one should learn Scheme over Common Lisp (or vice versa), if all you're looking to do is learn the concepts.

There are differences between the different dialects (and their many implementations), but if you're looking to expand your knowledge and not necessarily write production code, pick Scheme (using Guile) and Common Lisp (using Clisp or SBCL) and you're good to go.

Re:Learning Lisp The Bump Free Way by pavelludiq on Wednesday April 24, 2013 @03:49PM (#5603554)

  So, to answer your question, there's no reason why one should learn Scheme over Common Lisp (or vice versa), if all you're looking to do is learn the concepts.
Once you scratch the surface, Scheme, Common Lisp and Clojure emphasize very different concepts, in some cases they even conflict in philosophy fundamentally. I'd say give all three a chance and pick a favorite. I picked Common Lisp, but that's just me.
Re:Learning Lisp The Bump Free Way by zvrba on Thursday April 25, 2013 @02:21AM (#5605953)
> Scheme, Common Lisp and Clojure emphasize very different concepts,

As I discovered when I was looking for TAGBODY in scheme (don't ask; it seemed to be the most convenient way of solving the problem). Then I realized I didn't need it, I could get the same effect with internal definitions (internal function = tag) and calls. A call in tail position IS essentially a goto. (More powerful though as it also binds arguments, if any.)

Scheme also looks more conceptually clean. For example, (define add +) does exactly what you think. In CL, you'd have to do something more contrived.

Re:Learning Lisp The Bump Free Way by epsylon on Thursday April 25, 2013 @04:01AM (#5606148)
> Scheme, Common Lisp and Clojure emphasize very different concepts Can you elaborate on that?
Re:Learning Lisp The Bump Free Way by pavelludiq on Thursday April 25, 2013 @11:46AM (#5607861)
Scheme emphasizes building your software out of a small set of primitives. These primitives are themselves as conceptually simple as possible. an example is the map function which works on lists. In cl, the map function takes a designator for a return type and can take an arbitrary sequence(list, array or string). so if I want to turn a string into a list of characters in CL it would be (map 'list #'identity "hello") and I would get (#\h #\e #\l #\l #\o). For the special case, there is mapcar, which is the equivalent of map. There are also a bunch of other "map" like functions in CL. CL emphasizes a rich set of tools in this way.

Another example is the member function. member checks to see if an element is in a list. In CL member takes an element, a list as well as several keyword arguments that control how the searching is conducted. One such keyword argument is test which is used to compare the element to the items in the list, and another one is key, which is called on the items in the list before they are compared to the searched element. In scheme you don't have the key argument, which is already a drag, and instead of having a test argument, you have 3 functions: member, using equal?, memq which uses eq?, and memv, which uses eqv? for comparison. If you need anything more than that, in scheme you'll have to write your own such function. in CL, you just pass two functions to member to control how it works. In that way, CL is actually much more conceptually simpler than scheme, but we have to keep myths alive, don't we :)

Another example is the CL concept of a generalized boolean. In CL nil is false, and everything else is true, with T being the canonical true value. In scheme you have special values representing true and false, which again complicates code a bit, but is more conceptually simpler. I consider this to be a great design blunder on schemes part.

Another example is that CL is very much an OO language, much more than an FP one. You have classes, methods, inheritance, mutable slots, and all sort of messy and complicated things that come in handy every once in a while.

I can go on for ever, but I won't even get to clojure, which is I think much more interesting. Clojure emphasizes immutability and laziness. Neither CL nor Scheme force you to be use immutability, but clojure does everywhere it makes sense to do so. Laziness is something else clojure emphasizes. And although there are libraries for CL to make it very much a clojure like language, it isn't the default.

Re:Learning Lisp The Bump Free Way by callmecosmas on Wednesday April 24, 2013 @05:35PM (#5604144)
If you're going to try Scheme and you're scared of emacs/vim, I'd suggest Racket. It's got a nice IDE (DrRacket) and a lot of the community is focused on teaching so there's a lot of resources for newbies http://racket-lang.org/learning.html
Re:Learning Lisp The Bump Free Way by tibbon on Wednesday April 24, 2013 @04:24PM (#5603727)
Is starting with Clojure a poor idea (jumping off the deep end)? I'm mainly a Ruby dev and looking to expand my knowledge-set
Re:Learning Lisp The Bump Free Way by pavelludiq on Wednesday April 24, 2013 @04:31PM (#5603771)
There isn't really a great cost to learning the basics of a language. Lisp dialects are very easy to learn, at least to a beginner level. You can learn enough of any lisp dialect to start writing "useful" programs in a few days, just try them out in whatever order you prefer and see which one you like to get deeper into.
Re:Learning Lisp The Bump Free Way by pnathan on Wednesday April 24, 2013 @04:36PM (#5603802)
Depends on your environment. If you get Clojure set up with Light Table, it's pretty easy to mess with. I think Clojure is not as intuitive as Common Lisp or my brief explorations of Scheme.

If you want to know more about common lisp, I have a site for that: http://articulate-lisp.com

Re:Learning Lisp The Bump Free Way by chimeracoder on Wednesday April 24, 2013 @04:31PM (#5603770)
Clojure is a nice choice if you're looking to write production code, especially if you're already using other JVM languages (Java/Scala/JRuby/etc.)

However, Clojure strays from a number of standard common idioms in other Lisps, which, IMHO, makes Clojure a less-than-ideal candidate if you're looking to get the "full SICP" experience. It has a lot of other benefits as a language, but for a learning experience, you'll miss out on some of the idioms common to other Lisps.

But, give it a shot and see if it works for you. Once you've learned one, it's really to learn another dialect.

And, in the end, the only wrong answer to 'Which Lisp?' is the empty list[0]. :)

[0] This is an example of a super-nerdy Lisp joke which works in Common Lisp but not Clojure - in Common Lisp, 'nil', 'false', and the empty list are all the same value, (and all other values are considered "truthy"). In Clojure, they are three distinct entities, and there is a discrete "true" value.

Re:Learning Lisp The Bump Free Way by kyllo on Wednesday April 24, 2013 @07:03PM (#5604554)
The joke "My other car is a cdr" also works in Common Lisp and Scheme but not Clojure.
Re:Learning Lisp The Bump Free Way by chimeracoder on Wednesday April 24, 2013 @08:23PM (#5604945)
Wait, this one is news to me. How does Clojure break this? It still supports car/cdr, if I recall correctly, right?
Re:Learning Lisp The Bump Free Way by Xurinos on Wednesday April 24, 2013 @11:59PM (#5605636)
The closest Clojure has to car/cdr is first/rest. It supports "cons" but only for creating sequences. Traditional Lisp car/cdr is one-location/other-location, and its cons puts together pairs of data. Often this is used for constructing sequences, but it is also often used for trees.

Clojure:

    user=> (cons 3 4)
    IllegalArgumentException Don't know how to create ISeq from: java.lang.Long  clojure.lang.RT.seqFrom (RT.java:494)

    user=> (cons 3 '(4))
    (3 4)

Common Lisp:

    CL-USER(1): (cons 3 4)

    (3 . 4)
    CL-USER(2): (cons 3 '(4))

    (3 4)
    CL-USER(3):
Re:Learning Lisp The Bump Free Way by kyllo on Thursday April 25, 2013 @02:22AM (#5605956)
Yeah those error messages completely baffled me for the first few hours I spent in the Clojure REPL. It was strange enough to not have car/cdr and cons for working with tuples, but then I wrote a simple recursive algorithm and got a java.lang.StackOverflowError. I now understand why and the alternative idioms that Clojure provides, but at the time it was a WTF moment.
Re:Learning Lisp The Bump Free Way by omaranto on Thursday April 25, 2013 @12:02AM (#5605647)
they are called first and rest in clojure, not car and CDR.