Live data from Hacker News

Why Lisp?

nyxt.atlas.engineer

51–60 of 339 posts

Re: Why Lisp?

#51
Appreciating what Lisp is capable of doing (think macros), and having worked through SICP some twenty years ago, and after having tried to make a deep dive in CL and Emacs Lisp two years ago, I come to the conclusion that there is no silver bullet in Lisp-land. Python is a good enough Lisp, as Peter Norvig has concluded. And it’s got all batteries included. Ain‘t nothing it can’t do. Building websites, doing maths, automating, except building compilers and OSes. But Lisp won’t compete in that field anyway.

Programming languages are there to express ideas and solve problems. I can think of more elegant ways to express ideas (functional languages for instance), but Python is an excellent ecosystem for solving problems.

Re: Why Lisp?

#52
This thread may be as good as any to ask: the code I write has to deal with a huge amount of state. To summarize, my code receives millions of "change commands", which update state in memory. Data structures are hash tables, lists, etc. And some commands, once in a while, are queries like "how many of these are there now, of what does this element now point to?".

I guess I'm describing some kind of custom in-memory database engine.

Anyway, I'm confused as to how the purity of Lisp functions would or would not prevent me from writing this code? Is this a use case that is bad for Lisp, or am missing something?

Re: Why Lisp?

#53
post #21

The article seems like mostly about Common Lisp, but how many of the points are applicable to rest of Lisps? (Scheme, Emacs Lisp, Janet, etc)

Janet is not a Lisp, it uses parentheses though.

Re: Why Lisp?

#54
post #39

i cant even install this program on my system because of common lisp’s insane dependency management so count me as unconvinced

> this program What program are you talking about? The article is about Common Lisp, but perhaps you are talking about the Portacle setup mentioned in the article? Or is this just a general snipe at CL? Is it a problem to use QuickLisp [1]? Or are you talking about deeper problems. I think you could have something useful to say here, but I don't think that post conveys it. [1] https://www.quicklisp.org/beta/

The company make a browser, Nyxt. I assume OP is talking about that. Works OK on every system I use, but who knows

Re: Why Lisp?

#55
post #50

After learning Python, I wanted to take the next step and find what was better. I looked into a lot of languages reading books on Haskell and Lisp and many others. At least for my use cases (desktop scripting, numerical work... etc) I didn't find Lisp to be superior. Most of what I actually needed to do could be done simpler in Python. Python's REPL isn't near as good as CL, but it's good enough. Then the batteries i…

As a Lisp fan who sometimes codes in Scheme and Common Lisp whenever I get the chance, I agree with you. The gap has certainly narrowed in the past 20 or so years between Lisp and widely-used programming languages. In addition, the rise of statically-typed functional programming languages like OCaml and Haskell provide another alternative for those who love functional programming but want Hindley-Milner types. I stil…

If you have any interest in submitting a talk for a polyglot conference in South Carolina this August, you're talking about several languages that haven't yet been represented in the submissions.

I don't think Lisp, Scheme, OCaml or Haskell talks have been submitted yet actually.

https://blog.carolina.codes/p/call-for-speakers-is-now-open-...

If you decide to submit a talk, the deadline is May 25th.

Re: Why Lisp?

#56

This thread may be as good as any to ask: the code I write has to deal with a huge amount of state. To summarize, my code receives millions of "change commands", which update state in memory. Data structures are hash tables, lists, etc. And some commands, once in a while, are queries like "how many of these are there now, of what does this element now point to?". I guess I'm describing some kind of custom in-memory d…

Lisp is not pure, in general. cons is "functional" because lists, if treated immutably, are functional. There's still setq (set! in Scheme), though, and operations on hash tables, arrays, and sets are typically mutating.

Re: Why Lisp?

#57

This thread may be as good as any to ask: the code I write has to deal with a huge amount of state. To summarize, my code receives millions of "change commands", which update state in memory. Data structures are hash tables, lists, etc. And some commands, once in a while, are queries like "how many of these are there now, of what does this element now point to?". I guess I'm describing some kind of custom in-memory d…

so Lisp is actually not a pure language, like, at all. Emacs is often written about as a big hairy ball of state and Lisp itself can be as imperative or statefule as you want. So while I don't know much about what you're designing, Lisp wouldn't be necessarily a bad choice.

Re: Why Lisp?

#58

This thread may be as good as any to ask: the code I write has to deal with a huge amount of state. To summarize, my code receives millions of "change commands", which update state in memory. Data structures are hash tables, lists, etc. And some commands, once in a while, are queries like "how many of these are there now, of what does this element now point to?". I guess I'm describing some kind of custom in-memory d…

Lisp functions are generally not pure! Common lisp, the language this article is mostly talking about, is very comfortable with state. CL, like most lisps, often encourages a functional style- everything is an expression, and usually you'll return data structures even if you mutate them. But big hash tables and arrays are definately in common lisp's wheelhouse. Even Clojure, which is largely pure when dealing only with itself, has full support for diving into the messy practicalities of mutation on the JVM.

Re: Why Lisp?

#59
post #50

After learning Python, I wanted to take the next step and find what was better. I looked into a lot of languages reading books on Haskell and Lisp and many others. At least for my use cases (desktop scripting, numerical work... etc) I didn't find Lisp to be superior. Most of what I actually needed to do could be done simpler in Python. Python's REPL isn't near as good as CL, but it's good enough. Then the batteries i…

As a Lisp fan who sometimes codes in Scheme and Common Lisp whenever I get the chance, I agree with you. The gap has certainly narrowed in the past 20 or so years between Lisp and widely-used programming languages. In addition, the rise of statically-typed functional programming languages like OCaml and Haskell provide another alternative for those who love functional programming but want Hindley-Milner types. I stil…

I feel exactly the same. I wish I did something cool enough to require the full power of lisp, but generally speaking...I just need to glue some stuff together. Other people will have different needs though. I can still appreciate the beauty of lisp and I'm glad its out there in case I ever need it!

Re: Why Lisp?

#60

This thread may be as good as any to ask: the code I write has to deal with a huge amount of state. To summarize, my code receives millions of "change commands", which update state in memory. Data structures are hash tables, lists, etc. And some commands, once in a while, are queries like "how many of these are there now, of what does this element now point to?". I guess I'm describing some kind of custom in-memory d…

As far as FP langugages go, LISP is very much a free-for-all. It can be pure if you want it to be, or stateful and imperative if you prefer. Nothing is really enforced like for example in Haskell.

For your use-case a mutable reference behind some type of synchronized accessor would probably suffice. If you want to get fancy you could design the system in such a way that any point in time could be replayed or rewound to, since you have the commands and the initial state.

Some ideas to look into:

[1] https://github.com/acid-state/acid-state

[2] https://docs.datomic.com/pro/getting-started/brief-overview....

[3] https://www.martinfowler.com/bliki/CQRS.html

Post reply on HN