18 ms·
An Intuition for Lisp Syntax
- nynx 6y agoI've never really bothered to learn lisp, but this is incredible. I get it now. That being said, I wonder how data types would work as opposed to lists. What would a language based around maps look like?
- garmaine 6y agoIt would look like smalltalk: [sendMessage with:arg1 to:arg2]
- User23 6y agoCommon Lisp has keyword args too.
- garmaine 6y agoTo be clear this is something I’ve thought a bit about. I think the interesting analog is not maps per se, but relational tuples. Instead of “everything is a list”, it would be “everything is a tuple”, and the environment is a table. Evaluate a tuple to execute, evaluate a table to execute in parallel.
- User23 6y agoObjectively speaking table oriented programming is a very interesting topic. Sadly the incredibly effective anti-evangelist calling himself topmind over at the c2 wiki convinced me to completely ignore it for over a decade. The relational calculus is an incredibly powerful formalism though, and it's definitely one that has an important place in serious software development.
- javajosh 6y agoFirst of all, a map can be defined as a list where the even elts are labels and the odd ones are values. So it would be a lot like lisp but every elt in every list would have an extra before it, a short string name.
- brabel 6y agoIt's the other way around, actually. If you define a map as a list, it will have none of the properties of a map: you can't lookup a key in constant time. But if you start with maps, then you can represent a list as a special case of a map in which the keys are integers that get incremented, starting at 0.
- Reelin 6y agoGP isn't talking about the runtime implementation but rather the serialization format. You can serialize a map as a list. Therefore, a hypothetical Lisp-like language based around maps could simply end up consisting of lists that contain key value pairs.
- andyferris 6y agoIndeed - I have also wondered what a “struct processor” rather than “list processor” would look like. I keep thinking code blocks and the struct/map definition could possibly both use `{ ... }`, which might appear a bit like some other languages? What about function calling and definitions? The S-Expr thing seems to indicate you’d still need a “head” then a list of key-value pairs?
- andreareina 6y agoClojure has first-class support for map literals.
- deleted 6y ago[deleted]
- thibran 6y agoHave a look at Clojure Spec. The other one, which I don't like much, is PHP. For me it's strange that nobody seems to talk about the power of PHP map-like data structure and it's upsides because it is the main data structure.
- brabel 6y agoIt would look like Lua: https://www.lua.org https://www.lua.org They call "maps" tables. Even arrays in Lua are tables, as are everything else. Pretty cool concept... And there's even a low level, statically typed, system language that uses Lua as a composer language, Terra: http://terralang.org http://terralang.org In Terra, you manipulate your program using Lua at compile time. Really cool concept.
- zeveb 6y agoA large difference is that Lua source is not in the form of Lua tables — and that makes all the difference! Having full access to your complete language at read, compile and run times is what makes Lisp Lisp, and that can only sanely be done with a homoiconic language.
- sparkie 6y agoTake a look at Connection Machine Lisp (http://diyhpl.us/~bryan/papers2/paperbot/25aa007a093cd69bbf070e6db9603c3a.pdf http://diyhpl.us/~bryan/papers2/paperbot/25aa007a093cd69bbf0...)
- sahil-kang 6y agoIf you found this interesting and want more, then I think this is a good follow up to read next [1]. It takes a similar approach to introducing the code-as-data idea, but uses xml instead of json as an introductory structure. [1] http://www.defmacro.org/ramblings/lisp.html http://www.defmacro.org/ramblings/lisp.html
- luminati 6y agoAgree - Slava’s article has gotten a lot of action on hn over the years. (https://hn.algolia.com/?q=http%3A%2F%2Fwww.defmacro.org%2Framblings%2Flisp.html https://hn.algolia.com/?q=http%3A%2F%2Fwww.defmacro.org%2Fra... 0)
- stopachka 6y agoAuthor here: Am a fan of Slava, and loved his essay on Lisp. Highly recommend!
- tekacs 6y agoThis is wonderfully written, thank you! I'll be sending this to friends who still haven't quite gotten their heads around 'why sexps'. :)
- stopachka 6y agoThank you for the kind words! :)
- userbinator 6y agoThe Lisp still looks like Lisp, but the JavaScript barely resembles what JS looked like the last time I used it heavily (~10-15 years ago.)
- EE84M3i 6y agoIMO, by far the most confusing thing about lisp syntax is not code data duality, but instead that when you actually dive into the specs for these languages, its actually still really complicated and full of edge cases. A "toy" lisp can be simple sure, but "real" lisps aren't.
- ChrisSD 6y agoThe formal Scheme syntax spec is, what?, a few pages. Far smaller than any other "real" language I'm aware.
- garmaine 6y agoReal schemes are much more complicated. I think he’s talking about Common Lisp though.
- EE84M3i 6y agoI'm not too familiar with scheme, but syntax seems to be at least a few dozen pages here? www.r6rs.org/final/r6rs.pdf Also compare https://people.csail.mit.edu/jaffer/r5rs_9.html https://people.csail.mit.edu/jaffer/r5rs_9.html and e.g. https://docs.python.org/3/reference/grammar.html https://docs.python.org/3/reference/grammar.html which I would consider a relatively syntactically rich language.
- shakna 6y agoR6RS was the largest Scheme spec ever, and because of it the next one was actually reduced into two: R7RS-small (core-language) and R7RS-big (extended). The R7RS-small standard [0] has already been ratified. It is a similar size to R6RS as a document size, but the semantics are about 8 pages, and include a bunch of macros that you don't need to implement, but just copy and paste into your implementation. I'd say it's a similar sized grammar to Python's. [0] https://small.r7rs.org/attachment/r7rs.pdf https://small.r7rs.org/attachment/r7rs.pdf
- donio 6y agoWhat I see is that the Scheme one is a lot more thorough and still shorter.
- praptak 6y agoA simpler intuition. Opening parenthesis moves to the left, whitespace acts as colon. So, f(a, b, c) becomes (f a b c).
- reikonomusha 6y agoThis isn’t the right intuition for the syntax, this is the right intuition for evaluation. Why move that bracket? The answer is simple: we want the syntax to also denote a serialized data structure: a tree of atomic elements. So (f a b c) represents a list of symbols F, A, B, C, and the interpretation of this list is a call of the function F on arguments A, B, C.
- Reelin 6y agoFor someone who hasn't used sexprs or looked at an AST before, it might not be clear why a data structure and atomic elements are goals in the first place. I tried to write an explanation but found it surprisingly difficult to articulate. In short, there's almost certainly other ways to accomplish the same thing but sexprs are dead simple and they work _really_ well in practice. Just go use them and it will make sense!
- username90 6y agoSexpr makes expressions easier for computers to parse. That is all there is to it. Other languages focuses more on making code easier for humans to parse. Both are good for different things.
- chriswarbo 6y agoLisp and s-expressions are two different things. In particular, there are various alternative syntaces for Lisp, which we can automatically convert between (e.g. via a pre-processor, or a reader macro), e.g https://readable.sourceforge.io https://readable.sourceforge.io https://www.dwheeler.com/readable/sweet-expressions.html https://www.dwheeler.com/readable/sweet-expressions.html https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-49/srfi-49.html https://srfi.schemers.org/srfi-119/srfi-119.html https://srfi.schemers.org/srfi-119/srfi-119.html
- trevyn 6y agoSo what does Lisp make harder to implement than today's programming languages? It seems like large-scale composition relies on a well-structured way to define and enforce APIs, and oh wow, typing facilities. Performance has historically been an issue for Lisp because its model is tightly tied to interpretation, but perhaps modern JIT-style compilation can address this. Others? What type of issues do large Lisp projects typically run into?
- Jtsummers 6y agoCommon Lisp has long been a compiled language. Its performance is quite competitive when set against Fortran and C. The idea that it's interpreted (and consequently slow) is a very old myth. Of course, it helps to use the right data structures if you want fast Lisp code (using lists for everything is not the right choice).
- username90 6y ago> Its performance is quite competitive when set against Fortran and C. No, not at all. It is the same level as Java, a bit slower but I guess that is because there is more work done on Java. Just because you compile a language doesn't mean it is as fast as other compiled languages. You can compile python down to a binary but it will still be super slow.
- minerjoe 6y agoWhere do you get your information? SBCL has been shown to be, when optimized, within the same order of magnitude as C. https://news.ycombinator.com/item?id=2192629 https://news.ycombinator.com/item?id=2192629
- TheRealKing 6y agoIf you read the discussions to end, you will notice many objections to the benchmark that you have posted here. Even I have objections. -O3 is not the end of all possible optimizations in C and Fortran.
- zaro 6y agoI get the code is data thing, but I don't really find it that much useful. And there is a good reason most languages don't allow it - other people :) The unless example is a good one. So while you can trivially implement 'unless' in lisp, most probably in a large code base, you'll en up with 'unless', 'if-not' and depending on how creative others are probably also 'negat-if'.
- Fishysoup 6y agoFrom what I understand, this relates closely to the "Lisp Curse"
- deleted 6y ago[deleted]
- Jtsummers 6y agoYou have the same problem in any language when you start scaling up to larger team sizes (or multiple teams). If they don't bother reading the docs or existing libraries, they're likely to reinvent the wheel over and over. The solution is, unfortunately, more social than technical. You have to be deliberate in selecting what goes into the common libraries, and be deliberate in code reviews to make sure junk like that doesn't get created and widely used when an existing solution already exists.
- Reelin 6y agoAgreeing, I'd point out that C++ templates are Turing complete (and now they've added constinit and friends). That can certainly result in bad code, but it also enables very good code as well (ex the Eigen library). Python objects can be monkey patched at runtime - a powerful ability, but trivial to misuse. Certainly the design of a language should facilitate and even actively encourage writing good code. Attempting to solve systemic organizational or educational issues with it is probably counterproductive though.
- cloogshicer 6y ago
- jFriedensreich 6y agoThis is maybe the best introductions to Lisp i have seen, especially for a js dev like me it could hardly get more approachable and convincing. I could not help but thinking at the end, this is really awesome but s-expressions are kind of hard to read and reason about for my brain, it would be cool if we could generate them from more readable syntax, maybe something like javascript :D . Unfortunately the standard js AST seems to be not a great fit but i found a S-Expression encoder for js AST https://github.com/anko/eslisp https://github.com/anko/eslisp This way instead of having to write s-expressions manually we took a whole circle and are back at js but with macros, not relying on eval and having a code is data representation...
- TeMPOraL 6y ago> This is maybe the best introductions to Lisp i have seen, especially for a js dev like me it could hardly get more approachable and convincing. The classical one is "The Nature of Lisp"[0], which introduces data-as-code through XML and Java build tools. Same idea, just with examples more relevant at the time of writing. Still worth a read for non-webdev programmers. Having learned Lisp, it's half funny, half disheartening to watch the industry repeatedly tries to rediscover "code as data", as people's configuration or data files in markup language du jour grow in complexity and eventually start directly encoding executable code... and then stop shy of embracing the code/data duality. -- [0] - https://www.defmacro.org/ramblings/lisp.html https://www.defmacro.org/ramblings/lisp.html
- maximilianroos 6y agoGreenspun's tenth rule [0]: "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp." Also: > Hacker Robert Morris later declared a corollary, which clarifies the set of "sufficiently complicated" programs to which the rule applies "...including Common Lisp." [0] - https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule
- drran 6y ago
- frutiger 6y agoThere’s an error/typo in the “Even more power” section. The definition of the “def” function should mutate “variables” not “defs”.
- stopachka 6y agoThanks for the catch! Will update
- nathell 6y agoAnother attempt: http://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-syntax/ http://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-s...
- tutfbhuf 6y agoSince parenthesis are just an arbritary sign, it's possible to replace it with something different that fulfills the same role in Lisp. An example for Lisp without parenthesis: https://dustycloud.org/blog/wisp-lisp-alternative/ https://dustycloud.org/blog/wisp-lisp-alternative/
- sriku 6y ago(shameless plug) In Feb 2020, during the first Clojure meetup organized in Chennai, I gave a talk titled "I'm LisP, I'm inevitable" in which I spoke about the journey towards lisp/scheme in muvee's flagship automatic video editing product. http://sriku.org/posts/inevitable-lisp/ http://sriku.org/posts/inevitable-lisp/ It may be helpful to some to understand the recurrent pattern here so they can detect it early when it happens to them.
- nojvek 6y agoWatched the talk. The Muvee/MuSE journey must have been fun.
- sriku 6y agoIt was indeed. It was also nerve-racking in many ways. We were trying to do GPU-based automatic video editing at a time when the Microsoft OSes were evolving rapidly, so were the NVidia and other drivers, and OpenGL itself .. with varied support for "optional" features .. not to mention that machines+OSes weren't yet 64-bit by default. The testing team had a great setup to cover a lot of ground, but there'll usually be something stumping us. It was also a time when people were moving to slower and smaller machines - like mini notebooks - where they'd expect to run muvee on the Intel integrated graphics chip at full screen res. It was also a time when video was graduating to HD and codecs weren't fast enough and 320x240@15fps wouldn't satisfy people any more. We needed 720x480@30fps at least for the previews and taking the GPU route was a no brainer due to that. It was a case where we'd raised people's expectations so high (what'd take an editor perhaps a week to do happens in about 5 seconds with muvee) that unreasonable performance expectations became the norm :) You can, in seconds, try variations that would cause an editor to pull her hair. To top this all, the "constructor" which is the heart of the product had to be tested against many variations in media and styles. The details of that journey is probably worth another talk on its own. muvee released muSE as open source btw and you can find it here - https://github.com/srikumarks/muse https://github.com/srikumarks/muse . .. and it is (I believe) still usable in the "Reveal Encore" product. edit: ... and along the way, muvee also built the first mobile automatic video editor which shipped on the ROM of early Nokia camera phones such as the 6630 (https://mobile-review.com/review/nokia-6630-camera-en.shtml https://mobile-review.com/review/nokia-6630-camera-en.shtml .. scroll down to the "Movie Director" section)
- modernerd 6y agoIs structural editing a genuine advantage over line-based editing? The author presents it as such, but their structural editing example shows that it takes three operations to negate a condition (create array, write “not”, slurp forwards). That would be one operation in most line-based languages (write “!”), and it also introduces less line noise.
- vrnvu 6y agoIn a simple example like the author provided maybe is not that obvious but try to imagine an example with a more complex nested syntax and maybe some threading or function composition in it. If you have to modify the behaviour of a specific block of code you only need to edit that structure and your block won't get messy neither requiere special syntax. As you say, If your "!" transaltes to an expression in your language and you are already writting pure functions that compose niceley then I agree that the benefit would be at a syntax level only, the homogeneity of treating all code (macros or runtime) equally.
- zozbot234 6y ago> Is structural editing a genuine advantage over line-based editing? A full-featured editor should support both. Line editing is convenient for some editing operations/workflows where you don't necessarily have a well-formed AST at all times. But for many other workflows, structural editing is preferable.
- chriswarbo 6y agoStructural editing can be used in many languages, not just Lispy ones (although it's most powerful in Lispy languages). I use Emacs to write Haskell, Scala, Python, Bash, etc. and use at least some structural editing operations all the time, e.g. ctrl-right turns '(a, b), c' into '(a, b, c)' and ctrl-left goes the other way.
- roenxi 6y agoThe article and the heading seem to diverge a bit. "An Intuition for Lisp Syntax" is much simpler than all the pages: in lisp, the syntax for control structures like a loop is the same as the syntax for everything else. The reason for that is because introducing special syntax disrupts useful patterns that could be used for writing completely new control structures. Threading macros, for example, are pretty much impossible to do properly in Python because of syntax irregularities.
- kreetx 6y agoAlso, haskell has "only" expressions and no statements.
- chriswarbo 6y agoHaskell also has definitions, which can't be used as expressions directly, e.g. we can write: foo = bar But we can't write: baz = 2 + (foo = bar) I this case we can get the expected return value by using 'let... in...' syntax, but we wouldn't get the top-level definition, e.g. baz = 2 + (let foo = bar in foo) Likewise for type definitions, class definitions, etc. One language which handles definitions nicely as expressions is Nix. Nix has 'let' but I never use it. Instead we can use 'with': with { foo = bar; }; "hello " + foo The thing in braces isn't a block of statements; it's a key/value dictionary (Nix calls them 'attribute sets' or 'attrsets'). The 'with...; ...' syntax acts like 'let... in...' but both pieces are expressions. with { myAttrs = { foo = bar; }; }; with myAttrs; "hello " + foo Interestingly, whilst Lisp distinguishes between 'letrec' and 'let' (bindings with and without mutual/self-reference, respectively), Nix distinguishes between 'rec {...}' and '{...}' (attrsets with and without mutual/self-reference). In other words, when we write 'with rec {...}' the 'rec' modifier affects the definition of the attrset (the '{...}'), it doesn't affect the binding of that attrset into the environment (the 'with'). For example: with { bar = 42; // To prevent nonRecursive complaining about a missing variable recursive = rec { foo = bar + 1; // The number 6, since 'bar' is taken from this bar = 5; // The order of definitions doesn't matter }; // The attrset { foo = 6; bar = 5; } nonRecursive = { foo = bar + 1; // The number 43 bar = 5; }; // The attrset { foo = 43; bar = 5; } }; // [] is syntax for a list [ (with recursive; foo) // The number 6 (with nonRecursive; foo) // The number 43 ] // The list [6 43] Of course, attrsets (recursive or not) can be used as expressions: (rec { foo = bar + 1; bar = 5; }).foo // The number 6
- blackbear_ 6y agoCan anybody recommend resources for the "next level"? I get that "code is data", the "unless" example is nice, but what I don't get is: why would I want to do that? As a non-LISP developer I get by without macros and all the fancy things that are possible with LISP. I would like to see a strong case of daily tasks that are much easier with LISP macros. Anybody?
- CraigJPerry 6y agoIf you buy into the argument that less code, that writing code at a higher level of abstraction results in less time to market, less maintenance overhead, more responsiveness to change in future, less bugs etc. Etc. If you believe a 1000 line program is worse than a readable 100 line program that both do the same thing, then lisp with its macros is that thing. Super expressive and readable. I went from not being able to read clojure to now having written a few apps in it and feeling comfortable with the syntax in a few weeks. I definitely write less code to achieve the same ends but it’s still early days for my lisp adventure.
- mythz 6y agoThe argument isn't whether less, readable, higher-abstraction code is better than its opposite, it is. It's whether or not a real-world LISP code-base espouses these qualities. Which I don't believe it does, IMO the primary reason LISP isn't mainstream is because it results in less readable code for humans (i.e. the primary objective of programming languages), it's semantically the perfect minimalist language for a machine but I don't believe it's optimal readability for humans. Other disadvantages include lack of typing & poor tooling support. There's certainly domains it excels at due to its intrinsic qualities but I don't see it ever becoming a popular mainstream general purpose programming language.
- capableweb 6y agoWhat is or isn't readable can be judged by two qualities. The first one is if it's being familiar to what you're used to and the second one how long it takes to learn if you're not familiar with it. Now I learned C-like language before I learned Lisp-like languages, so that might be the reason I felt I understood Lisp way faster than I felt I understand C-like languages. There is simply less to learn about the language and more to learn about conventions, while C-like languages always have bunch of extra syntax you have to learn, otherwise the compiler cries. > Other disadvantages include lack of typing & poor tooling support Not sure these are inherent to Lisps. There are plenty of typed lisps, and even the ones that don't have types, can have types added to them after the fact, just because they are Lisps. Regarding tooling, I'd say that the entire C-like ecosystem is far behind any Lisp language regarding tooling. I mainly see people using "println"'s for debugging, and sometimes using a "line debugger", while Lisp developers modify their code at runtime and have a far more advanced debugger, something C-like languages will probably never do as well as Lisp-like languages does it, again because of s-expressions and the code they make you write.
- wwosik 6y agoI don't think I like it. I find it hard to quickly skim and find out what each of the elements is, since it can be anything. The example amounts to: function drawTriangle(left, top, right, color) { drawLine(left, top, color); drawLine(left, right, color); drawLine(top, right, color); } drawTriangle({ x: 0, y: 0 }, { x: 3, y: 3 }, { x: 6, y: 0 }, "blue" ); drawTriangle({ x: 6, y: 6 }, { x: 10, y: 10 }, { x: 6, y: 16 }, "purple"); Maybe it's a case of getting used to it, but with my version I can very quickly ignore parts of code, which are not relevant to the thing I'm looking for.
- culturedsystems 6y agoIndeed, I think this post ends up being a good argument against Lisp. The supposed negative for JS, as opposed to Lisp, is that "We’d need something like Babel to parse our file, and work on top of the AST to make sure we rewrite our code safely." And? Computers are good at parsing, and adding syntax to a language should be comparatively rare, so why would I choose a language that optimizes for this case, rather than one which optimizes for human readability? I think some people will argue that macros shouldn't be rare, that you should define a custom DSL for each application so you can work at a higher level of abstraction. However, macros themselves operate at a fairly low level of abstraction (operating on the AST, rather than closer to the problem domain). I would argue that if you find yourself using macros frequently, that's a sign your language is lacking in higher-level abstraction capabilities.
- Joker_vD 6y ago> Computers are good at parsing, And humans are even better at it, and actually seem to cope with typographically diverse syntax better than the uniform ones. So it absolutely makes sense to have a nice, heterogeneous, human-friendly syntax. As for writing custom DSLs... I always feel vaguely uneasy when I find myself writing, essentially, an interpreter/VM for a simplistic programming language in a form of a set of library routines/components that I then process to use to build my application logic out of. After all, I am already writing code in a rich programming language, why don't I just use it for my application logic in the first place?
- agumonkey 6y agohey, just on mccarthy's paper 60th birthyear. finally :D
- wodenokoto 6y ago> What if we let our remote user define their own functions? Aren't we then back at the problem with using eval?
- ywei3410 6y agoNo, because you control the base primitive functions by passing in fns. In more formal terms, you can control the context. If we really cared, it would be trivial to extend this to a typed variant or change the evaluation semantics. Here's an example in another language [1]. [1] https://www.youtube.com/watch?v=YxhBxHl76vc https://www.youtube.com/watch?v=YxhBxHl76vc
- dualscyther 6y agoI couldn't figure out how to email the author and I don't have twitter, but I found a few mistakes in the "More power" section that tripped me up a bit as I followed along, so just posting here in case it helps anyone else: The end of the second last code block should be: `data.instructions.forEach(...args.map(parseInstruction));` And the full definition of `data.instructions` that demonstrates the use of this modification would be something like: `[["rotate", ["rotate", ["drawLine", { x: 0, y: 0 }, { x: 1, y: 1 }], 90], 45]]`
- stopachka 6y agoWill look this over and update, thanks!
- masukomi 6y agoa) great article b) "It can help you move with the speed of a sculptor"... This person has obviously never watched a sculptor. They are so slow compared to basically every other form of artistic visual representation.
- stopachka 6y agoI thought this in the back head when I wrote it xD. “hmm...it can’t be too easy changing marble around”. If you have a better metaphor lmk will change :}
- fishmaster 6y agoPottery might be better.
- stopachka 6y agoupdated! (should show up in a few mins)
- vindarel 6y agoIt's not enough to only talk about syntax when we introduce Lisp. The other less known Lisp feature (in the sense of Common Lisp), is the image-based development, which makes for a great REPL. Really interactive, tiny feedback loops, where you compile your program one function at a time. You never wait for a process to restart, even working on a web, GUI or game project. You keep your test objects around. You restart to a clean state when you want. You get compilation and type warnings immediately. You have an interactive debugger that points you to the erroneous line, you fix it, you tell the debugger to try again from the previous stackframe, and you see the function complete. Explore! https://github.com/CodyReichert/awesome-cl https://github.com/CodyReichert/awesome-cl
- minerjoe 6y agoMy word. Please people, if you haven't programmed a decent sized program in Lisp using an editor tuned to the task, please don't spout off like you know what you're talking about. Just do the work first, it's worth it, just for the understanding.
- redwoolf 6y agoThe problem I'm having with Lisp isn't the syntax or the language, but the ecosystem. Or rather learning about the ecosystem. There's not much information, from what I've found, about best practices for creating a production ready application. A lot of Lisp tutorials and books extoll the virtues of the language and REPL based development but stop there. For example, I want to figure out how to use Lisp in a CI/CD environment to deploy binaries. Or learn the best practices for creating a project with multiple modules with dependencies. Edit: Is this being downvoted because I'm hijacking the thread?
- slgeorge 6y ago> There's not much information, from what I've found, about best practises for creating a production ready application I have an interest in functional (Lisp) and decided that for me Clojure was a good choice. It was designed to be used in industry so there's people out there who are using it for real applications. Although I wasn't a fan of the JVM I've learnt my bias was wrong and it's given me access to an ecosystem of libraries. As I'm more informed now I think that learning Racket, F# or one of the others would also have been fine. But, I don't regret Clojure. They're all small(ish) communities so you have to be willing to invest in the community, be willing to put together solutions from bits of information and enjoy experimenting. Whether that's the best use of your time is up to you ;-)
- shaunxcode 6y agoThis is very similar to how I "came to lisp". I was attempting to come up with a more uniform smalltalk/ruby syntax and slowly talked my way into s-expressions. I had tried emacs lisp and scheme so I was aware OF the syntax but the pedagogical experience of WHY the syntax was a lot more profound. After that reading ANSI common lisp, let over lambda, etc. cemented my love for macros and I've never looked back. Actually given that I settled on clojure which still lacks the self-hosted qualities of common lisp I DO look back but only at common lisp.
- PopsiclePete 6y agoTo me the problem with LISP's was never the syntax, I understand s-expressions and homoiconicity and all that, the problem was also....this is embarrassing...the dev setup/environment. In every single non-LISP language/environment - whether it be C, C++, Rust, Go, C#, Java - I can sit down comfortably in VIM or Vscode+VIM and just start hacking away. With LISPs, I always feel like I'm fighting my editor - and I am. I know about Emacs+SLIME, I know about paredit, I've seen it in action and it's impressive, I just can't force myself to expand the energy to dive into the Emacs eco-system. And yes I've tried vim fireplace and Cursive and VSCode's latest ...whatever.....but they all just feel "wrong" in a way, like a square peg in a round hole. I feel if I could just spend enough time to really understand Emacs and all of it's LISP-yness goodness, I'd enjoy LISPs a lot more and use them more in daily work
- lispm 6y agoYou could use Lisp in a batch style. I would then propose to use a compiler-based implementation like SBCL, since the compiler gives a lot of feedback. That can help in batch programming -> write code, compile it, run it -> with the added error messages from the compiler or the runtime. Some people program Lisp with very primitive editors, but they better use the Read Eval Print Loop for interactive programming, too. That would be different from the usual C, C++, ... Java programming. You would need to understand interactive programming. That's a level one needs to master - especially in many situations (and where one does not use SBCL) the dynamic typing of much of Lisp requires interactive exploration/debugging.
- nojvek 6y agoOne of my algorithmic interview questions is to evaluate mathematical expressions in array of array json (like S expressions). Then add variables and conditions. If time persists, add function declarations. I love the idea of data is code is data.
- stevefan1999 6y agoI dunno if it is appropriate to post a lisp joke here but anyway --- In the 1960's the KGB was very interested in learning everything possible about the American space program, sending all sorts of spies to find every possible piece of information. One afternoon, a breathless spy returned to headquarters with a page of paper in his hand, excitedly shouting to his superior, "Comrade! Comrade! The Americans are using Lisp to write their rocket launching software!" The commander was skeptical. "How do you know?" "I broke into their research lab and stole a page from the teletype machine! It's not the whole program, but it's the final page and contains the concluding logic of the program! See for yourself!!!!" The commander looked at the page and smiled: )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))) ))))))))))))))))))))))))))) ))))))))))))))))))))))))) )))))))))))))))))))))) )))))))))))))))))))) )))))))))))))))) ))))))))))))))) ))))))))))) )))) ))) )) )) ) --- Jokes aside, I think s-exp is actually a very good way to describe a tree because each nested parenthesis is a nested level in a tree with respect to some, e.g. (a (b (c d)) (e f)) means (b (c d)) and (e f) being a node in a and (c d) in b -> d in c -> f in e