On Fri, Jan 2, 2009 at 4:38 PM, Randall R Schulz <rsch...@sonic.net> wrote: > > On Friday 02 January 2009 14:23, Christian Vest Hansen wrote: >> What is it that makes this code "literate"? > > I don't know whether or not you're familiar with the concept of Literate > Programming. If you are, then you can judge for yourself whether that > code qualifies as literate. If not, check out some of these references: > > - <http://www-cs-faculty.stanford.edu/~knuth/lp.html> > - <http://en.wikipedia.org/wiki/Literate_programming> > - <http://www.literateprogramming.com/> > - <http://www.literateprogramming.com/knuthweb.pdf> > - <http://vasc.ri.cmu.edu/old_help/Programming/Literate/literate.html> > > Many more are out there.
Thanks Randall! Clearly what I'm doing doesn't fit the definition of literate programming. Maybe I can claim that it's "literate style" based on this part of the definition: "The main idea is to treat a program as a piece of literature, addressed to human beings rather than to a computer." What I'm trying to do is break the code up into a number of helper functions so the the functions that use them are easier to read. For example, here's a snippet of my code (including a questionable use of def that will be changed soon): (if (snake :alive) (if (adjacent-or-same-cell? (snake-head) (apple :cell)) (do (def apple (make-apple)) (move-snake true) (if (= (snake-length) *length-to-win*) (new-game "You win!"))) (move-snake false)) (new-game "You killed the snake!")) I should probably change the arguments to move-snake to be more meaningful. You get the idea though. What I'm trying to avoid is deeply nested function definitions with lots of long argument lists and anonymous functions. -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---