13 ms·
I'm studying CS but haven't heard any concrete examples of why I should learn a lisp (scheme, Clojure). Every time I ask i get pseudo-intellectual answers of ho
by yagodragon 6y ago
I'm studying CS but haven't heard any concrete examples of why I should learn a lisp (scheme, Clojure). Every time I ask i get pseudo-intellectual answers of how it will expand my mind, make it easier to express complex human problems/domains into code or even make me re-evaluate things in life on a philosophical level. What? On the one hand, i'm sooo curious to study all of this and see for myself, but on the other hand, life's too short and I'm already spending so much time in front of a PC to get my degree, learn a couple of more languages, make side projects on github, personal blogs etc to make myself more employable.
Anyway, i know this is HN i'm asking, but can you give me at least one compelling reason why I should study lisp,scheme or clojure ?
- qntty 6y agoI didn't read through the entirety of SICP, but I read through the first ~3 chapters, and it helped me to understand the way that functions are associated with the environment that they are defined in and how this fact can be used to construct closures. I haven't seen as good of a description of this up until that point.
- nightski 6y agoIf you need someone online to justify for you learning new things in your field you have probably already lost. This field is unrelenting, it requires constant learning. I'm nearing 40 and it hasn't stopped. The one advantage is the more you learn the more skills transfer from one thing to the next. So the most compelling reason I have is because learning new things should be something that you find exciting. What makes Lisp unique is that it is a lot different than other languages out there. If you know one imperative language, learning another may expand your horizons but not in the same way something from a different paradigm would. If you already know a functional language or two, then it might not be worthwhile. That is very much up to you. But even though I have never used Lisp I enjoyed learning it immensely. Although I'd say I enjoyed Haskell more. I will say back in the day I watched these lectures and found them incredibly satisfying and thought provoking.
- seneca 6y ago> If you need someone online to justify for you learning new things in your field you have probably already lost. This is really unhelpful gate keeping. You're respond to someone who literally just said they spend excessive time studying the field already.
- dunefox 6y ago> This is really unhelpful gate keeping. I don't think it is. If you don't have time to learn interesting stuff because you "have to write blog articles to make yourself more employable" then you will probably lose motivation or interest in CS.
- smcl 6y agoI think the point was that many people talk breathlessly about Lisp but are often quite hand-wavey about specifics. When this concern has come up before I've seen them dismissed with comments along the lines of "if you have to ask you won't get it" or "just read SICP". I've written and read a bunch of lisp and I'm slowly working my way through SICP at a leisurely pace, but I totally understand what these OP means. Some talk about lisp as something magical (it appears on xkcd as a sort of "god's programming language" - https://xkcd.com/224 https://xkcd.com/224) yet often seem cagey about actually sharing exactly why they think so. A great example of what I mean is this pretty famous essay by pg: http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html. In fact he says "Lisp is so great not because of some magic quality visible only to devotees, but because it is simply the most powerful language available" - which seems to dispel the "magic" bit ... but then throws out the tantalising "most powerful language" without (in my opinion) giving a compelling argument. He mentions how lisp macros are more powerful than those in C and does say "Lisp code is made out of Lisp data objects" and a few other bits and pieces about how it was higher-level than other popular languages at the time (the mid-1990s). It certainly made me curious to explore the language, but definitely left me with unanswered questions. My opinion is that this phenomenon is a result of a number of things, including: 1. some people went through a transformative experience through learning lisp, and are deliberately vague to entice others into exploring it without ruining some of the fun of self-discovery 2. some people had the same, but think that it's enough to declare these things and don't care if you believe them or not 3. some people parrot what they have read some smart folks say and simply can't formulate a good explanation even if they wanted to
- bonoboTP 6y agoDon't overthink it. You've clearly come across Lisp and wondered about it enough to read up on people's opinions and to post a comment. That's reason enough. I'd encourage you just go and try it out. Spend an evening or a Saturday reading a book / working through a tutorial to see for yourself. You cannot lose anything. At worst, you find out you don't like it, but at least you will have some first-hand opinion and an idea of what everyone is talking about. Good approach for all those things you've always been hearing/wondering about but never tipped in your toes.
- aidannlb 6y agoYou'll learn how to solve problems using recursion and by passing functions around as variables (because you'll have to). Which is useful, because sometimes those are by far the most elegant way of doing things. That's the main practical pay-off I've found. Before going through parts of SICP I found understanding Python code that used lambdas and recursion hard to understand, now I often end up writing such code myself.
- martincmartin 6y agoLisps have a uniform syntax in S-expressions. This makes it unfamiliar to new users, but it means syntax just melts away, and you're expressing the abstract syntax tree of your program directly. So writing code to manipulate abstract syntax trees becomes easy, since you're using to writing & thinking about programs in that form, and it's just manipulating lists, which is easy. For example, it becomes easy to write a program to symbolically differentiate an input expression. You also think about functions as something easy and natural to pass around. They also encourage pure functions, which allow lazy evaluation, easy memoization, and other fun things.
- pjmorris 6y agoLisps capture something fundamental about computation more cleanly than other languages. In Alan Kay's words, "Yes, that was the big revelation to me when I was in graduate school—when I finally understood that the half page of code on the bottom of page 13 of the Lisp 1.5 manual was Lisp in itself. These were “Maxwell’s Equations of Software!” - lifted from [0] [0] http://www.righto.com/2008/07/maxwells-equations-of-software-examined.html http://www.righto.com/2008/07/maxwells-equations-of-software...
- mamcx 6y agoI don't like lisp, not code in lisp; not even a line.. and I have read TONS of lisp stuff. Why? The #1 reason: The lisp people have a lot of cool things to teach. One of the most obvious examples: https://www.infoq.com/presentations/Simple-Made-Easy/ https://www.infoq.com/presentations/Simple-Made-Easy/ So, you can learn enough of Lisp or APL or oCalm or Haskell to tag along with somebody smart on the field (that use certain lang, maybe for very good reasons, maybe is just what he like) and understand stuff. Most of the real gems are kind of easy to learn with the most basic understanding of a language. --- A lot of times, is THAT kind of people that have the better insights of why certain lang matter. Continue with the example of Rich Hickey: https://dl.acm.org/doi/abs/10.1145/3386321 https://dl.acm.org/doi/abs/10.1145/3386321 --- You can translate a lot of ideas from a lang to other, as the most basic and simply benefits. Is just the case that certain langs fit the minds/goals/niches better, so is there where to look for better answers...
- babarock 6y agoFirst of all, I want to mention that SICP is so much more than learning lisp. As a matter of fact, learning lisp only takes 10 minutes in the first lecture. The rest of the course is about learning programming techniques (and _magic_ as they call it) with the explicit intent of learning to manage complexity. Even if you're completely fluent in lisp, taking this class will be massively mind opening. With this out of the way, what's so special about lisp? Where did it get this reputation for mind-expansion? Part of it is historical. 20-30 years ago, the industry was focused around _stricter_ (for lack of a better term) languages like C++ or Java, and lisp presented some features that were super powerful, like REPL, interactive debuggers, higher order functions, lexical scoping, lambdas, etc. Lots of mainstream languages have since adopted these features (python, perl, ruby, javascript, ...), making lisp a bit less exotic than it used to be. Still, today, there're some things that are unique to lisp that might be worth studying. The most important thing is macros. Macros are only possible because of the (lack of) syntax of lisp. It's a programming technique that consists of _programming your compiler_, for lack of a better term. It allows you to define a language specific to the domain you're working on. Pretty unique technique, and like all the other techniques, sometimes smart, sometimes useless, sometimes abused. I still believe it's worth learning, because understanding how macros work will explain a lot of things about the other tools you're using as a programmer. I hope this makes things a bit clearer. TLDR: A lot of what made lisp special is now available in other languages. Learning lisp is still worth it to expose you to _macros_. Regardless of how well you know lisp, going through SICP will be massively beneficial.
- infinite8s 6y agoYou do realize that LISP is older than both C++ and Java (by at least a few decades) :)
- craigsmansion 6y ago> [it will] make it easier to express complex human problems/domains into code What is "pseudo-intellectual" about that answer? > i'm sooo curious to study all of this and see for myself Good thing SICP is available online, and there are even recorded classes of it with two legendary professors available online somewhere. > life's too short and I'm already spending so much time in front of a PC Yet, here we are.
- Jtsummers 6y agohttp://minikanren.org http://minikanren.org I was trying to come up with examples to demonstrate the value of lisp in my own work, but I think this one captures it better. Imagine being able to use your language to create a language, that still interacts with everything else, and express it so clearly that people can translate that into dozens of other languages. If you were to write that initially in Java or C or something it would be hard to separate the essential complexity (the problem of solving relational problems) from the accidental complexity (managing the underlying language's semantics and data structures and such) while keeping the entire code base clean and clear. Lisps do a better job of eliminating or reducing accidental complexity compared to many mainstream languages, especially the enterprise-y ones like Java and C#, which are commonly used in CS education unless you're at a unique school or one of the top schools in the US (without experience, I can't comment on what non-US schools teach).
- cellularmitosis 6y agoI think the primary thing which differentiates SICP's approach in particular is the wishful-thinking-driven-development, or "top-down development". You start at the top-level function, and write it completely, calling functions which you have named but haven't written yet. Then implement those, and so on. Yes, this is possible in other dyn langs as well, but SICP really emphasizes this approach. One of the most interesting bits which differentiates lisps in general are macros. This gives you a lot of power over the language. You aren't stuck waiting on the language designers to give you new language-level features -- you can write them yourself! The first example which comes to mind is asynchronous programming. In Clojure, core.async is a library, not a language-level feature! Stop and really think about that. Also illustrative is to download the Clojure source and 'grep -r defmacro src/' and look through the results. A lot of what would be keywords in other languages are simply macros in a lisp. That means you could have written them yourself!!! The "threading macro" ('->' and '->>') is the one I like to point to. Any user could have come up with that! This is like being able to add list comprehensions to the Python language, but as a user! (disclaimer: I haven't written Clojure in anger, yet!)
- njharman 6y ago> could have written yourself This. Is a divide between programmers. Some are thrilled by this. Others, like me, see the power and flexibilty and front disagree it can be good. But their day to day problems are not lacking the most expressive, efficient Lang. Its communication, process, deadlines, change, domain knowledge, etc. I didn't and don't want to invest my limited mental power in learning and keeping up with all about compiler Lang design CS theory. I want to use a language people much smarter and experienced with compiler and language design and theory have made for me. I want to build a program using the domain specific knowledge I've invested in. Not build program to write other programs..
- bitwize 6y ago> I'm studying CS but haven't heard any concrete examples of why I should learn a lisp (scheme, Clojure). Every time I ask i get pseudo-intellectual answers of how it will expand my mind, make it easier to express complex human problems/domains into code or even make me re-evaluate things in life on a philosophical level. What? Lisp is very close to the Tao, and the Tao that can be spoken of is not the true Tao. That's why no one can tell you in concrete terms the greatest benefits of Lisp's eldritch power, and they all end up in spirals of circumlocution about "lack of syntax" or "homoiconicity" or somesuch. You have to experience it for yourself before you "get it". The fact that McCarthy devised (or discovered) a powerful, high-level language with an extensible, morphable syntax that's definable in terms of itself in seven functions (and those functions were themselves readily convertible by hand to machine code) should be a massive clue, though. > but on the other hand, life's too short and I'm already spending so much time in front of a PC to get my degree, learn a couple of more languages, make side projects on github, personal blogs etc to make myself more employable. That's part of your problem. You are too busy chasing good-boy points from the job market to really sit down and study this stuff. My suggestion is to focus on your collegiate studies for now. If you have time, study an additional language/CS topic or two, but only stuff you can get really interested or engrossed in. There's a good chance that eventually, Lisp will call to you. It's one of those ideas in CS that are so profoundly good that if you are interested in CS, you will be interested in Lisp, at least the history of Lisp and what it brought to the table. If you are just looking for practical reasons to learn a language that translate directly to résumé padding and more zeros on your starting salary, then JavaScript is an acceptable Lisp and you may as well stick with something like that.
- Jach 6y ago> Anyway, i know this is HN i'm asking, but can you give me at least one compelling reason why I should study lisp,scheme or clojure ? In Common Lisp: * (eql 'i 'I) T In Clojure: user=> (= '(lisp,scheme or clojure ?) '(lisp, scheme, or clojure ?)) true Downvotes accepted for the grammar snark, I only mean it as a light ribbing (and casual warning that programmers looking at resumes are often, probably unfairly, going to penalize such mistakes more harshly than they reward complex side projects). More seriously: do you like programming? And furthermore, are you interested in studying programming itself, not (just) programming as a means to other things? Are you perhaps interested in studying CS itself, not just exam material of whatever collection of courses that grants you a CS degree? If no, then you probably won't be compelled by any one reason to study anything beyond that which might let you get a well-paying programming job (perhaps as a gateway to getting a management job in tech), and lisp is not such a necessity. Nothing wrong with that, but inspect your motives carefully and plan accordingly. If yes to any of those, studying new languages will be rewarding, and lisps have a lot to offer. For instance, if you studied Common Lisp, you would have an environment suitable for practical programming of applications in any domain, you would not want for language features either because Lisp supported them anywhere from recently to 50+ years ago (realize it took until Java 8 for Java to get anonymous functions, and even then you're better served by SICP to learn tasteful application of programming with them, just as you're better served by Clojure to learn tasteful application of immutable data structures) or you can add them yourself without awaiting a new version, you would have a language good for researching CS topics such as new languages (and compilers), data structures, garbage collectors, type systems, theorem provers, AI, etc., and you might save future-you some hours or anxiety when it comes to "unrelenting, constant learning" because you can frame this week's fad into concepts you already know from Lisp. Maybe the most compelling reason to study though is that of there not being a better time. If you are so curious, just go study already! And if several hours of study makes you lose interest, or decide it's all fluff evangelized by lisp zealots not worth pursuing further, then go ahead and study something else that interests you. But the time is now. Post-college, you'll likely have less opportunity, less desire, and less time to satisfy your curiosities, so indulge while you can. And since this is HN, a recent pg twitter thread to contemplate: https://twitter.com/paulg/status/1274632047303315456 https://twitter.com/paulg/status/1274632047303315456
- bhntr3 6y agoI don't think you really need to "learn a lisp" but I recommend that curious developers read SICP at some point. John McCarthy famously wrote a lisp interpreter in a half page of lisp in the lisp 1.5 manual. The simplicity of the interpreter makes it possible for SICP to really focus in on the essence of what programming languages are and how features can be incrementally added. Imagine trying to learn programming by building a java compiler. Lisp is a much simpler language for learning how languages work. The lisp interpreter is so simple because the code of lisp is written in the data structures of the languages: a bunch of nested lists. So the parsed syntax tree is very similar to the code. This means that meta-programming on it is much easier to reason about. You can write macros in other languages to change the functioning of the language itself but it's much more complicated for complex syntax. This makes lisps languages for creating your own language. Some people probably love lisp because they're inspired by it but people who consider its power indispensable (pg) probably customize it a lot with macros. Someday you may find yourself implementing a lisp unintentionally (https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule) . IMO this is because it's natural to start with some text based data structure format (JSON?) for some config file or something and then add features incrementally. Suddenly you're making a lisp. Understanding lisp can help you realize you're building a bad one. This has happened to me before. Lisp is also very interesting if you want to write code that writes itself. For instance, if you were toying with genetic algorithms the fact that every piece of lisp code within matched parens is itself a valid lisp program is a nice feature to have. In the end though, I don't think actually using lisp is as important as understanding lisp. I can see the insane power of meta-programming for creating higher abstractions for myself or a small team of like minded individuals. But whether it's lisp macros, scala implicits, annotation based byte code rewriting in java or method_missing in ruby, I think that meta-programming becomes a form of obfuscation for really large teams. If you take away meta-programming from lisp you still have some really cool languages. But I think many of those cool things about lisp can be achieved in more mainstream languages if you understand what you're trying to achieve. After all, Brendan Eich was inspired by scheme when he created Javascript in ten days. But he was told to make the syntax "like Java". That's a bit ironic given that Guy Steele (one of the creators of Scheme) helped write the original Java specification. Neither language is very scheme-like in the end. But both authors contend that the languages would have been a lot worse if they hadn't been around to put a bit of lispiness into them. So the last reason to learn lisp is that if you ever get asked to make a programming language for a large company with lots of stupid restrictions in a very short time frame you might be able to inject enough lisp into it that people will still use it under duress 25-30 years later.
- tzone 6y agoI think you can spend your time learning much more useful things in Software Engineering than learning Lisp or Scheme. Examples: * Learn about type systems: advantages and disadvantages of various modern (or older) type systems: c++, java, typescript, rust, go, etc... Understanding pros and cons of various type systems would help you improve as a software engineer, and make you better at designing proper abstractions and apis in whatever language you are working in. * Learn about concurrency primitives, asynchronous event loops, parallel programming, etc. In modern software engineering pretty much every type of work involves concurrency, understanding what type of primitives exist in different platforms and languages, and what are their pros and cons would make you much more effective as a software engineer overall. * Learn about data structures in scope of data storage and data transfer in practice. Get understanding of network i/o, disk i/o, how things get stored in memory, how things get stored persistently. This stuff is way more complex and way more useful in practice than learning about slightly different ways of doing computation or calling functions in a programming language. * and many more... I would say in modern software engineering, part of "how to express basic computation" is really the least complex and least interesting of the bunch. You can skin that cat many ways but compared to many other challenges, it is in my opinion at the way bottom in terms of importance.
- tzs 6y agoI've noticed something. No one ever blows me away with something they've done in Python or PHP or C# or JavaScript. Whenever I see someone solve some problem in a way that is just obviously better than I could ever do they are almost always doing it in a Lisp, or APL, or Haskell, or some other language that is out of the mainstream for most programmers. Those kind of languages are harder to learn, and probably for most things you can still do them just fine in the more mainstream languages without much trouble. And so it is easy to not bother to learn them. If you are still doing this 40 years from now, though, I bet you'll look back and see that there were enough of those times where those other languages could have really made things easier for you that you will wish you had taken the time. I think there is an implicit assumption we make about programming: we aren't going to be doing it long term. We'll be code monkeys for a few years, then move on to management, or ownership, or take our IPO money and go pursue some non-programming passion and leave the cranking out code to someone else. We don’t learn the harder but more powerful stuff because we don’t expect to be programming long enough for that to pay off.
- sk0g 6y agoMaybe your area of interest is dominated by older programmer solving problems in languages they're most familiar with, which wouldn't be a recent(ish) one. I get the vibe from this comment that you think people are doing entirely unimpressive work in Python, PHP, JS, and C#. PHP seems to more or less be WordPress + extremely vulnerable packages if you don't update with great regularity, so I'll reluctantly agree. What about Python - machine learning, neural networks, and a common interface for scientists and more SWE types. C# - Unity games is an obvious example, but dotnet core looks very nice too. I guess a better question would be, what _do_ you find impressive?
- tzs 6y agoI may have been unclear. I am often greatly impressed by the work people do in those kinds of languages. But what impresses me are the algorithms they used. If I'm told the algorithms and understand them, and then look at an implementation in those languages it is almost certainly going to be in the ballpark of what I expected to see, and similar to how I would have implemented it. If I'm just told what the problem is, and not the algorithms used and shown the code that solves the problem I might not understand what is going on until I figure out the algorithm from the code, but all the statements in the program will make sense at least as far as what they do--I might not get why they do it until after I've figured out the algorithm, but I'll understand what.
- blihp 6y agoSince it sounds like your objective in CS is primarily career oriented (i.e. 'to make myself more employable'), Lisp probably won't offer you something you or the majority of your future employers are likely to value. You will occasionally come across an employer who will be looking for exposure to less mainstream languages/concepts where their absence will be a negative, but that's going to be a minority in the job market if that's your focus.