Land of Lisp
vsedach writes "Remember the 1980s and BASIC, when programming was simple, brains flew through space, and everyone ate lasers? Computer magazines came with code listings, and classics like David Ahl's BASIC Computer Games offered a fun and easy way to get started in computer programming. Conrad Barski remembers, and with Land of Lisp, he's set out to demystify programming in the 21st century." Keep reading for the rest of Vladimir's review.
Land of Lisp: Learn to Program in Lisp, One Game at a Time!
author
Conrad Barski, M.D.
pages
504
publisher
No Starch Press
rating
10
reviewer
Vladimir Sedach
ISBN
978-1-59327-281-4
summary
Learn to Program in Lisp, One Game at a Time!
This is no small feat. Modern computers don't come with anything that looks like BASIC. Getting started with a "real" programming language like Java requires installing and learning hundreds of megabytes worth of compiler and integrated development environment. Barski's thesis is that Lisp is a refreshing alternative - it offers BASIC's ease of getting started (get a prompt, type in code, and it works), while providing a combination of modern features unmatched in other programming languages.
The first thing that immediately jumps out about Land of Lisp is that it has a lot of comics. The book is an outgrowth of Conrad's Casting SPELs in Lisp illustrated online tutorial, which originally appeared in 2004 (incidentally, around the same time as why's (poignant) guide to ruby, probably the most famous and epic programming language comic book). The comics are humorous and irreverent - if you're a C programmer, you might be surprised to know that you're a Cro-Magnon fighting the COBOL dinosaur.
Despite the silly humor and Barski's approach of introducing programming completely from scratch, Land of Lisp builds up to cover topics like graph theory, search algorithms, functional and network programming, and domain-specific languages. All throughout, the book emphasizes various techniques for doing I/O. The topics covered will leave the reader with a solid understanding of what modern programming entails and a good basis from which to explore either application or lower-level systems programming.
The most unintentionally impressive aspect of Land of Lisp is that it manages to completely explain web programming. No more hiding behind complicated software stacks and impenetrable web server packages - chapter 13, titled "Let's Create a Web Server!," does exactly what it promises, in only 15 pages. Later chapters introduce HTML and SVG to build a graphical game as a web application. If nothing else, this book will leave the reader with all the necessary basic skills and total confidence in their understanding to build real-world web applications.
Other introductory programming books use Lisp, but none fall into the same category as Land of Lisp. Abelson, Sussman and Sussman's Structure and Interpretation of Computer Programs, arguably the greatest introductory programming book ever written, requires a solid math background to understand the examples. Felleisen et alia's How to Design Programs offers a much deeper introduction to programming than Land of Lisp, but is an academic textbook, and hence lacks funny cartoons and may be boring. Friedman et alia's The Little Schemer is a favorite of many, but doesn't have LoL's real-world applications.
Land of Lisp is an excellent book for someone who wants to learn how to program, for web programmers who want to move up out of their niche and start learning about CS theory and systems programming, and for anyone who is puzzled about what really goes on behind the web and wants to learn what web programming is really about. Experienced programmers who want to jump into using Lisp are probably better off with Peter Seibel's Practical Common Lisp, though.
Watch Conrad's hilarious promotional music video for the book.
You can purchase Land of Lisp: Learn to Program in Lisp, One Game at a Time! from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
The first thing that immediately jumps out about Land of Lisp is that it has a lot of comics. The book is an outgrowth of Conrad's Casting SPELs in Lisp illustrated online tutorial, which originally appeared in 2004 (incidentally, around the same time as why's (poignant) guide to ruby, probably the most famous and epic programming language comic book). The comics are humorous and irreverent - if you're a C programmer, you might be surprised to know that you're a Cro-Magnon fighting the COBOL dinosaur.
Despite the silly humor and Barski's approach of introducing programming completely from scratch, Land of Lisp builds up to cover topics like graph theory, search algorithms, functional and network programming, and domain-specific languages. All throughout, the book emphasizes various techniques for doing I/O. The topics covered will leave the reader with a solid understanding of what modern programming entails and a good basis from which to explore either application or lower-level systems programming.
The most unintentionally impressive aspect of Land of Lisp is that it manages to completely explain web programming. No more hiding behind complicated software stacks and impenetrable web server packages - chapter 13, titled "Let's Create a Web Server!," does exactly what it promises, in only 15 pages. Later chapters introduce HTML and SVG to build a graphical game as a web application. If nothing else, this book will leave the reader with all the necessary basic skills and total confidence in their understanding to build real-world web applications.
Other introductory programming books use Lisp, but none fall into the same category as Land of Lisp. Abelson, Sussman and Sussman's Structure and Interpretation of Computer Programs, arguably the greatest introductory programming book ever written, requires a solid math background to understand the examples. Felleisen et alia's How to Design Programs offers a much deeper introduction to programming than Land of Lisp, but is an academic textbook, and hence lacks funny cartoons and may be boring. Friedman et alia's The Little Schemer is a favorite of many, but doesn't have LoL's real-world applications.
Land of Lisp is an excellent book for someone who wants to learn how to program, for web programmers who want to move up out of their niche and start learning about CS theory and systems programming, and for anyone who is puzzled about what really goes on behind the web and wants to learn what web programming is really about. Experienced programmers who want to jump into using Lisp are probably better off with Peter Seibel's Practical Common Lisp, though.
Watch Conrad's hilarious promotional music video for the book.
You can purchase Land of Lisp: Learn to Program in Lisp, One Game at a Time! from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
(incidentally, around the same time as why's (poignant) guide to ruby, probably the most famous and epic programming language comic book)
Hey, take it easy there, this is a book review meant for humans (not some code for an interpreter)!
Oh great, now you've got me doing it too. Do you have any idea how long it took for this to go away the last time I coded Lisp?
*obsessively tallies and double checks to make sure he closed all his parentheses before hitting submit*
My work here is dung.
But where's our new hyper advanced LISP machines?
Nothing will beat the Symbolics Lisp machine. Clozure is great, but not quite there yet.
...they'd never end... Sigh. I remember David Ahl's Basic Computer Games with such nostalgia, spending my first weeks in late 1974 as a freshman typing in SUPER STAR TREK onto paper punch cards to run on the IBM360 at University of Tennessee. As a county bumpkin coming into the land of Oz where there were Real Actual Computers I could work with for the first time, I though I had Entered The Future. Little did I know that the future had only begun, and continues today. Probably will continue into tomorrow, too.
If you're a C programmer, you might be surprised to know that you're a Cro-Magnon fighting the COBOL dinosaur.
From the "random" quote of the day at the bottom right of the page:
COBOL is for morons. -- E.W. Dijkstra
My work here is dung.
What do Smileys do to Lisp?
My first Journal Entry ever, in 8 years! http://slashdot.org/journal/365947/aphelion-scifi-fantasy-horror-poetry-webzine
Denote keyword arguments?
(happy :o(sad))
Every Windows PC comes with VBscript - open a *.vbs file, and just start typing away Visual Basic.
Every PC comes with multiple javascript runtimes - just open a *.html file and start scripting away.
I wouldn't recommend BASIC or LISP for someone wanting to learn modern object-oriented programming today. A lot of us started out with a structured languages like this, but you wouldn't want to start out that way if you were doing it for the first time now. My university uses Alice and it works pretty well. Alice teaches much more modern object-oriented principles that would be much more useful than BASIC or LISP to a modern programming student.
SJW: Someone who has run out of real oppression, and has to fake it.
Perhaps it speaks to the fact that there are so few real world programming tasks that require cool but obtuse capabilities that take longer to master than the much simpler code in other languages?
Sig Battery depleted. Reverting to safe mode.
I initially learned to code (BASIC) from 3-2-1 Contact magazines.
I thought the problem with metaprogramming is that using it for more than just some trivial examples can make your program effectively impossible to debug? Its one of those tools that let people be really clever with the code on small projects, but on large projects are nothing but a nightmare. Plus the explosion of external libraries for nearly every function you could want really reduced the justification for metaprogramming in the first place. There are probably a few places where it could still benefit, but nobody wants to open up that huge can of worms for a few corner cases.
I read the internet for the articles.
Alice, who the fuck is Alice?
What's this "object oriented" thing you speak of? If you can't do it in C or LISP, is it really necessary? :-)
Terrorist, bomb, al Qaeda, nuclear, yellowcake, kill, assassinate. Carnivore is dead... long live Echelon.
I wouldn't recommend BASIC or LISP for someone wanting to learn modern object-oriented programming today. A lot of us started out with a structured languages like this, but you wouldn't want to start out that way if you were doing it for the first time now. My university uses Alice and it works pretty well. Alice teaches much more modern object-oriented principles that would be much more useful than BASIC or LISP to a modern programming student.
Common Lisp has object oriented techniques that Java-like languages still fail to have, like multiple-dispatch and metaclasses. Read your manuals before speaking lies, Common Lisp has the most advanced OO system among modern programming languages.
I remember David Ahl. I don't think he gets enough respect today for what he did for the industry with his magazines and books. BTW you can get the text of old articles from Creative Computing at: http://www.atarimagazines.com/
Coder's Stone: The programming language quick ref for iPad
Pay no attention to my user name- I promise to respectfully answer any questions you may have, about Lisp or the book!
Can anyone post links to any Lisp web application?
It can be something different then the HTML & SVG web game, though I would be extra keen to see that run...
San Francisco?
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
What I want to know is why, in 2010, most commonly used languages (Java, C++, C#, etc) do not have even a tiny fraction of the metaprogramming ability that LISP provided to us many decades ago.
Because metaprogramming is confusing. For example, it allows and encourages every developer to come up with his own personal class system, templating system, and collections framework, along with their own custom language keywords to define novel control constructs. Of course each personal framework is incompatible with anybody else's personal framework. This kind of balkanization has been the story of Lisp ever since it was invented.
Sure, but they don't give you the visual feedback programming did "back then".
I would actually argue that at the moment, an iPod Touch is actually the best programming environment for a kid wanting to learn to program, because the feedback is visual and kind of tactile, and they can easily show off work to friends.
The pure text programming plays are too dry to hook many kids early, I think...
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Because there is no -1 Moron
To get the most out of LISP, you really have to approach it with a mindset particularly distinct from most programming. It also happens to be distinct in nearly requiring recursion that is generally not part of an 'easy' getting started with programming. That and most people will club themselves over the head trying to sort out how many close parentheses are needed when they write something *particularly* 'clever'.
If in modern Windows, Powershell is a good starting point, if in Linux, Python. Unlike LISP, both yield immediately marketable skills and are easy to start toying with basics and do not require a lot of knowledge of where to go to get it running, it already exists on your platform (almost certainly).
I do agree that 'web frameworks' have mutated the relatively straightforward nature of underlying http into a frightening looking mystery to the uninitiated, but at least some in the industry are swinging back to the basics and discarding some of the oddly complex schemes over HTTP.
XML is like violence. If it doesn't solve the problem, use more.
Common Lisp, which is what the book uses, has the first ANSI standard OO programming system, CLOS - short for the "Common Lisp Object System" - which includes multiple inheritance, generic functions, a meta-object protocol, and is in all essentials, a superset of the capabilities of the object systems of mainstream OO languages such as C++, Java, Smalltalk and Objective-C.
No one is advocating entering a time warp to the 1960s to use LISP 1.5 for the teaching of modern OO programming, least of all Conrad Barski, the author of Land of Lisp, which uses ANSI standard Common Lisp.
Please, please say there will be a Kindle and/or iBook version of this book...
I'll preorder the physical copy anyway, but it would make a great eBook I think (not having seen it yet).
I think everyone, doing anything, should learn Lisp just to really open yourself to alternative programming approaches. I have used different techniques I learned in Lisp in every programming language I have ever used, from shell scripts to full languages like Java, C++, or Objective-C.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
TV Voice: "Do you remember a time when cookies came fresh from the oven? Pepperidge Farm remembers!"
Fry: "Ahh, those were the days."
TV Voice: "Do you remember a time when women couldn't vote and certain folk weren't allowed on golf courses? Pepperidge Farm remembers!"
One convenient locations...in Africa.
Because, as it turns out, syntax matters, and the majority of programmers find C/Java style code to be easier to deal with than Lisp. (Myself included.)
http://www.planetpdf.com/codecuts/pdfs/ooc.pdf
Speaking as someone who does a lot of real-world programming in non-LISPy languages, I don't think so.
I love Python, and it's considerably more capable than Java or C in terms of metaprogramming... but I can't tell you how many times I wish I could add a bit of syntactic sugar to replace an awkward construct built to work around Python's no-sharp-edges syntax. LISP-style macros may be abusable, but they're also beautiful, beautiful things.
Can I buy it as an elecrtonic copy, e.g. Kindle?
I saw electronic copies available on O'Reilly's site. Not exactly a huge cost benefit but that seems to be the norm.
My work here is dung.
Because when every programmer is a god, all ends in strife and horror and mutation.
See: Greek Pantheon. Or Bioshock.
Mind you, I love Lisp. But I wouldn't if I were working with anyone else on the same code for any length of time.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
What Lisp promised then is what Python promises now. With one difference, in that Python respects the visual limitations of humans.
Different from parentheses, it's very easy to undo a bunch of indentations, just put the left margin where you want it.
Well, if only the TAB character had never been invented... TAB is a kludge to make a typewriter behave sort of like a spreadsheet but, unfortunately, it fucks up the excellent "Don't mix content with presentation" principle.
> Sure, but they don't give you the visual feedback programming did "back then".
Don't they? Explain visual feedback programming differences between running python on today's macs with running basic on, say, the Apple II of old.
To get an idea of where you're coming from, what is your "back then" experience?
First, Lisp is not an acronym.
Second, Lisp has the CLOS, which is an advanced OOP system in its own right with multiple inheritance, polymorphism, encapsulation, multiple dispatch and all that other groovy nonsense. It's no setback compared to "modern" OOP.
Can anyone post links to any Lisp web application? It can be something different then the HTML & SVG web game, though I would be extra keen to see that run...
Can't find it hosted but found the code to the book at the homepage that includes both the svg.lisp and webserver.lisp (also check out CL-HTTP). As to your more generic question, I think this year's lisp game expo competition had a few good Lisp web games.
My work here is dung.
AppleScript is much easier to understand than to write. Nearly everyone winds up using it in an autotools-like way, looking for examples online and adapting them, with a lot of superstitious behavior. It's extremely hard to write non-trivial AppleScript, and I'm speaking as a professional programmer with command of plenty of languages.
I'm a 21 years old software engineering student who is mostly being taught Java (alongside some courses on C/C++). I also have some experience with PHP and very basic experience with Python but that's it. "Lisp" is - alongside "COBOL", "Fortran", etc. - are alien to me. My reaction to them is: "Oh. That was a programming language in the... seventies? Sixties? Eighties? Anyways, I've seen references to it on XKCD."
Delving into this book might be refreshing, interesting and educational at the same time. I'm intrigued by a book that is directed at beginners and yet goes into search algorithms and the like... And the reference to teaching how to create a webserver in 15 papes practically got me drooling. However, is there a reason why all such couldn't be explained with something more modern, like Python? I would love to learn new languages because they're interesting or for personal improvement but I'm a student with two jobs (well, one is very secure and the other pays really well. I don't want to give up either in this economy) and the job market is a tough place. I really don't have time to study things that don't directly relate to the jobs I want to apply to. (This might be why India is kicking our ass. We can't compete in prices when it comes to generic students with limited skillsets but we don't really have a chance to develp wider sets of skills) Using one service to search for open jobs gives me 106 results for "java", 8 results for "python", 200 for "php", 49 for "c++", 19 for "C#"... and 0 for "Lisp".
So... Can anyone suggest me a book like this for some more common language or provide arguments with which I could reason myself to buy this one?
There are plenty of highly skilled programmers who don't like Lisp. You can't just blame it all on management.
http://landoflisp.com/
I think she's a friend of Bob's.
No, I don't really know of lots of copy and paste style redundant code in my C or C++ applications. Generally functions take care of that. If a problem comes up enough, said function is stripped out and added to a library. These are not new or novel concepts, people have been doing them for decades now.
Sometimes people will add lots of copy and paste code to a codebase. We call these people bad programmers, and they tend to be fired.
I read the internet for the articles.
Who cares about a "cost benefit" when you can enjoy a book about Lisp this very instant?
At oreilly.com, I was able to buy the combo package that will send me the physical book, but also let me download the book in ePub or PDF - I just downloaded the PDF and am enjoying it now!
I would have waited for a Kindle version, but honestly I prefer to pay more for an open format like PDF, so I did.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Thmileys make lithp talk thrange.
Free Martian Whores!
The great thing about learning Lisp as a first language is the lack of marketability, because it's to about setting you up on a path, it's about giving you fundamentals.
As noted there is enough syntactic sugar now to not cause the kinds of rough work that used to be around, and I think the brevity of the language can be good for people in that there's not a ton of syntax to learn to actually get something real built.
Once you have programmed in at least two languages, you have a much better idea of what you are doing I think. So given that you'll learn some "practical" language to do something, let Lisp be that "other language".
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Perhaps it speaks to the fact that its not very well taught. I've looked at learning LISP but just couldn't understand Abelson and Sussman.
Coder's Stone: The programming language quick ref for iPad
It took you so much effort to type that, when you could have simply clicked on the provided link? No wonder you're AC.
I'm waiting for Lisp# to use as my asp.net codebehind.
Politics is the art of looking for trouble, finding it everywhere, diagnosing it incorrectly and applying the wrong fix.
I don't completely agree. A true beginner doesn't really need to understand how to structure a large program, which is what the modern principles are for. The first goal should be to write "linear" programs of the input-process-output model, learn the basic control structures and operators, and how to debug. From that foundation, you could go one way and learn how things work "under the hood" and try C or even assembly, or the other direction to learn how to build large programs (such as OO, patterns, etc).
Thus, I actually think BASIC (not line-numbered BASIC, the modernized ones) sweeps enough of both under the rug so that the beginner can concentrate on dealing with the code logic itself.
> No, I don't really know of lots of copy and paste style redundant code in my C or C++
If you are using C or C++, I guarantee that you do have large amounts of code duplication.
Really. I guarantee it, absolutely, with no doubt possible.
You may not see it, because you are so used to it that you think that's "just how things are". You are blind to certain things because you know them like the back of your hand. But that doesn't mean it doesn't exist. You DO have code duplication in your C++ program. The language for all practical purposes does not allow you not to.
Further, there are things which are not code duplication, but could be expressed in a far shorter way if you had higher level language features than you have in C/C++.
She runs Alice's Restaurant in Stockbridge, MA, of course.
I am officially gone from
What, like for loops? Variable assignments? Could you give an example of code duplication common in C code that would not occur in Lisp?
I read the internet for the articles.
It's a joke, don't get your panties in a bunch.
Security is mostly a superstition... Avoiding danger is no safer in the long run than outright exposure. - Helen Keller
*obsessively tallies and double checks to make sure he closed all his parentheses before hitting submit*
If you're using a good editor, you just need to hold shift-zero until it starts getting angry. At least that's how I usually ended up finishing off programs.
(What (is (so (complicated (about (LISP's (syntax( ? )))))))))
There's no -1 for "I don't get it."
...which is why Clojure (by providing tools to interoperate with its host VM's class system and providing its own collections framework -- the latter tightly integrated with the language and supporting copy-on-write support to ease functional programming with immutable objects) has the potential to pull LISP into widespread, real-world use.
I've actually had a (Fortune 50) employer put Clojure to use for a tool parsing an extremely high-volume data feed in near-real-time; the project was a roaring success, and the choice of tools was no small factor.
i STILL eat lasers ....
Read radical news here
You mean like you repeating yourself every other sentence?
Anonymous Cowards suck.
I disagree, LISP is fine for beginners. I mean an entire OS, emacs, is written in LISP; too bad it doesn't come with a good editor...
Seriously, guys, who in their right mind believes there have been no major advances in programming languages since Lisp?
Oh, I'll admit that 99.9% of the supposed "advances" have been horseshit...
Seastead this.
Yes, you would. Objects are meant to solve a problem, and simply get in the way until and unless you run into that problem. Of course, the same goes for structured programming...
Does it also teach them why OO programming is used? Because if it doesn't, it'll produce plenty of fodder for TheDailyWTF...
Forget magic. Any technology distinguishable from divine power is insufficiently advanced.
This. Who cares if it's quick and easy to write if no-one else can debug/modify the code? If it's a small enough project, in an ideal world, where one Grand Wizard passes down his arcane secrets to his apprentice before retiring, then it would be A-OK. However the world doesn't work like that. More "simplistic" languages remove ambiguity and make it easier for maintenance programmers to pick up where the last guy left off.
Basically, the stuff that you would reasonably use templates for in C++ can only be done with a bunch of duplicated code in C. Even in the C Standard Library (created by people who obviously know C very well), you see many very similar functions named with a suffix noting the data type that it takes or returns. They likely all have very similar implementations as well.
Amen. It changes the way you think of computers. All other languages flail before the almighty Lisp.
Infuriate left and right
I heard Eve knows them both, but they don't know she even exists.
Infuriate left and right
“Invent Your Own Computer Games with Python”
This is very interesting, I wish I had modpoints :-(
I'm a minority race. Save your vitriol for white people.
The premise that modern computers don't provide a language as accessible as BASIC seems questionable.
Modern languages don't have IO interface comparable to decent line-number BASIC. I'm talking about commands and functions like these in gwbasic: screen, locate, print, p(re)set, line, input, inkey$, sound, timer.
And no complex concepts like functions (introducing identifier scopes and things like that).
And goto! Let's not forget goto, the ultimate tool for adjusting the complexity of the program approximately by a factor of (number of gotos/10)^10, as compared to an equal structured program.
That translates to really trivial simple demo programs and games. No setup needed, no worrying about screen resolutions or character encodings or locales or libraries or... anything.
Yes, some of the concepts were transferrable to more modern, practical languages, but so were the concepts in BASIC.
Lisp goes way, way beyond just if statements and functions though, helping you to think about program STRUCTURE in ways that are applicable to any modern programming language.
I also learned LOGO and Basic, they were just as you said - LISP really does, as the foreward of the book says, fundamentally change the way you approach programming (and for the better).
"There is more worth loving than we have strength to love." - Brian Jay Stanley
In fact I held back a bit when I noted I downloaded the PDF before, for at the same time I had downloaded the ePub version as well!
Using both in iBooks on an iPhone, the ePub is much nicer to read as it does a better job typesetting. I'll have to see if there's some way to load it into the Kindle software reader as well to compare... the PDF version also works in iBooks, but is not nearly as nice to read.
O'Reily is a nice place to buy this, as not only can you download the totally open PDF and ePub versions, they guarantee you can re-download them forever from your account in case you lose track of them.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Metaprogramming does not have to be obtuse, it just happens to be implemented that way in C++; in Lisp it seems to be a natural fit but only after you get a feel for how Lisp code should look, feel and behave.
A successful API design takes a mixture of software design and pedagogy.
Ahh that takes me back to my Oktoberfest days :)
...programming language in the end are covered at http://occupyfun.com/jokes/joke.php?title=Wittle-Wabbit ;-)
!this.
I'm working on a java project now. It will run on a jvm, that will run on a virtualised system, that will run on a cluster. The levels of indirection between actual code and hardware is mind-boggling, and I don't even get the abstraction of common lisp.
This "simplistic language" project needs maven to pull in the libraries (hence no reproducability or repeatability), for a framework (that does message passing) that runs in a framework (that does network and protocol comms), that runs on the jvm, that runs on the virtualised machine, that runs on the cluster. The application uses XML for it's run-time configuration (because that's how the framework and the other framework is configured), and numerous pom.xml files to build (because the frameworks use it).
A simple message-passing system that does nothing but run hooks for the various types of messages it may receive has had me scratching my head for the last week, as *something* has changed (not the code, thank god for svn) in all of this that has introduced a bug.
Fuck it - gimme lisp any day of the week - these simplistic languages need a hairy amount of complexity from the programmers end to simply work properly.
I'm a minority race. Save your vitriol for white people.
First, Lisp is not an acronym.
Funny, I thought that that's exactly what "LISt Processing" was.
You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
> Sure, but they don't give you the visual feedback programming did "back then".
Don't they? Explain visual feedback programming differences between running python on today's macs with running basic on, say, the Apple II of old.
Consider this GW Basic one-liner (draws a "rainbow hour glass" that fills the screen):
screen 7:for x=0 to 320:color x/4 mod 15+1:line (x,0)-(320-x,200):next
I think that's the kind of visual feedback that was meant.
Oh, and I'd be very interested in seeing how long Python program is needed. Can't be very many lines with something like pygame, can it?
(Google for gwbasic if you want to find an interpreter which can run that, for Windows. I'm almost certain "aptitude search gwbasic" or equal would give suitable package in Linux.)
You don't have to look far.
Anything related to string handling, with multiple and recurring strlen()s, strcpy()s, strdup()s, etc. I'm porting an originally Xlib/Xt-based C project to Qt / C++ and anything string-related shrinks in size like crazy. Other things shrink too once you use what you got with C++/Qt.
Anything related to data lifetime: C only handles PODs and POD elements in structs. And those don't need anything special: by default, they don't get initialized, and destroying them implies just releasing the memory occupied by them. Everything else? You have to manually call initialization, copying, and destruction functions -- you have to write those even if you merely aggregate data types exposed by library APIs. You forget something and you deal with uninitialized data or memory leaks. C++ takes care of all that. Case in point: in C++ a struct containing a public std::string is safe to use and doesn't require any extra code, compiler writes it all for you. In C, you have to at least call free() on the string pointer before you call free() on the struct pointer.
There are plenty of semi-standard (glib) and roll-your own (look around) approaches to type hierarchies in C. They all involve slapping a type field into a structure, and plenty of typecasts. Not only downcasts, but also upcasts (casts to a parent type)! In C++, you get dynamic_cast for every instance of a polymorphic class, upcasts are automatic, and typeid() lets you determine the actual type of said instance.
C containers cannot be, by definition, type-safe unless you duplicate code. And even if you're OK with duplication costs of type safety, there is plenty of manual construction-and-deletion necessary everywhere.
In short, even C++ gives you solid benefits in type safety, expressiveness and productivity over C, never mind LISP.
A successful API design takes a mixture of software design and pedagogy.
Python respects the visual limitations of humans
It does exactly the opposite, unless humans can evolve to literally "see" whitespace characters.
The zen-like empty indentation technique drove me mad when I had to maintain some python software. It reminded me for exactly the thing I hated most about the little Fortran I had done in school, the punch-card like need for rigid character placement in something that was, to my mind, meant to be a totally logical construct.
As another poster noted, Python mixes presentation with content and that makes it really awful to do refactoring, or for tools to be able to offer you meaningful help in reformatting. A code reformatter can take a mess of code differently indented and make it correct according to your preferred spacing. It can also take pasted code and place it at exactly the right level of indentation. What is a code formatter to do when you try to paste code directly after an indented line of python? Any guess can be wrong, and all it CAN do is guess.
I actually like the language otherwise, I like the constructs, but the whitespace thing makes it basically unusable for me in practice. At this point if I want to learn a nice alternative and powerful language, I'm going for Erlang.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Hahaha, I knew someone would make that comment! But it really is called "why's (poignant) guide to ruby" and not "why's poignant guide to ruby."
Nicely done.
"No matter where you go, there you probably are." -- Buckaroo Heisenberg
I'm the reviewer, so I can probably explain how this happens.
I started out writing posts on my blog about old obscure distributed systems and programming books that I thought deserved more attention. Then I got a copy of Masterminds of Programming for giving a lightning talk at a conference (International Lisp Conference 2007; O'Reilly were giving out books to lightning talkers), and decided to write a review on my blog (it's an interesting book).
A few months later, Peter Seibel's Coders at Work was about to come out, and Peter noticed that I had written about Masterminds and decided that I would be interested in a preview copy of Coders at Work (which I was). Then he mentioned that I should consider writing a review for Coders at Work on Slashdot instead of my blog, and I liked the suggestion, so I wrote a review (it is a good book). Peter says it helped the book's sales a lot.
I heard about Land of Lisp from the O'Reilly media relations mailing list (I'm on the list because I'm the O'Reilly User Groups program contact for the Montreal JavaScript user's group; they give us discounts and freebies). The media relations list is basically O'Reilly spamming you with descriptions of upcoming titles - if you think something is interesting, you ask them to send you a review copy. Actually, I had heard about Land of Lisp a long time ago (the book was originally supposed to come out in 2007), but forgot about it in the meantime. If it wasn't for the O'Reilly mailing list, I wouldn't have heard about the book until after it had come out (and then only because I'm very involved in the Lisp community).
So the lesson here is you should look for someone interested in the book's subject who has written about other books before, offer to send them a review copy, and suggest they write a review for Slashdot. It helps to stroke their egos ("I really like your writing, would you like a super-special advanced exclusive preview copy for super-smart special people? The proles won't get to see this for another two months!")
Obviously blogs are the best places to find these people; look at blog aggregators on whatever subjects your book is about (for example, the Lisp-related postings on my blog are syndicated on Planet Lisp and Russian Lisp Planet).
O'Reilly has by far the best book promotion efforts of any technical publisher (media relations mailing list, user's group program, and an extremely active presence at conferences), but it's actually not very effective compared to being part of whatever community your book is about, and simply informing community members of your book's existence. Conrad does pretty well in this respect. I'm sure if I hadn't written a review of Land of Lisp for Slashdot, someone else would have.
>Sometimes people will add lots of copy and paste code to a codebase. We call these people bad programmers, and they tend to be fired.
I just finished very deliberately doing a copy-and-paste job on a service. Right now, these two services are extremely similar. But I know that they will be diverging in a significant way, and I have no interest in trying to do this with polymorphism or conditional logic. I realize this means that changes in one module will have to be tracked in the other, and that's a compromise I'm willing to make. The next person who touches this code will thank me, even if they think copy-and-paste programming is generally a bad idea.
Sometimes simplicity of a function is more important than re-use or versatility.
-fb Everything not expressly forbidden is now mandatory.
FYI for those with Safari Library subscriptions: this book is available there.
Common lisp has OO (defined as some macros). So in lisp, you can make it any kind of language you want. OO/ not-OO / whatever else you care to think of.No need to create a new language
To expose students to the different kind of thinking that comes with functional programming, I'd rather use Haskell or XSLT than Lisp.
I believe that functional programming is finding new relevance in applications for distributed processing. If I were putting together a comparative languages course, I'm pretty sure it would have at least one assignment where everyone has to come up with a job that is appropriate for map/reduce.
For Object Oriented programming in particular, I'd actually lean toward Ruby. I'd assume that everybody (in a 300-400 level languages course) knows C++, C# and Java, but probably not Ruby. And by Ruby, I mean Ruby, not Rails.
-fb Everything not expressly forbidden is now mandatory.
"Lost In Stupid Parentheses."
Oddly enough what I hate about LISP (Language to Induce Stress in Programmer) was the parens but it wasn't because there was so many of them. It was because you had to have exactly the right number. One set too many or too few and your program crashed. Drove me up the figurative wall. (That and that whole thing not using the damn return key to break up things onto multiple lines. What's wrong, does your keyboard give you 50,000 volt shock if you hit the return key? Oh well, now I know why my teachers in grade school complained about my run on sentences. They were like LISP, hard to read because each would just go on and on.)
Did you know 80 to 90% of the moderators on slashdot wouldn't recognize a troll even if one dragged them under a bridge.
I'm sure that I spent more hours playing Super Star Trek than I have all other games put together. I've ascended three races in Nethack and have 4 level 80 WoW characters, and I still think the trek game wins the time sink award. I still play a version of it, pretty often. Modding this game taught me a lot (but a lot of wrong things too) about programming.
-fb Everything not expressly forbidden is now mandatory.
(sorry)
I could have sworn that there is a book out there that teach python programming with a primary focus on game creation.
And the python interpreter have a interactive mode.
comment first, facts later. http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm
If you can't do it in C and Lisp, it can't be done.
If a student needs to learn to program, object oriented stuff isn't the first thing they should see. Please for all that is holy, teach them structured programming, algorithms, and data structures first.
That's the most bonkers thing I've ever read.
What, like for loops?
For loops are a perfect example. Why the hell do all these programming languages force me to write the same damn patterns over and over, like, say, reducing a sequence of values:
How many million times have you written a loop that follows this pattern? What about this one:
Looks familiar, right? C-style languages all but force you to constantly spell out how to iterate over the elements of a collection or sequence and combine their values; the only ways to abstract it are way more verbose than this (e.g., iterator classes, Visitor pattern), or are subject to additional problems (function pointers in C aren't anonymous, and are not lexically scoped).
The first of those examples should just be reduce(function, initial_value, collection). The second is map(function, collection). These functions allow you to write code that's shorter, because you don't need to write the same damn canned for loop pattern over and over.
In addition, there's a more important, subtler benefit, that comes down to this:
This means that, for example, when you see map being used, you know automatically that the result is a collection of the same size as the input, where the value of each element of the output collection depends only on the element of the input in the corresponding location; i.e., map has predictable invariants that help you reason about the code. When you see a for loop with a complicated body, on the other hand, you have to read the damn thing, often very carefully, to figure out what the hell is going on.
Here's some Python, that will work in Python 3.1 (which is the most consistent for educational purposes, in my opinion). No external libraries required - all the standard distributions of Python 3.1 include turtle graphics.
from turtle import *
tracer(10, 0) # speeds up display - turtles can be slow!
for x in range(-160, 160):
color(x / 320 % 1, x / 160 % 1, x / 100 % 1)
penup()
goto(-x, -100)
pendown()
goto(x, 100)
More fun, in my opinion, are recursive functions:
from turtle import *
delay(0)
def tree(length): .6) .6)
if length 1:
fd(length)
bk(length)
else:
fd(length)
lt(20)
tree(length *
rt(60)
tree(length *
lt(40)
bk(length)
lt(90)
tree(50)
> Alice teaches much more modern object-oriented principles that would be much more useful than BASIC or LISP to a > modern programming student object-oriented principles such as what? You cannot seriously put BASIC and Lisp into one sentence. Have you even looked at the object system of Common Lisp (CLOS) ? It is quit a bit more powerful than Alice/Java OOP. Please provide a list of object-oriented principles that Alice teaches that Lisp would not.
Well, first there was a ZX81 where you were plotting very large pixels onto a screen.
Around the same time I was also using basic on a TRS-80, and Apple II - also which were plotting some pixels, or plotting characters to positions on screens.
Yeah you have curses kinds of abilities in a terminal now, but come on - to a modern kid that is going to look like nothing, and to do even simple text plotting is too hard to get started (and as I noted not really very interesting to a modern kid).
Not to mention explaining the whitespace indentation to a 10-year old is an experience with a desirability I'd put way below having talks about how sex worked.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
I can't tell you how many times I wish I could add a bit of syntactic sugar to replace an awkward construct built to work around Python's no-sharp-edges syntax. LISP-style macros may be abusable, but they're also beautiful, beautiful things./quote
It's a pleasure to write neat, concise code with no repetitions using Lisp macros.
It's also a nightmare to read, especially when dealing with a new and unfamiliar codebase, because you first have to figure out what all the macros mean (and which parts of syntax are macros). Yes, it's not fundamentally different from any other kind of code reuse (functions, generics), but macros, due to their flexibility, require much more attention in practice.
Funny. To date, Common Lisp still has the most powerful and feature-complete OOP system ever designed in a programming language.
You could make the same arguments for immediacy and ease of installation for Perl or tens of other freely available modern PC languages. And they don't have LISP's nightmarish tangle of parentheses. LISP rivals APL for the 'language handicapped by its notation' award, and at least APL looks cool. Interesting to see btw that the Trek variant in that Atari book is actually called Star Trek, and that they went to the trouble of begging Paramount for permission to use the name.
Two comments about the summary:
Programming today is easier than programming in the 80s, if you pick the right language. BASIC wasn't that easy -- although at least on most computers there was no installation step.
Most people who typed in games from magazines weren't doing it to learn -- they wanted to play the game, and printing the BASIC code on paper was more cost effective for the publishers than gluing a cassette to the magazine. Typically there would be no comments, no discussion of the techniques use, and towards the end of this practice's lifetime, it wasn't unusual for the program to be a small piece of BASIC for poking integers into memory, followed by several A4 pages of hex characters; the machine code for the game.
I wouldn't recommend BASIC or LISP for someone wanting to learn modern object-oriented programming today. A lot of us started out with a structured languages like this, but you wouldn't want to start out that way if you were doing it for the first time now. My university uses Alice and it works pretty well. Alice teaches much more modern object-oriented principles that would be much more useful than BASIC or LISP to a modern programming student.
What a horrendous idea. If the whole goal is to learn more OO principles, that's a f* up goal by itself. Not everything is OO; reality is multi-paradigm; and beyond a certain granularity OO code is intrinsically tied to modular, structural and procedural principles. Barring the naturally gifted, people can't learn proper OO skills (much less general analysis and design skills) without knowing modular, procedural and structured programming.
One of the greatest failures of CS education has been the failure to teach that, the fallacy that you can simply use nothing but one or two OO languages and a 100% OO paradigm as a general plan for teaching programming. Testament of this is that, even after 3 decades, people still can't tell you precisely what a good OO system is like. One just have to look at the OO code base that is out there. Truly hideous and anything but OO.
A good chunk of people think they are doing OO when in reality they are using OO languages to implement poorly written procedural code (typically without any notion of structural soundness or modularity.)
In fact, a lot of what the world needs right now combines/requires procedural programming. RDBM access is strictly procedural/declarative - and don't bring the fallacy of ORMs. People can't effectively use ORMs without knowing the procedural/declarative interfaces that lie underneath it. Services are intrinsically procedural and so are the languages that interface/combine them (think BPEL.)
When people miss that and are confronted with the *real* multi-paradigm world, they either try to force a OO paradigm on the procedural interfaces/services, or the service-accessing code devolves into an in-cohesive, inflexible procedural lasagna.
I've been doing OO development for quite a while now, quite successfully if I may add, and I've worked in teams that have made the transition (quite successfully also) from procedural/modular to OO programming. From experience I can tell you most CS students cannot fully understand (or fail to understand) OO principles without understanding procedural, structural and modular principles (and spending a lot of credit hours in them.)
We need people that are exposed to the nitty gritty details of multi-paradigm realities of world problems, not pampered from the beginning with graphical systems intended to show... yay... more OO principles. You want to teach people more OO principles? Then lay a solid multi-paradigm foundation with plenty of credit hours in several programming languages, getting them to deal with issues of structure, modularity, procedures and the like.
Kids that get exposed to those will get much more mileage from OO education, and equally useful, that exposure will filter those who really can't cut it for CS because not everyone is cut for it (and this applies for any degree and people trying to get in them.)
Thanks for that helpful interjection Mr Turing.
Want an apple?
That's the most bonkers thing I've ever read.
Not really, it actually closely resembles practical things that need to be done in many large scale systems written in procedural languages. People have been doing a lot of (mostly) good things to implement re-use and modularity in procedural languages for a long time (just as there are plenty of strategic/tactical reasons to use a procedural programming language over an object oriented one.)
Furthermore, reading that gives the novice reader a glimpse at how things occur under the hood. At the end of the day, OO is syntactic sugar use for the sake of modularity and structural soundness. It eventually has to be implemented on a procedural manner (even if it is invisible to your eyes thanks to the compiler.)
> *obsessively tallies and double checks to make sure he closed all his parentheses before hitting submit*
You can just use a single right square bracket to close all your current lparens.
Do daemons dream of electric sleep()?
Once you have programmed in at least two languages, you have a much better idea of what you are doing I think. So given that you'll learn some "practical" language to do something, let Lisp be that "other language".
I concur, and would add that being proficient with five languages is not too high a bar to set for a professional developer. (Not a world-leading expert, but able to Write Good Code(tm))
Heck, I know C, C++, python and shell scripting *very* well (IMNSHO); haskell, java and scala decently; scheme, elisp and SML/NJ somewhat; javascript, C# and perl superficially, [...].
But then again, scheme and javascript are basically the same language, and python is a funky dialect of it with elisp being a close cousin. C++, java and C# are becoming more and more similar (there's a language conceptual overlap, aneehoo), C is a subset of C++, ML ~= Haskell. As you might see, ten languages is a lot easier to learn than ten times the difficulty of learning the first language.
(Sorry if I come off as bragging; I don't mean to, I'm just using myself as an example, and I don't think I'm a crazy-ass whiz kid)
That’s not LOGO, it’s Python. LOGO syntax doesn’t use parentheses.
Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
Modern languages don't have IO interface comparable to decent line-number BASIC. I'm talking about commands and functions like these in gwbasic: screen, locate, print, p(re)set, line, input, inkey$, sound, timer.
Yeah, that was what really turned me off C back when I was first trying to write simple programs. None of the C books told how to do “simple” stuff like the equivalent of LOCATE, COLOR, CLS, SOUND... they were all focused on learning to program (write algorithms). I knew how to write an algorithm already.
Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
No, it really is bonkers. I can understand wanting to know how the compiler implements objects and inheritance and what-not - although in the end it's somewhat compiler dependent.
One might as well argue that C is merely syntactic sugar for assembler - which would be true, but rather misses the point. Syntactic sugar does more than help the medicine go down, so to speak, it frees the mind from the mundane details and allows one to concentrate on more important things. Like program structure and so-on.
Why one would want to use the ideas in that paper to write an actual computer program is utterly beyond me.
Parent is right, marketing gotta take the heat too.
I know tobacco is bad for you, so I smoke weed with crack.
Balkanization?
I know tobacco is bad for you, so I smoke weed with crack.
Balkanize
–verb (used with object), -ized, -izing.
1. to divide (a country, territory, etc.) into small, quarrelsome, ineffectual states.
2. ( often lowercase ) to divide (groups, areas, etc.) into contending and usually ineffectual factions: a movement to balkanize minority voters.
Can someone who would prefer to learn the Clojure flavor of Lisp be able to adapt the book's explanations and code?
= 9J =
Viper mode disagrees with you.
I know tobacco is bad for you, so I smoke weed with crack.
And these days, it isn't so necessary with the various bridges that exist between good scripting languages (Python and Ruby) and both Cocoa and OSA - namely, PyObjC, MacRuby, RubyOSA etc. - and plenty of command-line interfaces to various bits of the OS. Indeed, if you use an OSA bridge in Ruby, you have a much more powerful way AppleScript because you can combine code from the Ruby stdlib, Unix command line tools, abstracted C libraries (and inlined C) and the AppleScript interfaces. If you want to use a Java library, you wrap the OSA bridge stuff in a class and FFI out to it from JRuby. You get so much more, and you get to write it in a syntax that doesn't drive you completely batshit insane.
You also get a much better development experience: irb or ipython plus your favourite editor (vim, emacs, textmate etc.) beats the pants off the damn AppleScript script editor. Who in their right mind thought that not being able to save a file unless it compiled was a sensible idea? With irb, you can interactively examine your objects. Bash lines into the shell and see what happens. Much more useful than Script Editor which basically gives you an edit-compile-run cycle.
AppleScript is one of those things I wish Apple would replace. Now they are pursuing App Stores and iOS though, I don't hold out much hope that they'll deprecate AppleScript and encourage people to use Ruby instead. The idea that normal people are going to suddenly learn AppleScript because it has a "friendly" syntax is laughable.
catch (HumourFailureException e) { e.user.send("You, sir, are a humourless idiot."); }
Lots of Irritating Stupid Parentheses?