Few Examples of Lisp Code Typography
March 11, 2012 4:09 PM Subscribe
It's Greek to me!
posted by a humble nudibranch at 4:14 PM on March 11, 2012
posted by a humble nudibranch at 4:14 PM on March 11, 2012
(
posted by ardgedee at 4:21 PM on March 11, 2012 [4 favorites]
posted by ardgedee at 4:21 PM on March 11, 2012 [4 favorites]
TRY!TWO!THINGS!IN!PARALLEL!THEN!EXTERMINATE!THE!DOCTOR!
posted by kenko at 4:29 PM on March 11, 2012 [4 favorites]
posted by kenko at 4:29 PM on March 11, 2012 [4 favorites]
TRY!TWO!THINGS!IN!PARALLEL!THEN!EXTERMINATE!THE!DOCTOR!
(setq doctor nil)
posted by zippy at 4:31 PM on March 11, 2012
(setq doctor nil)
posted by zippy at 4:31 PM on March 11, 2012
So there were commas everywhere until 1.5? I didn't know that.
But no M expressions? No dotted pairs? No superparens? I'm sorely dissapointed.
posted by mr vino at 4:37 PM on March 11, 2012 [5 favorites]
But no M expressions? No dotted pairs? No superparens? I'm sorely dissapointed.
posted by mr vino at 4:37 PM on March 11, 2012 [5 favorites]
...it's full of parentheses!
An elegant delimiter for a more civilized code.
Not my quote, but I wish it was.
posted by radwolf76 at 5:24 PM on March 11, 2012
An elegant delimiter for a more civilized code.
Not my quote, but I wish it was.
posted by radwolf76 at 5:24 PM on March 11, 2012
A Lisp programmer happens across a frog in the road. The frog pipes up, "I'm really a beautiful princess and if you kiss me, I'll stay with you for a week". The programmer shrugs his shoulders and puts the frog in his pocket.
A few minutes later, the frog says "OK, OK, if you kiss me, I'll give you great sex for a week". The programmer nods and puts the frog back in his pocket.
A few minutes later, "Turn me back into a princess and I'll give you great sex for a whole year!". The programmer smiles and walks on.
Finally, the frog says, "What's wrong with you? I've promised you great sex for a year from a beautiful princess and you won't even kiss a frog?"
"I'm a Lisp programmer," he replies. "I don't have time for sex ... But a talking frog is pretty neat."
posted by netbros at 5:30 PM on March 11, 2012 [10 favorites]
A few minutes later, the frog says "OK, OK, if you kiss me, I'll give you great sex for a week". The programmer nods and puts the frog back in his pocket.
A few minutes later, "Turn me back into a princess and I'll give you great sex for a whole year!". The programmer smiles and walks on.
Finally, the frog says, "What's wrong with you? I've promised you great sex for a year from a beautiful princess and you won't even kiss a frog?"
"I'm a Lisp programmer," he replies. "I don't have time for sex ... But a talking frog is pretty neat."
posted by netbros at 5:30 PM on March 11, 2012 [10 favorites]
Superparens should not work that way. What if someone copies and pastes your code in the middle of their code? Yes, those people should be given the lash, but it's not terribly context-free for that feature to work the way it does in that situation.
I was thinking recently about the too-many-parentheses complaint leveled against LISP and thought (not knowing that superparentheses had already been thought of) that there should be another kind of paren, the square brace, but the number of parens it closed would just be the number that had opened since the last opening square brace, so the impact of a square brace could be precisely limited.
So instead of ( ( ( blah blah ] you would do [ ( ( blah blah ] and now you know exactly the extent of the effect of your superparen.
posted by a snickering nuthatch at 5:31 PM on March 11, 2012 [2 favorites]
I was thinking recently about the too-many-parentheses complaint leveled against LISP and thought (not knowing that superparentheses had already been thought of) that there should be another kind of paren, the square brace, but the number of parens it closed would just be the number that had opened since the last opening square brace, so the impact of a square brace could be precisely limited.
So instead of ( ( ( blah blah ] you would do [ ( ( blah blah ] and now you know exactly the extent of the effect of your superparen.
posted by a snickering nuthatch at 5:31 PM on March 11, 2012 [2 favorites]
I was sort of expecting an analysis of proper use of typography to improve the readability of LISP, feels like a missed opportunity here.
As an aside, I only know of one in-depth look at using modern typesetting ideas to re-think how we might be able to display source code. Ron Baecker and Aaron Marcus developed some mockups of alternative views, in the hopes of making it easier to differentiate between comments, functions and procedures, variables, and so on. Here's a link to some of their ideas on viewing source code.
Now, before people start jumping in on the weaknesses of their designs (and I would probably agree with most of the critiques), it's important to realize that these mockups were created in 1990, and they were thinking laterally about ways of showing code given rich graphics display capabilities.
These days, for better or for worse, we're stuck with 80 characters per line and limited by what can be stored inside of an ASCII text file. Poul Henning-Kamp has a good comment here, saying "For some reason computer people are so conservative we still find it more uncompromisingly important for our source code to be compatible with a Tele-type ASR-33 terminal and its 1963-vintage ASCII table than it is for us to be able to express our intentions clearly".
Or, circling back to LISP, Alan Kay once said "The great problem with Lisp is that it is just good enough to keep us from developing something really good."
posted by jasonhong at 5:36 PM on March 11, 2012 [4 favorites]
As an aside, I only know of one in-depth look at using modern typesetting ideas to re-think how we might be able to display source code. Ron Baecker and Aaron Marcus developed some mockups of alternative views, in the hopes of making it easier to differentiate between comments, functions and procedures, variables, and so on. Here's a link to some of their ideas on viewing source code.
Now, before people start jumping in on the weaknesses of their designs (and I would probably agree with most of the critiques), it's important to realize that these mockups were created in 1990, and they were thinking laterally about ways of showing code given rich graphics display capabilities.
These days, for better or for worse, we're stuck with 80 characters per line and limited by what can be stored inside of an ASCII text file. Poul Henning-Kamp has a good comment here, saying "For some reason computer people are so conservative we still find it more uncompromisingly important for our source code to be compatible with a Tele-type ASR-33 terminal and its 1963-vintage ASCII table than it is for us to be able to express our intentions clearly".
Or, circling back to LISP, Alan Kay once said "The great problem with Lisp is that it is just good enough to keep us from developing something really good."
posted by jasonhong at 5:36 PM on March 11, 2012 [4 favorites]
Source code on paper looks weird.
posted by tylerkaraszewski at 5:43 PM on March 11, 2012
posted by tylerkaraszewski at 5:43 PM on March 11, 2012
jasonhong: there's also colorforth, where (IIRC) the color of the type has semantic value.
posted by kenko at 5:45 PM on March 11, 2012
posted by kenko at 5:45 PM on March 11, 2012
I've never understood the point of superparens. If you are programming Lisp in !emacs, YOU ARE DOING IT WRONG.
Also, highlight-sexps, you're welcome.
posted by DU at 5:47 PM on March 11, 2012 [3 favorites]
Also, highlight-sexps, you're welcome.
posted by DU at 5:47 PM on March 11, 2012 [3 favorites]
For some reason computer people are so conservative we still find it more uncompromisingly important for our source code to be compatible with a Tele-type ASR-33 terminal and its 1963-vintage ASCII table than it is for us to be able to express our intentions clearly.
1) If you can't express your intentions clearly with plain text, you have problems a GUI won't solve.
2) The vast, vast, VAST toolset of working with plaintext of which grep, sed/awk and friends are only the tip. I can, in one single command line, get a list of all the environment variables my code references in all subdirs and listed out uniquely and in alphabetical order. If I had to wait for that feature to exist in an IDE, I'd never get it because I've only needed that feature once in 10 years. How high on the priority list does that feature rate? Nil. That's why we need generic tools. Plain text is the ultimate format for those tools. Break it and you've broken 75% or more of my toolchain.
posted by DU at 5:51 PM on March 11, 2012 [7 favorites]
1) If you can't express your intentions clearly with plain text, you have problems a GUI won't solve.
2) The vast, vast, VAST toolset of working with plaintext of which grep, sed/awk and friends are only the tip. I can, in one single command line, get a list of all the environment variables my code references in all subdirs and listed out uniquely and in alphabetical order. If I had to wait for that feature to exist in an IDE, I'd never get it because I've only needed that feature once in 10 years. How high on the priority list does that feature rate? Nil. That's why we need generic tools. Plain text is the ultimate format for those tools. Break it and you've broken 75% or more of my toolchain.
posted by DU at 5:51 PM on March 11, 2012 [7 favorites]
Wow, that's a terrible example of Interlisp-D formatting.
posted by Runes at 6:08 PM on March 11, 2012
posted by Runes at 6:08 PM on March 11, 2012
If you are programming Lisp in !emacs, YOU ARE DOING IT WRONG.
Way to re-ignite a 40-year flame war... If you're using a text editor to write Lisp code, YOU ARE DOING IT WRONG. Use a structure editor. :-)
I can, in one single command line, get a list of all the environment variables my code references in all subdirs and listed out uniquely and in alphabetical order. If I had to wait for that feature to exist in an IDE, I'd never get it because I've only needed that feature once in 10 years. How high on the priority list does that feature rate? Nil.
Spoken like someone who's never used a full-blown Lisp programming environment. The notion of subdirs for code is probably the hard bit here since to Interlisp considered files as database stores for functions and associated things, but getting a unique list of variables in alphabetical order was trivial 25 years ago.
posted by Runes at 6:29 PM on March 11, 2012
Way to re-ignite a 40-year flame war... If you're using a text editor to write Lisp code, YOU ARE DOING IT WRONG. Use a structure editor. :-)
I can, in one single command line, get a list of all the environment variables my code references in all subdirs and listed out uniquely and in alphabetical order. If I had to wait for that feature to exist in an IDE, I'd never get it because I've only needed that feature once in 10 years. How high on the priority list does that feature rate? Nil.
Spoken like someone who's never used a full-blown Lisp programming environment. The notion of subdirs for code is probably the hard bit here since to Interlisp considered files as database stores for functions and associated things, but getting a unique list of variables in alphabetical order was trivial 25 years ago.
posted by Runes at 6:29 PM on March 11, 2012
Jpfed: I used a LISP for a while in the late 80s which had square-brace superparens that worked exactly that way. The pretty-printer even used them on output in ways that made the structure easier to read. I wonder if Dennie Van Tassel's description is incomplete, or if I'm remembering wrong, or what.
Presumably you could have an entire hierarchy of super/extra/ultra/buckyparentheses but I kind of think that if you need more than just the superparens you should rearrange your code a little.
posted by hattifattener at 7:27 PM on March 11, 2012
Presumably you could have an entire hierarchy of super/extra/ultra/buckyparentheses but I kind of think that if you need more than just the superparens you should rearrange your code a little.
posted by hattifattener at 7:27 PM on March 11, 2012
This is fun. I work at a Lisp consulting company and we just submitted our first written-in-Lisp app to the Mac App Store. I didn't expect to see Lisp gracing the front page of Metafilter.
As for parentheses, I've never been able to wrap my head around the odd mixture of semicolons, commas, square brackets and the rest that delimit c-syntax styled languages. However do you keep it all straight and know when to use commas or semicolons or leave them out altogether? That makes no sense to me. Parentheses, by contrast, are very simple. They're balanced or they're not, and your editor can tell you which it is.
posted by alms at 7:34 PM on March 11, 2012 [2 favorites]
As for parentheses, I've never been able to wrap my head around the odd mixture of semicolons, commas, square brackets and the rest that delimit c-syntax styled languages. However do you keep it all straight and know when to use commas or semicolons or leave them out altogether? That makes no sense to me. Parentheses, by contrast, are very simple. They're balanced or they're not, and your editor can tell you which it is.
posted by alms at 7:34 PM on March 11, 2012 [2 favorites]
DU: "The vast, vast, VAST toolset of working with plaintext of which grep, sed/awk and friends are only the tip."
I wasted* three years hacking away on a MDD tool that actually got pretty good before I shelved it. I gave up when I found myself irritated that I couldn't diff anything. Being able to compare and track changes across versions is such a core part of software engineering that it's criminal that GUI driven modelling and development tools do it so badly. Ever tried to do useful revision control with a big binary MagicDraw blob? It's beyond useless.
* I learned a hell of a lot, so not quite wasted. But the opportunity cost was high.
posted by vanar sena at 9:18 PM on March 11, 2012
I wasted
posted by vanar sena at 9:18 PM on March 11, 2012
Source code on paper looks weird.
I'm guessing you didn't have an actual piece of dead tree in your hands when you had this thought, and that make me wonder what, exactly, "on paper" means there. Something with edges?
posted by benito.strauss at 9:26 PM on March 11, 2012
I'm guessing you didn't have an actual piece of dead tree in your hands when you had this thought, and that make me wonder what, exactly, "on paper" means there. Something with edges?
posted by benito.strauss at 9:26 PM on March 11, 2012
I was half certain wobh's link would lead to a page about Dylan.
posted by kenko at 9:33 PM on March 11, 2012
posted by kenko at 9:33 PM on March 11, 2012
If this computer programming is too technical for you to understand, you can still rock out to The Land Of LISP: The Pop Music Video!
posted by Harvey Kilobit at 10:27 PM on March 11, 2012
posted by Harvey Kilobit at 10:27 PM on March 11, 2012
I learned a hell of a lot, so not quite wasted. But the opportunity cost was high.
At times I think that it would not surprise me to one day arrive at similar conclusions about programming in the general case.
posted by brennen at 11:12 PM on March 11, 2012 [3 favorites]
At times I think that it would not surprise me to one day arrive at similar conclusions about programming in the general case.
posted by brennen at 11:12 PM on March 11, 2012 [3 favorites]
Superparens should not work that way.
I read this in Morbo's voice.
Those early examples were wild. Italicized, all-caps, and proportional! It's like seeing an early design of a car where the driver's seat is covered in spikes and the windshield is a sheet of solid lead with two eyeholes.
posted by No-sword at 11:31 PM on March 11, 2012 [3 favorites]
I read this in Morbo's voice.
Those early examples were wild. Italicized, all-caps, and proportional! It's like seeing an early design of a car where the driver's seat is covered in spikes and the windshield is a sheet of solid lead with two eyeholes.
posted by No-sword at 11:31 PM on March 11, 2012 [3 favorites]
Those early examples were wild. Italicized, all-caps, and proportional! It's like seeing an early design of a car where the driver's seat is covered in spikes and the windshield is a sheet of solid lead with two eyeholes.You crazy kids with your fancy mixed-case code.
I remember when we got our first pretty-printer that would reformat your LISP code for readability in what must have been 1979. We had massive arguments about what the proper alignment should be and ended up hacking dozens of options into the thing until eventually everyone's code looked more or less like it always did. On the plus side, I could take someone else's code and reformat it "properly" so that I could read it and debug their crappy stuff.
posted by Lame_username at 12:39 AM on March 12, 2012 [2 favorites]
So, yeah--LISP code. Is it an aesthetic now?
posted by Obscure Reference at 4:43 AM on March 12, 2012
posted by Obscure Reference at 4:43 AM on March 12, 2012
Emacs.
vi.
Humbug! I use a magnetized needle and a steady hand to play the Let's Insert Some Parentheses game.
posted by double block and bleed at 6:46 AM on March 12, 2012
vi.
Humbug! I use a magnetized needle and a steady hand to play the Let's Insert Some Parentheses game.
posted by double block and bleed at 6:46 AM on March 12, 2012
I saw a bumper sticker at the grocery store once that said "My other car is a cdr."
Yes, I live in Cambridge, MA.
posted by atbash at 9:53 AM on March 12, 2012 [1 favorite]
Yes, I live in Cambridge, MA.
posted by atbash at 9:53 AM on March 12, 2012 [1 favorite]
Best bumper sticker I ever saw said:
Forth love if honk then;
posted by benito.strauss at 12:17 PM on March 12, 2012 [3 favorites]
Forth love if honk then;
posted by benito.strauss at 12:17 PM on March 12, 2012 [3 favorites]
Well, he's got one of my Lisp books, but not the other.
posted by RikiTikiTavi at 12:23 PM on March 12, 2012 [1 favorite]
posted by RikiTikiTavi at 12:23 PM on March 12, 2012 [1 favorite]
I've been dabbling a bit with clojure and largely come to the conclusion that emacs with slime is the environment I hate the least, although half of the annoyance comes from bad habits clojure inherits from java: classpath hell and the necessity to do everything inside a "project" with a deep file hierarchy.
posted by CBrachyrhynchos at 2:03 PM on March 12, 2012
posted by CBrachyrhynchos at 2:03 PM on March 12, 2012
It's kind of interesting that the first example says "is represented in our notation", as if this is not a programming language but just some new way of writing math.
posted by madcaptenor at 3:19 PM on March 13, 2012
posted by madcaptenor at 3:19 PM on March 13, 2012
What lisps look like now. Lisp: Common Lisp, Scheme, Clojure, Emacs Lisp: a side-by-side reference sheet. Peter Norvig's Lisp Style Guide: Postscript file
posted by wobh at 4:50 PM on March 13, 2012
posted by wobh at 4:50 PM on March 13, 2012
Better xkcd. or should I say, more apropos?
posted by mr vino at 3:10 PM on March 14, 2012 [1 favorite]
posted by mr vino at 3:10 PM on March 14, 2012 [1 favorite]
« Older You make my heart go to 12,000 RPM | Yes, but do they have a secret plan to fight... Newer »
This thread has been archived and is closed to new comments
posted by Deathalicious at 4:13 PM on March 11, 2012