Live data from Hacker News

I’ve Consed Every Pair

medium.com

191–200 of 228 posts

Re: I’ve Consed Every Pair

#191

Can someone explain what this means? What is this "consed" he is talking about? I'm a c++ programmer, "consed every pair" means nothing to me.

From the Common Lisp Hyperspec:

cons n.v. 1. n. a compound data object having two components called the car and the cdr. 2. v. to create such an object. 3. v. Idiom. to create any object, or to allocate storage.

Re: I’ve Consed Every Pair

#192

Earlier quoted context omitted.

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 th…

It's not all that similar to AWS Lambdas in concept or in execution. Those are stateless; to a very good first approximation, they're just a single-route web server with all the boilerplate abstracted away, and that starts up a fresh instance to handle each request and is shut down again immediately after. What 'sillysaurusx describes is much more similar to what, in Scheme and elsewhere but these days mainly there,…

True. Good distinctions. To re-iterate the above, the approximation to AWS Lambda would require dynamic AWS Lambda functions -- as in code that creates a Lambda with specific state embedded in it -- then tracks each of those by their unique Lambda identifier and ... yeah, that's where this breaks down because it's not all that similar to Lambda if the best use for a Lambda is repeated invocations of the same code. And Lambda IDs presumably aren't based on a hash of their contents and variables the way this is. But dynamic AWS Lambda functions are possible, so there's that. You could write this in Lambda, it just might be expensive if API calls to create and destroy one-time Lambdas are expensive enough. It's a lot cheaper and faster to build functions and store references to them in a hash table in memory.

Another similarity to this use of hashing the scope of a function would be in memoization of a function, to cache the output based on the input, such that you hash a function's inputs and assign to that hash a copy of the output of the function when run with those inputs. Then you can hash the inputs and skip re-running the function. You have to be sure the function has no side-effects nor any changes in behaviour or inputs not specified in the memoization hash, though. "Pure" functions are best for this use case.

Re: I’ve Consed Every Pair

#193

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?

Emacs. Other than that, none really. The level of software popularity you're used to has long passed the Lisp family of languages.

Re: I’ve Consed Every Pair

#194

Earlier quoted context omitted.

It's not all that similar to AWS Lambdas in concept or in execution. Those are stateless; to a very good first approximation, they're just a single-route web server with all the boilerplate abstracted away, and that starts up a fresh instance to handle each request and is shut down again immediately after. What 'sillysaurusx describes is much more similar to what, in Scheme and elsewhere but these days mainly there,…

True. Good distinctions. To re-iterate the above, the approximation to AWS Lambda would require dynamic AWS Lambda functions -- as in code that creates a Lambda with specific state embedded in it -- then tracks each of those by their unique Lambda identifier and ... yeah, that's where this breaks down because it's not all that similar to Lambda if the best use for a Lambda is repeated invocations of the same code. An…

Memoization is usually preferable if you can do it, sure. But you can't memoize a continuation, because what it expresses is a computation that has yet to complete and produce the result you'd need in order to memoize. And the use of the g_fnid hash table doesn't qualify as memoization, either, because the keys aren't arguments to the function that produced the values; what it actually is is a jump table, cf. https://en.m.wikipedia.org/wiki/Branch_table#Jump_table_exam...

Re: I’ve Consed Every Pair

#195

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

CDADAADR, alligator! After a while, crocodile!

Re: I’ve Consed Every Pair

#196

Earlier quoted context omitted.

Peter Norvig explained why he came to Python from Lisp in an HN posting a decade ago: https://news.ycombinator.com/item?id=1803815 >norvig on Oct 18, 2010 | parent | favorite | on: Ask PG: Lisp vs Python (2010) >Peter Norvig here. I came to Python not because I thought it was a better/acceptable/pragmatic Lisp, but because it was better pseudocode. Several students claimed that they had a hard time mapping from the p…

So basically a race to the bottom in order to communicate with the ALGOL intolerant fanatics.

Aw, come on. It's a truly beautiful story.

Re: I’ve Consed Every Pair

#198

Arc is underrated as an information management tool. There's something to be said for having a web framework that works out of the box. Rails is probably the only other framework that makes it as easy to "just make some forms that pass data around and run some code on that data." But not quite -- I haven't seen arc's closure-storing technique used in any other web framework. The main issue that arc solves is that it…

i think seaside (a smalltalk web framework) pioneered the continuation-based technique, though it could have been around earlier. http://www.seaside.st/

racket's built-in web server does it too.

Re: I’ve Consed Every Pair

#199
post #198

Arc is underrated as an information management tool. There's something to be said for having a web framework that works out of the box. Rails is probably the only other framework that makes it as easy to "just make some forms that pass data around and run some code on that data." But not quite -- I haven't seen arc's closure-storing technique used in any other web framework. The main issue that arc solves is that it…

i think seaside (a smalltalk web framework) pioneered the continuation-based technique, though it could have been around earlier. http://www.seaside.st/ racket's built-in web server does it too.

References to some previous uses: https://thelackthereof.org/docs/library/cs/continuations.pdf

Including pg’s ViaWeb written in continuation-passing style: https://sep.yimg.com/ty/cdn/paulgraham/bbnexcerpts.txt

Re: I’ve Consed Every Pair

#200
post #196

Earlier quoted context omitted.

So basically a race to the bottom in order to communicate with the ALGOL intolerant fanatics.

Aw, come on. It's a truly beautiful story.

Wonderful. What a lovely unspoken communication, particularly from Peter.
Post reply on HN