Live data from Hacker News

I’ve Consed Every Pair

medium.com

41–50 of 228 posts

Re: I’ve Consed Every Pair

#41
post #34

> I found it ironic that this programmer seemed not to realize that I had used Lisp as my primary language for 15 years of my career. Why is that ironic?

If somebody is trying to school you, and if there is a reason to believe you work in a genius-factory, then its ironic that the school-er doesn't do their homework into the school-ee to understand what they might be doing. Go back to school?

School you?

Sounds like someone mentioned how awesome a Lisp is. Ironically he said to someone who has done a bit of Lisp before. There ain't much to the OP story, or at least he hasn't divulged that much, but the song he wrote is pretty cool.

Re: I’ve Consed Every Pair

#42
post #37
post #29

Earlier quoted context omitted.

I'd rather have "people wracked with doubt and who fear their own ignorance" :)

Ah, so you don't believe in experts, eh? Not even ones apparently expert on every subject?

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.

Re: I’ve Consed Every Pair

#43
post #36

Earlier quoted context omitted.

My account was reset. I've been around since day two. :) You're right, it has some downfalls. But a lot of the time it simply doesn't matter. All the links at https://www.tensorfork.com/tpus are dynamic, and the speed you gain by being able to whip up a feature in 10 minutes is worth the pain of an occasional dead link. On the other hand, I did some work for "deduplicating fnids": http://arclanguage.com/item?id=20996…

the speed you gain by being able to whip up a feature in 10 minutes is worth the pain of an occasional dead link This is everything that is wrong with the software industry, summarized in one sentence. Speed gain enjoyed by developers is paid for by the users in pain. It used to be that developers would go through tremendous amounts of pain just to squeeze out a few instructions from a UI drawing routine in order to…

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 powerful that technique can be. You can encode the entire state of the program into closures -- no need to store things in databases. Want a password reset link? Spin up a closure, email the link, done. Literally identical to storing a reset token in a database, except there's no database.

Another solution is to fix the root problem. Does the closure really need a random ID every time the page refreshes? The closure links die because they have to be GC'd periodically, to keep memory usage down. Even if you cache the page for 90 seconds, that's still 960 refreshes per day for logged-out users. Then if you have a few hundred regular users, that's at least another factor of two. And certain pages might create hundreds of closure links each refresh, so it quickly gets out of hand.

Ironically, the solution was emacs -- in emacs, they store closures in a printable way. A closure is literally a list of variable values plus the function's source code. That got me thinking -- why not use that as the key, instead of making a random key each time the page refreshes? After all, if the function's lexical variables are identical, then it should produce identical results each time it's run. No need to create another one.

That's what I did. It took a week or so, which is a week I'll never get back for building new features. But at least users won't have to deal with dead links anymore.

Clever readers will note a theoretical security flaw: an attacker might be able to guess your function IDs if they knew the entire state of the closure + the closure's source code (which is the default case for an open source project). That might give them access to e.g. your admin links. But that's not an indictment of the technique; it's easily solved by concatenating the key with a random ID generated at startup, and hashing that. I'm just making a note of it here in case some reader wants to try implementing this idea in their own framework.

The closure technique has nontrivial productivity speedups (that I think someone will rediscover some years from now). I hope the idea becomes more popular over time.

Re: I’ve Consed Every Pair

#44

Earlier quoted context omitted.

Are fnids anything like Fnords? https://en.wikipedia.org/wiki/Fnord Or are they more like Vermicious Knids? https://roalddahl.fandom.com/wiki/Vermicious_Knids

It's short for function ID. If you want to route requests to specific closures, you have to have some sort of ID that you can send down to the user. Arc stores closures in a hash table keyed by random ID, but we use lexical structure plus lexical values (like username) to make the key deterministic. It greatly cut down on the number of closures that needed to be stored. Basically, if you have a closure that does a ce…

That sounds like a complicated fix! How many tens of minutes did it take? And how many tens of minutes did the bug cost, in effort spent on comments that got eaten instead of posted?

(I know there's no way to answer that last question, but that doesn't mean its answer is equal to zero.)

Re: I’ve Consed Every Pair

#45

Earlier quoted context omitted.

It's short for function ID. If you want to route requests to specific closures, you have to have some sort of ID that you can send down to the user. Arc stores closures in a hash table keyed by random ID, but we use lexical structure plus lexical values (like username) to make the key deterministic. It greatly cut down on the number of closures that needed to be stored. Basically, if you have a closure that does a ce…

That sounds like a complicated fix! How many tens of minutes did it take? And how many tens of minutes did the bug cost, in effort spent on comments that got eaten instead of posted? (I know there's no way to answer that last question, but that doesn't mean its answer is equal to zero.)

(Ah, never mind, I see this line of thought has already been explored nearby. I've nothing to add beyond what's already been said there.)

Re: I’ve Consed Every Pair

#46
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?

Re: I’ve Consed Every Pair

#47

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?

[deleted]

Re: I’ve Consed Every Pair

#48
post #42
post #37

Earlier quoted context omitted.

Ah, so you don't believe in experts, eh? Not even ones apparently expert on every subject?

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.

Re: I’ve Consed Every Pair

#49
post #34

Earlier quoted context omitted.

If somebody is trying to school you, and if there is a reason to believe you work in a genius-factory, then its ironic that the school-er doesn't do their homework into the school-ee to understand what they might be doing. Go back to school?

How did you gather all of that from the short paragraph at the beginning of the article?

There are about three possible choices

1) he knew he did LISP like languages and wanted to share 2) he didn't know he did LISP like languages and wanted to share 3) he was showing off. 4) the other choices.

I went to 3) based on my 40 years experience in computer science.

Re: I’ve Consed Every Pair

#50

Earlier quoted context omitted.

That sounds like a complicated fix! How many tens of minutes did it take? And how many tens of minutes did the bug cost, in effort spent on comments that got eaten instead of posted? (I know there's no way to answer that last question, but that doesn't mean its answer is equal to zero.)

(Ah, never mind, I see this line of thought has already been explored nearby. I've nothing to add beyond what's already been said there.)

It was complicated, but at one point I was so in love with Arc that I wanted to give it a real shot at taking over the world. It seemed like a necessary change to make, since the moment someone brought up dead links as a slight against arc, I could point to the change and say, "Already fixed!"

(I made a few other improvements, like having accurate line numbers in error messages, and a clojure-style REPL for emacs: https://www.youtube.com/watch?v=3v1KpEmuPeM)

Post reply on HN