On 1/5/2011 10:58 PM, Seth wrote:
Now that i think of it, it is mostly a fear of having decreased productivity in writing code that affected my statement that i liked the little files. Im used to, i suppose, developing code for a specific function in a file, being able to compile, goto line numbers where there are errors,
Try inserting a syntax error anywhere in the code. Then type 'make' to the shell. You'll get a traceback that shows you the exact line in the file that failed since the literate document is really feeding Java files to the compiler. This is forced by Java since there is a (bogus) connection between filename and contents. In any case, you still get the same traceback you always got.
send code to slime, etc. Looking over your example made things much clearer. Its like your guiding your reader to specific parts of the 'little files', describing the theory behind them, moving on, etc. And each code fragment has a chunk name associated with it, and all of them are combined into the final .clj file using the code fragment names (in a separate chunk).
The REPL makes it much easier to develop lisp code in a literate style because you can kill/yank an s-expression into a shell buffer (or use slime). My usual method of working is to build and test a function in the REPL. Once it works I have the source already in the file so I can just save it, build the whole system, run the tests, and make sure I didn't break anything (it takes less than a minute).
At first, i thought this would be less productive than simply putting all of the code in one clj file, but now that i think about it i think it would, with the appropriate tools. And it wouldn't even be too difficult, with org-mode (prefer it over latex any day!)
You see all of the source as one file. The compiler sees all of the source in little files. The beauty of literate programming is that you no longer have to pay attention to the compiler's failings.
Im going to start transferring a subsection of my program to literate programming, using org-mode. See how it goes... Oh, and Tim, you might want to take a closer look at org-mode. Instead of having to tangle out the code that builds everything, you could create an executable shell script block in org-mode - the makefile script could be tangled into a string using noweb syntax, and then everything could go from there. You can execute the block by hitting C- c c-c in the org file (or something like that). Pretty cool, in my opinion!
I used noweb (ref: Norman Ramsey) for years in Axiom. It is a useful tool. However I finally understood that I can get rid of the 'weave' function with a couple latex macros I wrote (see a prior post) and I could get rid of the 'tangle' function by modifying the reader. I patched lisp and build tangle directly into the image. Thus, with some simple changes I no longer need any special tools. That makes life simple and I like simple. Org-mode sounds great and from what I've seen from the docs it does everything but cook rice. I would highly recommend it as a tool if you like that sort of thing. It would integrate well in a slime environment if you like that sort of thing. ANYTHING that helps you write literate programs is a win in my book. I'm afraid that I have two personal failing that make org-mode unlikely. I don't like modes (My emacs mode table is smashed to be fundamental mode for everything). Editors should not change my source code. Thus, org-mode is "right-out", to quote Monty Python. Second, I'm addicted to Latex. Latex is an amazing program, simply stunning. I cannot imagine trying to write Clojure in Small Pieces without it. It is just a markup language like HTML and thus not hard to learn but it is also a turing complete language that has a huge ecosystem of tools and techniques. I am creating the graphics for CISP at the moment in Latex. I could do it using some other tool such as gimp but life would not be as simple and the clojure.pamphlet file would now need image files (more 'little files' cruft). But whatever works for you is great. Please post an example of a literate document using org-mode. We can then compare and contrast, as my English teacher used to say. It would be interesting to see another example of a literate document for Clojure. Slime and org-mode may be the proper way to go. Tim Daly -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
