Live data from Hacker News

It's 2023, so of course I'm learning Common Lisp

log.schemescape.com

111–120 of 346 posts

Re: It's 2023, so of course I'm learning Common Lisp

#111
post #43

Earlier quoted context omitted.

I am really curious about your experience with Smalltalk and Pharo!

i am really just a beginner with smalltalk and CL. as a vim user i didn't really have a good integration of the CL repl with the editor (there were tools, but they weren't as straightforward to set up as slime would have been). and when i encountered the breakloop i didn't really know what do to and just tried to get out of it as quickly as i could. (exiting vim is easier ;-) the thing that bothered me was that when…

> [Lisp] the thing that bothered me was that when i change code in the repl without an integrated editor, then how do i keep track of the changes and make sure i don't loose them

> [Smalltalk] the code is written to your class, and when you go back to your code browser the change is reflected there

I feel your pain. "writing the changes back to the source code definition" seemed like a no-brainer desirable feature of a Lisp REPL, yet I could not find a way to do that out of the box using Slime. I'm sure one could program it, however! Bet someone has...

Re: It's 2023, so of course I'm learning Common Lisp

#112

Earlier quoted context omitted.

http://xahlee.info/M/lisp_root_of_wolfram_lang.html http://xahlee.info/M/lisp_vs_WolframLang.html > WolframLang has all the characteristics of LISP: seems you either don't know what lisp is or you've never written mathematica

> "seems you either don't know what lisp or you've never written mathematica" Meanwhile, you brought up examples from Mathematica docs that talk about head/tails (car/cdr) but by that logic, Python is a Lisp too because you have: list[0] and list[1:] Maybe your Clojure/Racket experience wasn't enough to teach you what the essence of Lisp was. From your first link: "Mathematica expressions are in many respects like LI…

I'm sorry but are you really going to pretend like car and cdr are not core to lisp?

>list[0] and list[-1]

That is not car and cdr; closer would be list[0] and list[1:] if lists were cons in python.

>Mathematica expressions are in many respects like LISP lists. In Mathematica, however, expressions are the lowest-level objects accessible to the user. LISP allows you to go below lists, and access the binary trees from which they are built

This is a quote from 1986. I wonder if the language has changed much since then

https://reference.wolfram.com/language/tutorial/Expressions....

Re: It's 2023, so of course I'm learning Common Lisp

#113

Earlier quoted context omitted.

Of course people "realise" this. But those REPLs are not actually REPLs. They are interactive language prompts. They aren't actually REPLs. As the joke goes, Python doesn't have a REPL: it lacks READ, EVAL, PRINT and LOOP. Being able to type in code and have it evaluated one line at a time isn't a REPL.

i have no idea what subtle or nuanced distinction you're trying to strike so what exactly do you imagine is the difference between a lisp repl and a python repl? Edit: people that aren't familiar with python (or how interpreters work in general) don't seem to understand that being able to poke and prod the runtime is entirely a function of the runtime, not the language. In cpython you can absolutely do anything you w…

Can you connect to a running server or other running application, inspect live in memory data, change live in memory data, redefine functions and classes and have those changes take immediate effect without restarting the server or app?

I think that is that is the big difference.

It’s a triple edged sword bonded to a double barreled shotgun though, and the very antithesis of the idea of functional programming vs mutable state.

Re: It's 2023, so of course I'm learning Common Lisp

#114
post #99

I see a lot of “coding” talk in the blog and comments from the author here, but few mentions as to what kind of software they’re building or what use cases they’re targeting. My hot take is that the reason functional programming never took off is that, while it certainly is fine for writing programs, most software these days is not “program running locally on my pc/server from the command line until it completes” and…

It took me a while to grok monads, and the IO monad, and longer still to figure out how to compose them in safe ways, and manipulate execution order, etc. But: now I can write typesafe applications, and I produce fewer bugs when I work in non-FP languages (I get paid to write Java.) Lisp is a starting point. Haskell is where it's at. I recommend learning the style, even if you never produce production code in it.

Let’s say I want to do something simple but slightly beyond the scope of a traditional toy demonstration:

* Read some environment variables and a local file

* Start a monitoring thread that consumes from a channel or something similar, then every X s or X events writes to a local temp file and then sends a request batching some metrics to an external system

* Configure and start an http server

* Said server has a handler that 0. Starts a timer 1. loads, then increments an atomic “num requests served until now” variable 2. uses synchronization to lock on a list or ring buffer containing the last 5 requests’ user-agent headers 2.5 copies the current last 5 values, replaces oldest one with the one from the handles request, unlocks 3. generates a json response containing like “num_so_far: x, last5agent: [..], “some_env_var”:..” 3.5 stops the timer 4. write request user agent and time interval to monitoring thread’s channel 5. write response and end handling

* server’s gotta be able to do concurrency > 1 with parallelism

* On sigterm set the server to a state that rejects new requests, waits for existing requests to complete, then flushes the monitoring channel

I’d consider this a trial run of some of the most basic patterns commonly used by networked software: init io, immutable shared state, atomic mutable shared state, synchronization locked shared state, http ingress and egress, serialization, concurrency, parallelizarion, background threads, os signals, nontrivial cleanup. In Go, Java, or C++ I could write this with my eyes closed. How easy is it in Haskell or Lisp?

If you know of any demos or repos that do something like this - not a pure toy or barebones demo, but not a huge task all in all- in either I’d be interested in seeing what it looks like.

Re: It's 2023, so of course I'm learning Common Lisp

#115
post #88
post #47

Earlier quoted context omitted.

examples please, because so far i have only seen this from common lisp and smalltalk. there is also pike where i can reload classes or objects at runtime, thus avoiding a full restart, but it's not as closely integrated as in smalltalk and you actually have to build your app in a way that allows you to do that.

Java supports live debugging and profiling.

But that’s not the same thing at all. If you’re debugging an exception in Java, you cannot continue execution as if the exception had not been thrown at all. With Common Lisp’s condition system you can.

Re: It's 2023, so of course I'm learning Common Lisp

#116

I see a lot of “coding” talk in the blog and comments from the author here, but few mentions as to what kind of software they’re building or what use cases they’re targeting. My hot take is that the reason functional programming never took off is that, while it certainly is fine for writing programs, most software these days is not “program running locally on my pc/server from the command line until it completes” and…

Note that Common Lisp contains CLOS, which is one of the most advanced object-oriented systems even now. Most Lisps are not functional like Haskell is.

Re: It's 2023, so of course I'm learning Common Lisp

#117

Earlier quoted context omitted.

i have no idea what subtle or nuanced distinction you're trying to strike so what exactly do you imagine is the difference between a lisp repl and a python repl? Edit: people that aren't familiar with python (or how interpreters work in general) don't seem to understand that being able to poke and prod the runtime is entirely a function of the runtime, not the language. In cpython you can absolutely do anything you w…

Can you connect to a running server or other running application, inspect live in memory data, change live in memory data, redefine functions and classes and have those changes take immediate effect without restarting the server or app? I think that is that is the big difference. It’s a triple edged sword bonded to a double barreled shotgun though, and the very antithesis of the idea of functional programming vs muta…

>Can you connect to a running server or other running application, inspect live in memory data, change live in memory data, redefine functions and classes and have those changes take immediate effect without restarting the server or app?

The answer to all of these things, at least in python, is emphatically yes. I do this absolutely all the time. You can debug from one process to another if you've loaded the right hooks. You don't need to take my word for it or even try to do it; you just need to reason a fortiori: python can do it because it's an interpreter with a boxed calling convention and managed memory, just like lisp interpreters.

It's amazing: people will die on this hill for some reason but lisp isn't some kind of mysterious system that was and continues to be beyond us mere mortal language/runtime designers. the good ideas in lisp were recognized as good ideas and then incorporated and improved upon.

Re: It's 2023, so of course I'm learning Common Lisp

#118

Earlier quoted context omitted.

> "seems you either don't know what lisp or you've never written mathematica" Meanwhile, you brought up examples from Mathematica docs that talk about head/tails (car/cdr) but by that logic, Python is a Lisp too because you have: list[0] and list[1:] Maybe your Clojure/Racket experience wasn't enough to teach you what the essence of Lisp was. From your first link: "Mathematica expressions are in many respects like LI…

I'm sorry but are you really going to pretend like car and cdr are not core to lisp? >list[0] and list[-1] That is not car and cdr; closer would be list[0] and list[1:] if lists were cons in python. >Mathematica expressions are in many respects like LISP lists. In Mathematica, however, expressions are the lowest-level objects accessible to the user. LISP allows you to go below lists, and access the binary trees from…

Read PG's "Roots of Lisp" and you'll understand what I mean.

Re: It's 2023, so of course I'm learning Common Lisp

#119

I see a lot of “coding” talk in the blog and comments from the author here, but few mentions as to what kind of software they’re building or what use cases they’re targeting. My hot take is that the reason functional programming never took off is that, while it certainly is fine for writing programs, most software these days is not “program running locally on my pc/server from the command line until it completes” and…

> I see a lot of “coding” talk in the blog and comments from the author here, but few mentions as to what kind of software they’re building or what use cases they’re targeting.

Good point! This is all currently just a hobby. For Common Lisp specifically, the only things I've produced are a (mediocre) Battlesnake client and a (now defunct, as of yesterday) multiplayer word scramble game. Neither of these really derives much benefit from being created in Lisp, but I learned a lot along the way (which was really the point).

Unrelated to Common Lisp, I've found myself often needing to write code that generates code. This is an area where I suspect Lisp will shine, although I haven't had a chance to give it a try yet. Two examples from recent projects (which I tackled before ever thinking about using Common Lisp) are:

* Generating code to validate a particular JSON Schema (used in a static site generator)

* Generating JSX from Markdown (used for story content in a programming game)

To say nothing of the innumerable C macros I've written in my lifetime :)

Re: It's 2023, so of course I'm learning Common Lisp

#120

Earlier quoted context omitted.

I'm sorry but are you really going to pretend like car and cdr are not core to lisp? >list[0] and list[-1] That is not car and cdr; closer would be list[0] and list[1:] if lists were cons in python. >Mathematica expressions are in many respects like LISP lists. In Mathematica, however, expressions are the lowest-level objects accessible to the user. LISP allows you to go below lists, and access the binary trees from…

Read PG's "Roots of Lisp" and you'll understand what I mean.

I believe that is an argument from authority (if I remember correctly).
Post reply on HN