Live data from Hacker News

I’ve Consed Every Pair

medium.com

71–80 of 228 posts

Re: I’ve Consed Every Pair

#71

Earlier quoted context omitted.

You haven't been around long enough, at least under the same name, to remember when there was an implicit time limit on the comment reply page, inflicted by those stored closures silently timing out. Having long comments so often eaten that way was actually the specific thing that annoyed me into first installing It's All Text. It's an interesting approach, as attempts to force statefulness on a stateless-by-design p…

I think Seaside had the same issues with scaling.

And I believe similar closures for keeping state?

Re: I’ve Consed Every Pair

#73

Earlier quoted context omitted.

It's a little sad that it's declined so far. In a way, it's a victim of its own success--it's so easy to write a lisp system that literally dozens, if not hundreds, of variants sprang up. The community was divided, and it never quite came through. IIRC, our fearless leader PG made his zillions using Lisp.

> it never quite came through. Hard disagree. The Clojure ecosystem is great.

It's obscure enough that it perhaps proves my point. Nonetheless, I'll have to look at it.

Re: I’ve Consed Every Pair

#74
post #48
post #42

Earlier quoted context omitted.

As a non-testimonial litigation consultant, I used to joke that I could pose as an expert in anything, given a couple months. But in truth, one of my favorite deposition answers goes something like this: > I'm not prepared to offer an opinion on that question.

My joking aside, the tragedy is only the truely expert are willing to make this answer.

Right.

But actually, "prepared" is often literally the case.

Before critical depositions, experts spend a day or two, with attorneys and consultants, practicing replies. And experts are very cautious about answering unexpected questions.

Re: I’ve Consed Every Pair

#75

I'll admit I don't think I've really noticed the presence of lisp online other than when people want to talk about lisp. Can someone share some practical examples of where lisp is being used? Maybe a popular open source project I never realised was written in a lisp family language?

It's a little sad that it's declined so far. In a way, it's a victim of its own success--it's so easy to write a lisp system that literally dozens, if not hundreds, of variants sprang up. The community was divided, and it never quite came through. IIRC, our fearless leader PG made his zillions using Lisp.

The division was never a problem during the heyday. The decline in Lisp in fact started at the height of standardization.

> it's so easy to write a lisp system

Have you tried it, and how far did you get?

Making a Lisp system useful for production is pretty brutal.

13 years into it you will be debugging some eleven-year-old GC or compiler bug.

People think it's easy because they visualize the job as being done when some executable file converts (+ 1 1) into 2.

Re: I’ve Consed Every Pair

#76
post #27

I tried writing some of my own verses for this song, but I couldn't think of anything that rhymed with RPLACA and CDADAADR. Speaking of consing every pair, here's a previous discussion about "The Origin of CAR and CDR in Lisp (2005) (iwriteiam.nl)": https://news.ycombinator.com/item?id=16008239 http://www.iwriteiam.nl/HaCAR_CDR.html

Funny you bring up rhymes; my brain keeps matching "I've Consed Every Pair, Man" with "Bicycle Repairman". https://www.dailymotion.com/video/x2howud

Straight up admission of HN's rabid anti-communist bias at the end there.

Re: I’ve Consed Every Pair

#77

Earlier quoted context omitted.

Not at all. I share your frustration. Closures on a server are a powerful way of representing data flows. But they come at a cost: the links expire after some time. How do you strike a balance? The simplest way is to put in the extra time to make everything into a persistent link. But, that's equivalent to removing all the benefits of lexical scoping. If you've ever created an inner function before, you know how powe…

Since this is getting a surprising amount of interest, let me sum up the technique here. It's really not hard to implement it in Javascript using Express. 1. inside of your express endpoint, create a closure that captures some state. For example, the user's IP address. (This is a dumb example, but the point is that you can capture whatever state you want . Some cases are mentioned here: http://paulgraham.com/road.htm…

Well this is certainly the coolest thing I've read today. I've been trying to grok closures and this helps a bit. Is there a reason to not use the global hash table itself to store the state instead of a closure? This seems to be trading a database with memory. This also seems to be harder to interrogate, what if I want to go in and see what's currently outstanding, instead of going to Firebase, I'll need to go through the hash table and check the content of the function.

I think I may be missing something someone who's actually worked with lisp can see, to me closure, recursion and functional programming is cool but I can do everything its showing off using the standard fare of loops and databases.

Re: I’ve Consed Every Pair

#79

Earlier quoted context omitted.

Since this is getting a surprising amount of interest, let me sum up the technique here. It's really not hard to implement it in Javascript using Express. 1. inside of your express endpoint, create a closure that captures some state. For example, the user's IP address. (This is a dumb example, but the point is that you can capture whatever state you want . Some cases are mentioned here: http://paulgraham.com/road.htm…

Well this is certainly the coolest thing I've read today. I've been trying to grok closures and this helps a bit. Is there a reason to not use the global hash table itself to store the state instead of a closure? This seems to be trading a database with memory. This also seems to be harder to interrogate, what if I want to go in and see what's currently outstanding, instead of going to Firebase, I'll need to go throu…

The biggest difference is the “...” assignment to fn. The idea is similar to AWS Lambda — write functions, store those functions, and then call them later when you need them. I’ve minimal Lisp experience, but from my perspective, a closure is a function you can store in a variable that’s defined with a scope, or a set of arguments/variables used in your function, that often (but not always) includes variables from the parent scope it was defined in, (often only) if referenced by the function. Because closures need to have independent scopes, by default values (or variables) that can mutate need to be copied — alternatively, you can use immutable data structures which copy more cheaply. The big differences then between closures and other types of code often comes down to how frequently immutability is used, and whether you call functions that assume state or share state (more OO, or non-FP), or transfer functions with state to other functions (FP, though composability and other properties matter too when defining FP, this is a simplification). This is a bit of a vague answer, perhaps others can chime in with a better one. And if you’re not careful, FP can introduce problems too, though that happens more often with distributed, multi-threaded or recursive programs which can themselves be hard to write using non-FP also.
Post reply on HN