14 ms·
I am fairly deep into learning Haskell. After I am done, should I learn Lisp (SICP)? Smalltalk? Prolog? I am learning these languages for mind-expansion. I am
by avindroth 10y ago
I am fairly deep into learning Haskell. After I am done, should I learn Lisp (SICP)? Smalltalk? Prolog?
I am learning these languages for mind-expansion.
I am also studying AI, will learning Lisp be relevant? (e.g. Help me reason about and write AI systems)
- weavie 10y agoI think once you are done learning Haskell you will know the answers to all these questions. Although one could argue you will never be "done" learning Haskell.
- i_don_t_know 10y agoPersonally, I like programming languages that force me to think about a problem completely differently than what I'm used to. So for mind-expansion I would suggest Smalltalk and then Prolog, because they are completely different from Haskell, much more different than Lisp/Scheme is. I'm not an expert on lisp and AI. From what I understand lisp has been the traditional go-to language for AI research, and for "classic" AI you probably cannot go wrong with learning at least the basics of lisp. However, a lot of recent AI research seems to be on neural networks, deep learning, and statistics. I don't know how important lisp is in those fields.
- lispm 10y agoIf you use Lisp, you have Prolog and Smalltalk, too. Built-in.
- i_don_t_know 10y agoYes, and while that may be an advantage for actual use of the language in practice, I think it's a disadvantage for learning the concepts behind OOP and logic programming. Prolog forces you to solve your problem with logic programming. You cannot take the easy way out and solve it (wholly or partially) in some other way that you already know. Likewise, Smalltalk forces you to solve the problem with OOP. Haskell forces you to deal with pure functions and lazy evaluation. APL forces you to solve the problem with vector operations. Some of the approaches and solutions may be clumsy and worse than what you can do with a mix or some other programming paradigm. But I thought the point of the exercise was to learn the different programming paradigms, and in that context I prefer programming languages that do not offer alternative ways of solving the problem. I prefer a more restrictive approach and lisp is anything but restrictive (CLOS, kanren, etc). Also I find that a different surface syntax helps me context switch to a different programming paradigm. For example, when I see s-expressions my mind switches to scheme and thinks accordingly, and that would be a distraction to me if I wanted to program imperatively, for example. When I see Prolog, I have a hard time thinking in terms of OOP. Maybe that's just me. The reason for suggesting Smalltalk first was that it's farther away from Haskell than Prolog (Prolog clauses can appear similar to functional programming). Switching to Prolog after Smalltalk is another big jump. I like big jumps. They help me switch context. The OP may be different, I don't know.
- tome 10y agoAt a slight tangent, does anyone participating in this discussion know of a good resource for explaining the kinds of things that people use kanren for?
- lispm 10y agoLispWorks Prolog can use Prolog syntax inside Lisp: $ lispworks LispWorks(R): The Common Lisp Programming Environment Copyright (C) 1987-2014 LispWorks Ltd. All rights reserved. Version 7.0.0 CL-USER 1 > (require "prolog") T CL-USER 2 > (in-package "CP-USER") #<The CP-USER package, 0/16 internal, 0/16 external> CP-USER 3 > (erqp) ?- consult(appenda). YES. OK. ?- appenda([1,2,3],[14,15,16],L1). L1 = [1,2,3,14,15,16] OK.
- billsix 10y agoSICP is phenomenal, but I'd recommend "On Lisp" first.
- avindroth 10y agoWhy is that?
- _ph_ 10y agoI would rather recommend SICP fist. On Lisp is great but not the ideal Lisp starter book. Practical Common Lisp would rather be that, and its a more recent book with modern topics.
- peatmoss 10y agoIf one isn't set on Common Lisp (assuming not since SICP is not CL-focussed), the Racket universe has amazing resources for beginners. How to Design Prgrams is wonderful intro material, and the Racket guide, and subsequent recommended reading on the Racket website are all pretty aces. Racket also has a SICP language should one want to experience the original text without running into broken parts.
- _ph_ 10y agoSICP should be mandatory. It only happens to use Lisp, but is a very fundamental text about programming. So it is an important read, even if you do not plan to use Lisp in your future.
- lmm 10y agoI think you'll get a better return from going deeper into Haskell than from dabbling in other languages. Haskell does enough things right and there's at least a decade's worth of valuable study in using Haskell libraries effectively.
- bpyne 10y agoI haven't done anything with Smalltalk, so I can't comment on it. However, learning Lisp (using SICP) and Prolog are both good choices. SICP uses Scheme. It'll teach you how simple concepts can be composed to build any software you want. You'll come to understand how interpreters work and execution models. With Prolog, pattern matching will become a dominant way of thinking. Prolog is also fairly unique in its backtracking execution model: backtracking is "baked into" the language itself. Later on you can utilize your knowledge of Haskell and Prolog by studying Curry, which (sort of) marries the two together. Depending on the area of AI you choose, Lisp can be a good choice but Prolog can be as well. The class I took focused on supervised learning with support vector machines, decision trees, and neural networks. These topics use fairly advanced mathematical concepts, so the language of choice is one in which libraries exist already. We used R, which the professor uses for his research. Python is also strong with its library support. It's a good idea for you to narrow the area of AI you want to study and then find out the language people working in that area use.
- rpazyaquian 10y agoSpeaking of SICP, which version of it is the best to dive into? I found the online version of it, but it's kinda clunky to click through. Also pretty dry.
- _ph_ 10y agoI think its totally worth buying the printed version.
- bpyne 10y agoAfter trying to read the online edition, I picked up a soft-cover version. I'll second the sentiment that it's easier (for me) to read it as a continuous read. I can see the online version being great as a reference. But, it didn't work for me.
- qwertyuiop924 10y ago>I found the online version of it, but it's kinda clunky to click through If you don't have the cash for the very expensive softcover, you can grab the unoficial epub, which is a bit nicer than the online edition. >Also pretty dry. yep. I still haven't gotten all the way through the first section. It's a tough read.
- jerf 10y agoHaskell and Lisp complement each other in a lot of ways. Lisp is about empowering the programmer, and building on that empowerment. Haskell is about restricting the programmer, and then building on those restrictions. For a clear example, consider STM, how it works in Haskell, and how it doesn't work particularly well in Lisp because of the inability to restrict transactions in the necessary way. Lisp is good to learn, but because it has "won" in a lot of ways I'm not convinced it's as important as it used to be. Lisp acquired its reputation in a world where a C programmer would pick up Lisp and holy shit dynamic typing, first-class functions, garbage collection, REPL, macros, powerful syntax-aware editors (which C got, but later), atoms, recursion, violent foaming at the mouth and falling down in sheer awe. If it's still your first language after C, sure. But if you learned, say, Python in school, the list comes back to "macros, which you really shouldn't make much use of in the more modern understanding, and a bigger focus on recursion". Less likely to make you pass out in awe. (Since I find I sometimes piss people off by claiming Lisp is less than the bee's knees, remember, it's because Lisp won in a lot of ways. It blazed a trail that every modern language today has traveled to some extent or other.) Haskell still has a counter-cultural element because of the fact that Lisp is quite dominant right now and most languages are about empowering the programmer to do anything at any time. The restrictions-based languages are just starting an ascent (currently probably being led in practice by Rust, I think, if it's not already bigger than Haskell it probably will be in less than a year), but it's still pretty early.
- mordocai 10y agoOnly thing I'd add is that homoiconicity is a big selling point that python doesn't have either. So "macros, a focus on recursion, and homoiconicity" might be the short list of things lisp has that python doesn't. (Common Lisp is also truly multi paradigm, unlike python)
- jerf 10y agoI consider homoiconicity to fit into the "macros". Other languages have macros, but they are at maximal power in the Lisps. On the one hand, it doesn't seem to me to be strictly necessary to be "homoiconic" for macros to work. On the other hand, it seems like non-homoiconic languages always end up mitigating the power somehow. Maybe it's just correlation rather than causation, but unless you're planning to write a new language that doesn't matter much in practice.
- YeGoblynQueenne 10y agoI do all of my own projects in Prolog, but I wouldn't immediately recommend it for AI- neither would I recommend Lisp, ML or Haskell for that matter. AI today is machine learning which means R, Python, Matlab, possibly Mathematica, Lua (for Torch), Julia etc- or even plain Java (more precisely: Wekka). Prolog and Lisp are interesting if you're into programming language design, as examples of their respective paradigms. They both used to be the "languages of AI" back in the day (as in ten or so years ago... ) before the modern wave of machine learning. Most Prologs for instance don't have any machine learning or even tensor manipulation libraries to speak of [1], so if you want to learn about machine learning algorithms you have to do it yourself from scratch. Which can be a great way to learn of course. One very big exception to the above: if you want to learn about the original AI project, before the most recent machine learning wave, then to an extent you can't avoid Prolog or Lisp. Many of the GOFAI textbooks are also Lisp and Prolog textbooks (or the other way around) so by reading about the one you necessarily learn about the other. One excellent such resource is George Luger's book, "AI Algorithms, Data Structures, and Idioms in Prolog, LISP, and Java": http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0136070477_1.pdf http://wps.aw.com/wps/media/objects/5771/5909832/PDF/Luger_0... ______ [1] Though all it takes is someone with a bit of time in their hands. Watch this space.
- nickpsecurity 10y ago"but I wouldn't immediately recommend it for AI- neither would I recommend Lisp, ML or Haskell for that matter. AI today is machine learning which means R, Python, Matlab, possibly Mathematica, Lua (for Torch), Julia etc- or even plain Java (more precisely: Wekka)." More like machine learning is about machine learning. Remember that AI has always been a bunch of subfields. One or more are extremely popular at any given point. There's still usage of rule-based, agent-based, GA, NN, lots of heuristic planners, and this number-crunching stuff called ML. The old books I started with on it taught LISP, Prolog, Poplog, etc. These days, given all I've seen, I'm strongly against Prolog for real-world AI as the best approaches use a mix of techniques with often imprecise "facts" in their "heads." Watson architecture is a good example, although I think they still use Prolog in part of it. Best approach, born out of old days, is to use a LISP for the AI but build-in Prolog, Standard ML, or others as DSL's for specific problems. Allegro CL, Racket, and sklogic's tool all do that. Gives you max flexibility plus ability to express solution in language closest to your mental model of the problem.
- pjc50 10y agoLisp is relevant to what you might call the "future that used to be" of AI. Projects like SHRDLU. Back in the days when it was thought that better structured representation of symbolic data was the key to AI. Modern AI is more of a numerical-statistical steamroller, where you're better off learning numpy or R and the like.
- lispm 10y agoThat's just one part of AI. If you want to see how 'dumb' the 'modern AI' is, you just have to use stuff like Google Translate. Modern. But dumb. Not AI.
- marcosdumay 10y agoYes, everybody looking for mind-expansion should learn Lisp (and Haskell too). Just don't box yourself into the Lisp best practices. Those are great for creating successful projects, but not for learning what programming can be. (Nowadays I think this advice will extend to Haskell too, but I'm still not certain.) I don't think it will be relevant for any modern AI (ditto for Prolog). But knowing it does change the way you program - more yet if you are in some "domain specific language prone" environment, like Haskell. I'll also agree with weavie in that you'll probably won't ever be "done" learning Haskell, nor taking lessons from Lisp. I don't think anybody has ever been.
- qwertyuiop924 10y agoSICP isn't all of lisp. But it teaches you a lot about programming. Lisp or Scheme are good languages to learn, and I would reccomend them Smalltalk is perhaps the only "real" object oriented language. It's a fantastic language to learn, and in some ways very similar to Lisp. While you're at it, learn CLOS or its cousins in Schemeland, which have some similarities. I've heard that some OO fans swear by them. Prolog is the furthest from conventional programming of the three, and I'm not very familiar with it. I'd definitely reccomend learning it, though.
- brudgers 10y agoLisp (SICP)? Smalltalk? Prolog? Yes? For mind expansion, I'd probably add J. For Lisp specifically, I'd look at Racket over SICP because Racket is an ecosystem where a lot of interesting new work is happening and SICP is not really a book on Lisp programming (e.g. it does not address macros (the book on Lisp macros is Graham's On Lisp)). The current main stream of AI is built on statistics and machine learning. It's psychological basis is behaviorism. Lisp (and Prolog) are more likely to be applied in symboloic (psychologically Jungian?/Freudian?/Lacanian?/etc?) approaches to AI. There are classic AI text books that use Common Lisp, and it's also an interesting language (there's a Rails like convention over configuration embedded in it).