4 ms·
Note to self: learn a lisp. Lisp people appear to be having more fun than the rest of us.
by __MatrixMan__ 3y ago
Note to self: learn a lisp. Lisp people appear to be having more fun than the rest of us.
- cfiggers 3y agoThere's literally dozens of us! If you're serious about learning a Lisp but motivated more by, as you say, "having more fun" rather than, say, landing a six-figure job writing it professionally... then may I recommend Janet[0] for your consideration. Janet is an embeddably-small, yet surprisingly batteries-included Lisp implemented in pure C. In terms of syntax and core library it borrows more directly from Clojure than from Scheme, but all the modern Lisps have their bits of influence. I've found both the language and the tiny little community that exists around it delightful. As an example of the latter, somebody smart wrote a real actual book[1] about Janet recently that was on the HN front page for a day or so when he first released it. It's a gentle introduction not just to Janet but to Lisp in general, and assumes only general proficiency with JavaScript to get you up to speed. I recommend it. [0] https://www.janet-lang.org https://www.janet-lang.org [1] https://janet.guide https://janet.guide
- TylerE 3y agoOoh that's actually really interesting. I've always been a bit into lisp... even did a bit of amatuer CL back in the day..but always thought the distribution model of basically a memory dump was just the worst of all possible worlds.
- bigfishrunning 3y agoI agree with this sentiment -- from a reproducability standpoint, CL images aren't great. My workflow has always been to maintain a source file and then use emacs to shove s-expressions into the repl -- that way, rather then save the image, i can just re-evaluate my source file and get a reasonable facsimile
- deleted 3y ago[deleted]
- dleslie 3y agoWhile I like Janet, and find it to be a lovely little language; I think it's important to note that it lacks lists and cons cells, and so as a result some people don't label it a lisp, and programming in it is unlike other lisp languages. It's similar, because the syntax is similar and the macros and various forms are lifted straight from lisps; but the feel of programming in it is very much like programming in C, and I find it's less like Scheme or Common Lisp. Because it's not built around linked lists, the core type most encountered for lists of data is arrays and tuples. Neither is conducive to efficiently removing elements mid-set, or composing two sets, or interleaving two sets, or other operations that require reordering, replacing, adding or removing elements in the set. When I'm writing code in lisp I don't think about that overhead much, because for linked lists it's not an issue.
- cnity 3y ago> Neither is conducive to efficiently removing elements mid-set, or composing two sets, or interleaving two sets, or other operations that require reordering, replacing, adding or removing elements in the set Read this: https://isocpp.org/blog/2014/06/stroustrup-lists https://isocpp.org/blog/2014/06/stroustrup-lists
- dleslie 3y agoThat's based around a contrived problem that was posed to him: > Insert a sequence of random integers into a sorted sequence, then remove those elements one by one as determined by a random sequece of positions: Do you use a vector (a contiguously allocated sequence of elements) or a linked list? The key is that the sequence is sorted; and is kept sorted throughout the insertion process.
- TylerE 3y agoFeature not a big in my book. A linked list is almost never the right answer. Certainly shouldn't be the default.
- hajile 3y ago> A linked list is almost never the right answer. And yet a subset of the linked list called a tree is usually the right answer to problems.
- vindarel 3y agoBut is Janet as interactive as Common Lisp? (REPL, image-based development, debugger, restarts…) The fun is there!
- cfiggers 3y agoYes, 100% to both the REPL and image-based development! Janet's REPL has a debug mode, but I'm sadly not qualified to evaluate whether/how it measures up to CL's due to my own inexperience with either. :) As for restarts (I had to Google around to get an idea of what that means)—it seems to me that Janet does not have first-class support for restarts in the way that some other Lisps, for e.g. CL, do. Presumably (as it would be in most other languages I would suppose) one could recreate that experience in Janet by tapping into the first-party error handling and REPL primitives. But you'd definitely be rolling your own rather than having it already in Janet out of the box.
- ikurei 3y agoSince you mentioned this, what would you say would be the right Lisp for more pragmatic, cynical reasons? What Lisp should we learn if we want to make money from it?
- cfiggers 3y agoIf I knew the answer to that question I'd probably have a very different job than the one I have. :)
- stcg 3y agoMaybe Clojure. In 2022 it took the top spot for "Top paying technologies" in the annual StackOverflow survey [0], and in 2023 it tied with other lispy languages [1]. That said, I don't think it matters much. A developer familiar with some lispy language (and perhaps functional programming) should be able to quickly pickup any other lispy language. And the developers that make the most money have probably used a lot of programming languages, with different paradigms. [0]: https://survey.stackoverflow.co/2022/#top-paying-technologies-programming-scripting-and-markup-languages https://survey.stackoverflow.co/2022/#top-paying-technologie... [1]: https://survey.stackoverflow.co/2023/#section-top-paying-technologies-top-paying-technologies https://survey.stackoverflow.co/2023/#section-top-paying-tec...
- defenestration 3y agoI had a lot of fun learning Clojure. While I don't use it in daily practice, I learned a lot about elegancy, the advantages of data immutability and using code as building blocks. For learning I used the 4clojure website where you can solve interactive coding puzzles and learn from solutions of others. See: https://4clojure.oxal.org https://4clojure.oxal.org
- jimbob45 3y agolearn from solutions of others I got my first job furiously doing that for nights on end. It felt like cheating but it’s ultimately way faster than waiting potentially years to figure out those tricks on your own.
- defenestration 3y agoYeah, good to hear. I also did this for nights on end. My strategy was to try to solve the puzzle myself first (in a reasonable amount of time) and then check the solutions of others. Always fun to see if I could make my solution faster/shorter/more elegant/etc. with the inspiration of the other solutions.
- Obscurity4340 3y agoWhat are the odds that someone gets accused of plagiarism for doing exactly that? Like, say there's a perfect solution in existence with the fewest lines/tokens of code all the elegant shortcuts and maybe a little bit of "sorcery", how likely is it for two people to work their way down the perfect solution and it basically looks exactly the same, maybe they followed the same logical workflow to arrive there, who knows... Edit: like a hash-collision for geeks
- kagevf 3y agoI don't know what the odds are of getting accused, but let's say this was in the context of an interview question, and every answer submitted looks almost 100% the same, or even more telling, has the same logic mistakes, then the odds could be high that plagiarism is afoot.
- tmtvl 3y agoI recommend Common Lisp, it's fast, it's mature, and it has some wicked cool tools. You can find some resources here: <https://stevelosh.com/blog/2018/08/a-road-to-common-lisp https://stevelosh.com/blog/2018/08/a-road-to-common-lisp>. You can also look at CLiki (the Common Lisp wiki), the Common Lisp Cookbook, and the Common Lisp Community Spec for information any basically anything you may be interested in.
- _0ffh 3y agoOn the risk of drawing the ire of our lisping friends, I find that I have more fun writing lisps than using them, at least unless I equip them with a syntax.
- LocalH 3y agoDoes modding a game that uses a bespoke Lispish scripting language count?
- bigfishrunning 3y agoYes! All you have to do to make a lisp is to make a thing and call it a lisp. Lists are recommended, but optional.
- carapace 3y agoOne great way to learn Lisp is to write your own: > The goal of the Make-A-Lisp project is to make it easy to write your own Lisp interpreter without sacrificing those many "Aha!" moments that come from ascending the McCarthy mountain. When you reach the peak of this particular mountain, you will have an interpreter for the mal Lisp language that is powerful enough to be self-hosting, meaning it will be able to run a mal interpreter written in mal itself. ~ https://github.com/kanaka/mal/blob/master/process/guide.md https://github.com/kanaka/mal/blob/master/process/guide.md https://github.com/kanaka/mal https://github.com/kanaka/mal
- kazinator 3y agoIf you don't know Lisp, and start writing your own, you're only learning your own concoction, and not any other Lisp. And that concoction has its limits. It doesn't compare to the breadth and scope of the Lisp culture. Interacting only with something you have made is the worst possible way to learn anything about existing, mainstream Lisp. Not knowing anything about the prior art will practically ensure that your own thing is a collection of quirks specific to it, and that then ensures that your Lisp knowledge is entirely rooted in and limited to that thing. You're just not going to single-handedly reinvent things that took numerous hackers over several generations to figure out. You may be "good", but so were they, and there is only one of you. You will not even be able to converse with actual Lisp people, due to not having the right concepts and terms.
- carapace 3y agoAre you criticizing the MAL project or just offering general advice? I feel MAL does a decent job illustrating the core concepts of Lisp, but then I'm not a Lisp expert by any means.
- kazinator 3y agoI'm not sure which, if any, of my remarks apply to MAL specifically. I don't have the impression that the author of the MAL project used it as a way of learning Lisp. To my best understanding, MAL provides a step by step recipe and test cases for implementing a language dialect, plus example implementations for which that has been done. Someone going through the MAL exercise will mainly interact with the chosen implementation language. Writing a new MAL implementation could be used as an exercise to learn some unfamiliar language. I'm not convinced that programmers implementing MAL are actually learning how to use MAL, since it doesn't look as if the exercise requires them to write MAL code to solve problems. To learn MAL, you would take the project as-is with its integrated implementations and use that to get other work done. Suppose someone actually learns MAL by working with it. Are they learning Lisp? I'm not sure how much of their acquired skill will transfer to working with a mainstream Lisp. MAL looks rather like a kind of Mock Lisp (see: https://en.wikipedia.org/wiki/Mocklisp https://en.wikipedia.org/wiki/Mocklisp). It's implemented even in Bash and Awk using string processing. The good thing about MAL is that at least the participants in the exercise are following a specification instead of just making something up as they go along and calling it Lisp. Making something that is compatible with a spec and other implementations is a good exercise for software engineering students, regardless of what it is. MAL would still be valuable that way if it was, say, MAVE: make a vi editor, or MAM: make a Mario game. I have no idea how effective MAL is educationally in teaching the concepts themselves that underpin MAL, which revolves around this question: is it possible to mechanically follow the recipe and get a new implementation working, without understanding the concepts? Separately from the question of whether MAL concepts are Lisp concepts, is the MAL implementor who follows the structured workflow learning the MAL concepts, or are they just massaging code to get some tests to pass. (But, of course, even if they are, so what; nothing stands in their way of learning any concepts they want in any other manner.)
- ookdatnog 3y agoI haven't done any serious lisping outside of tutorials and books, but I warmly recommend the wizard book of myth and legend, SICP (https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book.html https://mitp-content-server.mit.edu/books/content/sectbyfn/b...). I had a lot of fun working through it.
- tmtvl 3y agoRemember to watch the video lectures.
- zem 3y agoI've played around with a number of lisps and racket is the one I find the most enjoyable to use.