12 ms·
Show HN: Full Stack Lisp – A book in progress about writing Common Lisp apps
- zeveb 10y agoBest of luck! I like how you mention first thinking Common Lisp was archaic, and then realising how advanced it really is. BTW, you might want to wrap your text lines:-)
- shoover 10y ago+1. Kenny Tilton's blog is also great for that kind of thing. "You know Lisp is the perfect language precisely because it lost its momentum (died) and lives on. Other languages need their Next Big Thing momentum." http://smuglispweeny.blogspot.com/2013/08/wow-even-lispers-hate-lisp.html http://smuglispweeny.blogspot.com/2013/08/wow-even-lispers-h...
- PeCaN 10y agoI think the journey of a Lisper inevitably ends up with realizing that Common Lisp is not an acceptable Lisp. Then you start searching for an acceptable Lisp. You look at Tcl, at Prolog, Io, Rebol, and Icon; you learn Shen, try Scheme and Racket, appreciate Smalltalk and Self and Slate, wrap your head around Forth and Joy and Factor… and the whole time you write Common Lisp. Because there is no acceptable Lisp.
- kirubakaran 10y agoWhy is that though?
- adwf 10y agoBecause lisp is an immensely flexible language/concept. Everyone has their own idea of what it should be/can be. Common Lisp was exactly what it says "Common". Just some sort of common ground between all the various lisp dialects that existed, because everyone went their own way in extending the language. People end up coming back to it time and time again, because all the others don't quite provide that common ground for people to work on. Whilst there may be things missing, there's always something more missing in other lisps.
- shaunxcode 10y agoThat is largely my story except for settling into clojure.
- eggy 10y agoI fit this description minus a few of the PLs you listed, and added Extempore's xtlang, PicoLisp, and LFE (Lisp Flavored Erlang), but I am hacking in CL again this week! I still think Shen has lots of potential.
- vseloved 10y ago.. and, finally, you realise that Common Lisp is an acceptable Lisp (because when you learn it well enough you start to understand how to tune it to make it acceptable for you personally ;)
- TheMagicHorsey 10y agoIs it full stack Lisp in the sense that Lisp is running on both the server and in the client (browser/mobile)? If it is the latter, that would be quite compelling. Clojure/Clojurescript is quite compelling from a developer point of view, since you don't have to switch mental context to develop your server and client code (as you would have to do if you develop Go on the server and JS in the browser).
- junke 10y agoI don't know if it will be explained in the book, but you can generate javascript from Lisp, using parenscript. https://common-lisp.net/project/parenscript/tutorial.html https://common-lisp.net/project/parenscript/tutorial.html
- pavelludiq 10y agoI plan on covering par, but mostly the name came from an attempt to explain the current state of lisp libraries, the "stack".
- e12e 10y agoInteresting book. Your introduction covering toolsets, choice of lisp etc was enough that I bought a copy! I've been seeing (common) lisp everywhere lately, from talks on clasp to the recent(ish) work on (really) fast http parser for lisp etc. It really feels like cl, with the help of a few, but very much needed tools and libraries (like quicklisp) and mature implementations that compile down to machine code could have a bit of a renaissance. I think a lot of people simultaneously realized that one didn't have to code old style lisp, just because the cl spec has been written. Like the project to reimplement cl in cl. There's no need to rely on old broken crutches, just take the good parts of cl, combine with 40 years of experience from system and language engineering, and reduce back down to cl. And suddenly you have something very elegant and efficient and powerful. Ok, I admit, I still want "sweet expressions"[1] -- but I think just a simple thing like acknowledging that global variables with * earmuffs * , are still global variables - and generally a bad idea -- and that cl is much more than some small "functional" language goes a long way. I remember I came to lisp rather late, and was confused by how un-functional a lot of the code was. There was just a lot of messy examples with detached functions for manipulating ad-hoc data structures that didn't seem properly motivated at all. And it all seemed terribly brittle. But if one ignores all of that (and a lot of the classic lisp books), what emerges is that the "good" parts of cl are really great, and there's really no reason not to use those parts. And the warts in moderation (as with any other language). [1] http://srfi.schemers.org/srfi-110/srfi-110.html http://srfi.schemers.org/srfi-110/srfi-110.html
- crispytx 10y agoWhy is this on the front page of Hacker News? Isn't this an advertisement?
- mordocai 10y agoIt's free online and has a github repo under MIT license as well... so yeah it's an advertisement but for something that you can get for free.
- crispytx 10y agoI thought it was just one free chapter. Maybe I was mistaken?
- deleted 10y ago[deleted]
- dang 10y agoWork in progress is a fine thing to have on Hacker News as long as there's a way for users to check the work out. In this case there's a sample chapter, which more than clears that bar. In fact we've added "Show HN" to the title, because this is the kind of thing that Show HN is for: https://news.ycombinator.com/showhn.html https://news.ycombinator.com/showhn.html
- AlexeyBrin 10y agoThere is actually a link to read online on the same page https://leanpub.com/fullstacklisp/read https://leanpub.com/fullstacklisp/read
- taranw85 10y agoIsn't everything an advertisement in that case? This is something cool and technical and useful.
- theseatoms 10y agoExactly. HN itself is one big advertisement.
- deleted 10y ago[deleted]
- salampotya 10y agoThe cover is so catchy. I like it.
- avmich 10y agoCan you include a good description of reading macros? I'm still looking for good explanation with examples of their power.
- xenophonf 10y agoDo you mean reader macros? Those are used to implement new kinds of syntax within Common Lisp's parser, the READ function. Even standard parts of Common Lisp syntax are defined this way, such as quote (') or backquote (`). For more examples, see http://lisper.in/reader-macros/ http://lisper.in/reader-macros/.
- aidenn0 10y agoActually the entirety of Common Lisp's parser except for numbers, symbols, and the consing dot are implemented as read macros.
- junke 10y agoA reader macro is not a kind of macros [0]. It is a way to customize the Lisp reader by associating a custom function to an entry in the readtable. So you can say that character '[' will be tied to a custom reader function, which reads from a stream and produces a Lisp object, at readtime. The standard sharpsign[1] character is used to read different kind of structures: complex numbers #C(0 1), structs #S(tree :left nil :right nil), and so on. In particular, you can have sharpsign-dot, which reads a lisp form, evaluates it at read time; the result is the form being read. Also, you can use #1= and #1# to affect parts of your code to reader variables and reuse them in other places. If the PRINT-CIRCLE (there are earmuffs around it, but I can't format it here) variable is set to true, here is a quine: #1=(print '#1#) [0] http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_r.htm#reader_macro http://www.lispworks.com/documentation/HyperSpec/Body/26_glo... [1] http://www.lispworks.com/documentation/HyperSpec/Body/02_dh.htm http://www.lispworks.com/documentation/HyperSpec/Body/02_dh....
- kazinator 10y agoPoor cover art. How about fitting, into a single image, a joke about some ex-web developer, stacking pancakes at IHOP. Or maybe a visual reference to this type of full stack: https://www.google.com/search?q=guitar+full+stack&tbm=isch https://www.google.com/search?q=guitar+full+stack&tbm=isch
- imglorp 10y agoThe critter is a reference to http://landoflisp.com/ http://landoflisp.com/
- deleted 10y ago[deleted]
- TimJRobinson 10y agoI'd love to see more books like this for less common languages (Haskell particularly), as I've found there's generally plenty of resources for learning the basic commands and code structure but there's little information for going from those first steps to creating an actual useful application.
- xwowsersx 10y agoWorking on a video course https://www.youtube.com/watch?v=04ZZKFcpUoo https://www.youtube.com/watch?v=04ZZKFcpUoo though there is also a great book for Haskell now http://haskellbook.com/ http://haskellbook.com/
- sharmajai 10y agoI believe this is one of the major goals of http://book.realworldhaskell.org/read/ http://book.realworldhaskell.org/read/ With this book, we want to show you how to use functional programming and Haskell to solve realistic problems. This is a hands-on book: every chapter contains dozens of code samples, and many contain complete applications.
- vog 10y agoThere's also a similar book for OCaml: https://realworldocaml.org/ https://realworldocaml.org/
- seagreen 10y agoReal World Haskell is somewhat out of date. I'm not sure what to go with instead, but I've heard good things about Haskell Programming from First Principles (which has already been mentioned in this thread).
- marcosdumay 10y agoUnfortunately, that book is dated. It's not even that old, but it's already dated. Haskell has a discoverability problem, and a good modern book might be the best way to solve it. But it may be moving too fast for that currently.
- cadr 10y agoJust a nitpick, but I find the code part hard to read. Not sure if it is the colors or what. You might get some other feedback on it. Good luck!
- tropo 10y agoIt's just the language. Everything looks the same.
- cadr 10y agoNo, I'm use to reading Lisp. Something else, but I'm not a designer and can't quite put my finger on it.
- joelg 10y agoGiven your username alone, I'm inclined to believe that you are, in fact, used to reading Lisp.
- DonaldFisk 10y agoAssuming Lisp is correctly indented, it's quite easy to read. You can just ignore the parentheses for the most part, and concentrate on the layout and the built in macros - defun, let, do/loop, cond/if/when/unless/case, lambda, ... If it's written in a functional style it becomes even easier: you don't have to hold any state in your head.
- junke 10y agoWhat bothers me: - Line numbering is a little too close to code - There seem to be two kind of fonts for code, some render bigger than the other on two different devices - Texboxes are too narrow and as a result the code wraps around a lot. Maybe this due to my settings. The result might be different in the PDF.
- wtbob 10y agoAgreed. I think that the line numbers and machine-inserted hard breaks make it difficult to read. For the first issue, maybe the line numbers could be smaller and/or greyer, and offset more? For the second, I think human editing of the lines is probably required.
- AlexeyBrin 10y agoThe book can be read online, link is easy to miss but it is there https://leanpub.com/fullstacklisp/read https://leanpub.com/fullstacklisp/read
- valbaca 10y agoor click on the book cover. hard to miss
- Wonnk13 10y agoI missed it ...
- marvindanig 10y agoIt is interesting to see people call an image a "cover" and a website a book even when the said cover actually never covers anything nor there is a book in there because a website. Digital books are so broken!
- kazinator 10y agoIt's assumed that these deliverables will closely correspond to the printed ones. If you scan a dead tree book to PDF, and you include an image of the outside, that's still called a cover; PDF isn't broken.
- marvindanig 10y agoPDFs and Word were originally designed (still meant to) for enterprise documents, not books. It works somewhat for books too but then PDF is not really "on web". People still have to download an artifact, save it somewhere or may be bother about other similar digital book formats the same way. If that isn't broken then what is?
- kazinator 10y ago
- auvi 10y agoI really appreciate the author taking the time to write this book. I have read his previous book Lisp Web Tales and learned many things from it.
- mark_l_watson 10y agoVery nice, I love seeing new Common Lisp books being written. (BTW, I also have a Common Lisp book on leanpub.com - a great company to work with if you are a writer). It is especially good to see a complete caveman2 application developed in the book.
- eggy 10y agoI am in the middle of reading Adam Tornhill's 'Lisp for the Web', and I just stumbled on this book. Yes, Lisp seems to me to be getting more exposure, but that may be my 'Lisp-colored sunglasses' ;) Is caveman2 a lot easier, or what other advantages does it have over piecing stuff together? I have always liked and programmed in Lisp, but not for the Web, so I need to get up to speed with Web frontend/backend programming again for personal use, not a job. OT: Mark, I am on your 3 edition of 'Loving Common Lisp', and I really appreciate the Networking chapter update, and your smooth writing style!
- deckard1 10y agoor you realize Perl, Ruby, Python give you everything good from Lisp anyway with an environment and packages that can talk to the real world, and that macros and metaprogramming are massively overrated and a danger in almost any hands that touch those features. Ask me how long I spent banging my head against the wall trying to get OpenGL working in CMUCL with Alien. Jesus jumping-jack Christ. I can only hope things have improved in the past 12 years or so. But I highly doubt it.
- pavelludiq 10y agoI did python professional y for a few years and I missed lisp every day. There is much work to be done, but lisp has improved tremendously in the last decade.
- nilkn 10y agoI don't think that's true. For instance, Python has traditionally been really bad for concurrency but Lisp can be best-in-class (see Clojure's STM). Python is good for single-threaded concurrency now with coroutines and libraries like asyncio, but it still can't compete with something like STM for multithreaded concurrency.
- PuercoPop 10y agoWhy look at clojure's STM and not CL? https://github.com/cosmos72/stmx https://github.com/cosmos72/stmx
- pjmlp 10y ago> Perl, Ruby, Python give you everything good from Lisp So where are the: - AOT compilers to native code - REPL environments with GUI debuggers, with fix-and-continue? - Ability to do systems programming without having to use an external language? - Macros
- deckard1 10y ago> Macros You obviously didn't read my post before listing your pet list of things that are irrelevant. Macros are bad. They are only a benefit to those that are delusional enough to think they are a rockstar. > Ability to do systems programming without having to use an external language? I have no idea what this even means today. "systems programming". Are you from 1980? Perl is vastly more connected to *ix than any Lisp ever developed. There is nothing you can't do in Perl. Ruby and Python aren't that far behind, either. > AOT compilers to native code Totally unnecessary. I can't even think of a reason you'd want this in 2016. Maybe in 1989. But anyway, "native" is disingenuous when talking about Lisp. Unless you just like being an asshole. Lisp requires a GC, and due to the dynamic nature you're constantly jumping through dynamic/static hoops to get exactly what you want. The resulting executable is massive. Perl and I think Python can also compile to "native code". > REPL environments with GUI debuggers, with fix-and-continue? Uhm. Yes? The REPL GUI debugger everyone uses today is called Chrome. You seem to be stuck in the stone age. Web and mobile development are where it's at.
- PeCaN 10y agoAlright, controversial opinions time. (Before you downvote me out of spite, consider if this elaborates on why Lisp is still a much better language. That said, I fully realize this is an angry rant… and yes, I did call you a shit programmer.) Oh, and Common Lisp is one of the best languages for graphics programming around, so if you wade through the rant you'll see how stupid and ignorant it is to claim things haven't improved in 12 years…. Anyone who thinks "Perl, Ruby, Python give you everything good from Lisp anyway" has either never learned any Lisp or is an utterly helpless imbecile who entirely missed the point of Lisp. About the only good thing from Lisp those languages have is anonymous functions (except Python, which apparently decided anonymous functions are much too powerful to include in a programming language—after all, someone could potentially write confusing code with them). Python gives you nothing. Python is the new Java is the new COBOL. Shit language. Avoids anything remotely powerful or useful at all costs. Funny thing is, it could be pretty expressive if the community didn't discourage the use of the powerful features. Languages like Python are for shit programmers who avoid features like macros and metaprogramming. Python is for people who think "readable code" means explicit code, not code that models your problem domain. Python both failed to learn anything from languages that came before it AND failed to keep up as languages developed. It's rather impressive how big a steaming pile of shit Python has become, and how the people stuck wading through it seem not to notice. Blub in a nutshell. Perl and Ruby are much better, as at least both of them embrace their power. Arguably Perl and Ruby are very Lispy, actually. They're both inelegant, butt-ugly Lisps, but at least they're Lisps. Why not just use a real Lisp, though? > environment and packages that can talk to the real world Maybe if you're stuck in 1990, but the so-called "library problem" has hardly been an issue. There are a _lot_ of Common Lisp libraries out there, and they talk to the real world just fine. Speaking of which, OpenGL is quite usable from Common Lisp¹ (as is Vulkan², if that's your fancy). Heck, there's an interactive OpenGL REPL for Common Lisp³. AND there are mature SDL bindings⁴ AND a Processing-like tool that uses them to enable rapid prototyping⁵. There's also a nifty game engine that updates live as you code⁶. Fun stuff. Common Lisp somehow became a really really good language for graphics programming. Oh, and there are a number of high-performance HTTP servers⁷ ⁸ ⁹, if you like to write web applications in Common Lisp. Nice PostgreSQL bindings too¹⁰. Heck, the "real world" includes bare metal hardware, so why not write an OS in Lisp? ¹¹ ¹² You can use GTK3¹³ or Qt¹⁴ for GUIs, if you prefer that over OpenGL or a webapp. Other useful libraries: Crypto: libsodium https://github.com/orthecreedence/cl-sodium https://github.com/orthecreedence/cl-sodium Databases: Redis https://github.com/vseloved/cl-redis https://github.com/vseloved/cl-redis CouchDB https://common-lisp.net/project/clouchdb/ https://common-lisp.net/project/clouchdb/ Math: Linear algebra https://github.com/blindglobe/lisp-matrix https://github.com/blindglobe/lisp-matrix GNU Scientific Library https://common-lisp.net/project/gsll/ https://common-lisp.net/project/gsll/ And for the grand finale, you can use all your beloved Python libraries from Common Lisp: https://github.com/metawilm/cl-python https://github.com/metawilm/cl-python Time for the extra potshots at your ignorance, sorry, I couldn't resist: > macros and metaprogramming are massively overrated and a danger in almost any hands that touch those features. And that's when I realized you're either a troll or massively fucking retarded. We really mustn't let those devilish programmers use any powerful features to adapt the language to their problem at hand. Yikes. I'm definitely calling bullshit on you ever having used any Lisp. (Or then again, maybe you did and you're braindead, which is looking more likely. Don't let that extra chromosome get you Down!) -- ¹ https://github.com/3b/cl-opengl https://github.com/3b/cl-opengl ² https://github.com/3b/cl-vulkan https://github.com/3b/cl-vulkan ³ https://github.com/cbaggers/cepl https://github.com/cbaggers/cepl ⁴ https://github.com/lispgames/cl-sdl2 https://github.com/lispgames/cl-sdl2 ⁵ https://github.com/vydd/sketch https://github.com/vydd/sketch ⁶ https://github.com/BradWBeer/clinch https://github.com/BradWBeer/clinch ⁷ https://github.com/edicl/hunchentoot https://github.com/edicl/hunchentoot ⁸ https://github.com/fukamachi/woo https://github.com/fukamachi/woo ⁹ https://github.com/vii/teepeedee2 https://github.com/vii/teepeedee2 ¹⁰ https://github.com/marijnh/Postmodern https://github.com/marijnh/Postmodern ¹¹ https://github.com/whily/yalo https://github.com/whily/yalo ¹² https://github.com/froggey/Mezzano https://github.com/froggey/Mezzano ¹³ https://github.com/crategus/cl-cffi-gtk https://github.com/crategus/cl-cffi-gtk ¹⁴ https://github.com/commonqt/commonqt https://github.com/commonqt/commonqt
- Sam_Smith 10y agoWow, I agree I'm impressed with this offering by the author. I'm gonna add it to my list for sure! -- Sam Smith Web Developer and Aspiring Chef~ Large file transfers made easy. www.innorix.com/en/DS
- zelcon 10y agoI recently gave up Lisp for Clojure instead because of the dearth of "batteries," so this book is very important and timely.
- haspok 10y agoI'd love to read a chapter about why would someone choose Common Lisp instead of, say, Clojure (with all the JVM ecosystem behind it) or LFE (with the Erlang ecosystem behind it). What are the use cases in which CLISP stands out and offers a benefit?
- junke 10y agoFirst, you should not abbreviate Common Lisp as CLISP: this is confusing because CLISP is one of the many implementations of CL. As for comparisons, this is a Gorilla vs Shark problem (https://blog.stackoverflow.com/2011/08/gorilla-vs-shark/ https://blog.stackoverflow.com/2011/08/gorilla-vs-shark/), without context you can choose anything you prefer. LFE is not really Lisp, it is more like Erlang with parenthesis, so it is hardly comparable. Erlang offers a very specific, and useful, model of computation: if you need that, use Erlang or LTE. In CL vs. Clojure, I suppose CL looks riskier to use than Clojure, w.r.t. all those JVM libraries (and the coolness factor). I think this is false, because you can access Java/Clojure/C libraries from CL with ABCL/CFFI, whereas you cannot access the Common Lisp ecosystem from Clojure easily. But in the end, which programming language you use depends on many factors.
- haspok 10y agoLet me try to rephrase my question: I know what I can use Clojure or LFE/Erlang for and what their strengths/weaknesses are. I don't really know anything about Common LISP other than it is a LISP, so I would love to hear some factors that led some people to prefer Common LISP to anything else out there (other than personal preference, which is always a factor). Is it good at number crunching (which is not Clojure's and definitely not Erlang's forte)? Is it good at low level systems programming? Is it good for computers with low memory resources? Etc. In your words, I am looking for the context.
- pavelludiq 10y agoThat's a very complicated question. Common Lisp has many implementations, with different strengths and weaknesses. For example SBCL and CCL are good general purpose implementations. They're fairly performant, especially SBCL, properly optimized code can compete for C-like performance. ABCL gives you Java integration, not as nice as clojures for example, but perfectly usable IMO. ECL has a fairly small footprint and is good for embedding, it can also compile down to C I think. Clasp is a newcomer to the Common lisp world, it compiles to LLVM and provides C++ integration. It's creator uses it for chemistry and nanotech simulations, so he has many C++ libraries he wants to use with Lisp, so he wrote an implementation. There are also commercial offerings(LispWorks, Allegro CL) that come with additional support and their own graphical IDEs. When I switched from Clojure to Common lisp a few years ago, mostly I really like using multi-paradigm languages. Clojure code wants to be functional. Common lisp code has no such preference, and with the excellent OOP support it's a pleasure to use. Basically it's generic function based, rather than class based, which means that your methods are owned by your generic functions, rather than your classes. This gives you much more flexibility and power than "standard" OOP. I can write software in the style that best supports the problem I'm trying to solve. Other great features include the condition system, basically exceptions on steroids. Very few languages have something similar. Another one of my favorite features is that the standard has been stable for decades. The core language hasn't changed since 1994, so the ecosystem continues to evolve constantly, but the core stays stable and it isn't unheard of for code written in the 80's to run with little or no modifications. I like the idea that my code might have that kind of longevity. I could go on, but you get the general idea of having an extremely mature and stable language with many implementations that all try to solve different problems, with sufficient portability that fragmentation doesn't tend to happen(like in the scheme world for example). And personal taste of course, It's just a pleasure to use for some reason. I don't know why, but I'm just having way too much fun playing with it and trying to explain it to others.