5 ms·
A question I have that's not answered by the link is why would I want to learn lisp? If you were starting a project today, what are some of the features Lisp of
by JLCarveth 4y ago
A question I have that's not answered by the link is why would I want to learn lisp? If you were starting a project today, what are some of the features Lisp offers that make it a better choice than any other (more popular) language? And do those features outweigh the lack of community the larger languages have?
- deleted 4y ago[deleted]
- rjsw 4y agoI use Common Lisp because applications run faster than those written in Python or Ruby and are easier for me to write than if I was using C++.
- ravi-delia 4y agoHonestly I just really like the ergonomics of CL. A lot of the features totally exist elsewhere, but weirdly you don't see things like implicit return or a total focus on expressions in dynamic languages too often. Also, I'm a weirdo that genuinely finds parentheses pretty. It's the language I use for all my personal projects because it's the language I enjoy using the most. I don't think I'd use it for work though- the benefits are pretty individual, and people in general seem to like C over CL.
- weaksauce 4y ago> but weirdly you don't see things like implicit return that's been a thing in ruby since probably forever and it's one of the defining things about it
- ravi-delia 4y agoAnd Elixir, from both parents. Ruby is an odd duck in a lot of ways, being so lisp- and smalltalk-inspired. It also only has expressions- another functionalish feature that seems like a total no-brainer. Beyond Ruby though, we just aren't looking at a huge number of dynamic languages with these features.
- tmtvl 4y agoRuby might have taken that from Perl, which also implicitly returns the last evaluated statement in a subroutine.
- weaksauce 4y agoprobably did... ruby took a lot from perl... also took a lot from many other languages but perl probably the most
- lilith_of_debts 4y agoFun fact: Matz was a lisper prior to creating ruby. He even wrote an email client entirely in Emacs lisp. Not wrong that ruby took a lot from perl, but it was heavily influenced by lisp and smalltalk and I'd personally argue those are the two largest influences. It does seem that ruby was specifically designed to grab Perl programmers though. Several features match exactly.
- EFreethought 4y agoAnd maybe Perl got it from Lisp. It seems like the longer I am in software development, I find out that more and more things came from Lisp.
- wglb 4y agoAgree, but it did kind of borrow the format statement from Fortran.
- srcreigh 4y agoIt’s also a thing in Rust and other functional languages such as Haskell, Scala
- ravi-delia 4y agoAbsolutely, but not in dynamic languages. Elixir (well, and Erlang) and Ruby are the only non-lisp dynamic languages I'm aware of with the feature. It's not the only thing I like, but it's a major component of the "functionalish" features that I really like and mostly see attached to static functional languages. Rust is fairly mainstream, and I think a step in the right direction. Honestly I suspect that many people who like Rust actually just like a fast systems language with niceties like implicit return and iterators.
- weaksauce 4y agorust is interesting but also a decent amount of ruby folk went to rust... i have no clue if they were part of the building of rust or not but the bundler people went to rust and made the package manager for rust too. the OP was talking about dynamic languages... haskell and scala are not too surprising that they have implicit returns since they are functional paradigms foremost.
- culebron21 4y agoJulia has it as well.
- ravi-delia 4y agoI hear Julia is quite lisp-y in general, so that makes sense. I've been meaning to get around to it regardless- it seems like it could be a lot more ergonomic than relying on numpy.
- mtlmtlmtlmtl 4y agoLisp is perfect for one man projects, personal tooling, templating for languages you prefer not to write, etc. To me it's more of a programmer's swiss army knife than a language I'd use in a big project that needs to be accessible to a larger team.
- deleted 4y ago[deleted]
- ekidd 4y agoI haven't actively used Common Lisp in years. But for a long time, I used it professionally. Common Lisp's greatest strength is that it's "the programmable programming language." You can customize everything from the lexer to the syntax, and you can extensively customize or even replace the object model. It's trivial to write code that writes code. There are some limitations. Haskell, for example, is less customizable but it works very well at high levels of mathematical abstraction. Now, in practice, I don't often need the specific kinds of power that Lisp offers. Or rather, when I do need it, I don't need that power instantly at my fingertips. Completely customizing your programming language is something you should think long and hard before doing, and the median team will do it very badly. So I'm happy with the tradeoff offered by Rust macros, for example: They're harder to use than Common Lisp macros, so you only use them when you need them badly enough. Even for most above-average teams, I think it's a net win for macros to be a bit obnoxious to use. But if you ever find yourself on a small team of incredibly talented programming language designers, and you're working in a problem space where no off-the-shelf language can do what you need, then Common Lisp is well worth a hard look. Paul Graham's "On Lisp" is actually an excellent overview of the kinds of things you can do with Lisp. Norvig's first AI book is also a good demonstration of Lisp, even if the "AI" part is hopelessly obsolete at this point.
- JLCarveth 4y agoJust downloaded "On Lisp", thank you for the suggestion!
- FatActor 4y agoDo you speak multiple human languages? I speak English and French. There are subjective future tenses in French that can be transliterated, but don't really capture the spirit of the writer: one needs to elaborate in English with such verbosity that it takes a page in English to explain a sentence in French. I'm sure the reverse is true were I a native French speaker. My theory as to why so many existentialists were french was because the language was made for it. :) Same goes for computer languages. I use LISP when I have computer science-y things I want to explore. For example, I was working on a path finding algorithm for fun years ago and I went to LISP because it is much more natural at conceptual programming. But I wouldn't use LISP to create a GUI, even though it can, nor would I try to write performant 3D graphics. But I would use it to craft a game engine (I wrote a frame language in the early 2000's as part of a game engine that I never finished because once i got the agents decision making working I felt satisfied enough). The right tool for the right job... Need to munge a file? PERL Need to write an embedded application? C Need to write a GUI? A JS framework (or Qt, or Motif/X if I'm feeling nostalgic) Need to write a fast loop? ASM Need to write a something stats-related? Python, R, JMP Need to explore a computer science problem? LISP, SmallTalk (I don't know Haskell) Need to work on a project that you're forced to? C++ :)
- anthk 4y ago>Need to write a fast loop? ASM Let GCC/Clang solve that for you. >Need to explore a computer science problem? LISP, SmallTalk (I don't know Haskell) Scheme it's far easier.
- satvikpendem 4y agoRead this: An Intuition for Lisp Syntax (https://stopa.io/post/265 https://stopa.io/post/265) Lisp is simply a different way of thinking, in S-expressions. It's hard to explain but easier to show you, via the above link.
- mikelevins 4y agoIf the Lisp way of thinking about and solving problems is a good fit for you, then you should learn it because it will make you happier and more productive. If not, then don't bother. That's a Catch-22, of course. How will you know if it's a good fit for you unless you learn it? So that reduces the decision to: if you are curious whether Lisp is a good fit for you, learn enough of it to find out. If you're not curious about that, don't bother. But you might want a preview of what things make it a good fit for some people. Lisp in general, and Common Lisp in particular, is a good fit for me because its default mode of operation is to start the Lisp running and teach it by interacting with it expression-by-expression how to be the program I want to build. Common Lisp is consciously designed to work this way, and provides a host of well-designed conveniences for it. It turns out that working that way makes me happier and more productive than working any other way, so it's my favorite programming language. Not very many other programming languages work that way, but to be fair, some do. Examples of some that do are Smalltalk, FORTH, and Factor. Some languages and implementations provide more support than others for that style of work. The most comprehensive support for it is to be found in Common Lisp and Smalltalk implementations. If that sounds interesting, then it's probably worth your time to learn Lisp (or one of the other languages I mentioned). If not, then I wouldn't worry about it.
- lordgroff 4y agoThere are macros in other languages but nowhere will they merge with the language as effortlessly as in the case of Lisp's syntax. The way Lisp is structured means that almost certainly if you're missing language feature X you can bolt it on, stacking the new features on top of each other to make whatever abstraction you see fit. It's the kind of thing that makes a Lisp head amused when someone talks about the genius of C# and LINQ (as an example). If you need an abstraction in Lisp, you can almost certainly build it in an ergonomic fashion that just doesn't have a parallel in other languages. It's one of those powers you don't fully appreciate until you have it and then every other language seems hilariously inadequate in comparison. With great power cones great responsibility and it can all crumble with a lack of discipline (hence why I'm also a fan of ridiculously restrictive languages like Go), but honestly the sort of meta programming possible in Lisp has no equal I know of.
- michaelsbradley 4y agoMaybe try Nim. It's a statically typed compiled language and sports a macro system that allows for direct manipulation of the AST. If you don't need to write full blown macros, Nim also offers templates, which are a simpler form of Nim's macros: simpler to write, but not quite as expressive. https://nim-lang.org/docs/manual.html#macros https://nim-lang.org/docs/manual.html#macros https://nim-lang.org/docs/manual.html#templates https://nim-lang.org/docs/manual.html#templates
- dmux 4y agoFor me, I've always been fascinated with "live programming environments" and that's been the driving force behind me diving into Common Lisp. I've really come to appreciate this way of working: I was recently working on a web-app that talks to a PostgreSQL database. Normally when developing an app that talks to a database, I'll likely poke around and test out some queries using pgAdmin, the command line, etc. In my Common Lisp app however, once I've got a connection-object to the database, I can just write my queries _within_ the running Lisp system and completely remove the need for those other tools. The plus side is that the data I get back is already in a format that Lisp can deal with. The liveness of the Lisp system really allows for "exploratory" programming.
- vindarel 4y agoThis 100%. We have excellent DB libraries, they make CL a no-brainer for a LOT of applications, big or small. The simplest app I have in prod reads data from an existing DB, formats it and sends it to a FTP. No UI, it's a CLI. Runs daily with cron. Was easy to build, to deploy (standalone binary), to maintain. Build and forget.
- julianeon 4y agoA good use case is Emacs. Haven't you ever thought "hmm, I could do this job faster if I had my own plugin/extension here?" Lisp is really good for that, when used within Emacs. Extensions are very very simple, basically just the simplest functions inserted into your .emacs file.
- srcreigh 4y agoLisp shines with macros. I like to use macros to add new static checks to the code For ex I wrote about one such check here https://tech.perpetua.io/2022/01/generating-sqlite-bindings-with-racket-macros/ https://tech.perpetua.io/2022/01/generating-sqlite-bindings-... This macro checks SQLite table/column references. Aka, if you try to access user_id when the table doesn’t have that column, the “user_id” text in your code will appear as a syntax error in your IDE and when you run the code. The typed racket project is a bigger example. They added a typechecking system to the language, including a new typescript like variant. I’m not aware of any other language where 10 lines of idiomatic code right in your codebase can add a new IDE warning.