Remove .svn files recursively

Today I needed to convert a Subversion working copy (aka a checkout) into an export. Recursively blowing away all of the .svn directories in DOS (Windows XP) didn’t seem to be straightforward so I ended up using UNIX find in cygwin. Here is the command:

find . -type d -name '.svn' -exec rm -rf {} \;

The command was provided here, and the following is documentation from the man page.

  • find :: Execute the find command
  • . :: Path in which to start
  • -type d :: File is of type ’d’, a directory.
  • -name ’.svn’ :: The file name on which to match, .svn.
  • -exec rm -rf {} \; :: Execute this command for every file that is found. The string ’{}’ is replaced by the current file name being processed. The semi-colon is escaped by a backslash. While reading the man page, I also found that you probably should enclose the braces in single quote marks.

HtDP: Problem 9.5.5

In problem 9.5.5, I knew I wasn’t understanding something. I thought that I had followed the recipe, yet I couldn’t solve the problem. That alone was a red flag indicating that I most probably did not follow the recipe!
In this discussion everyone helped me to see what I was missing. The thing was that I was missing something about recursion, the fact that you can figure out what you need to do by combining this thing with the rest of the things.
To specific, the step that I had skipped was literally taking the expected data and using that to determine the combination that needs to occur within the program body. Before, my approach had always been to solve “the whole problem” at once for the recursive step. Following the recipe, you can much more easily see what you are missing.

HtDP: Problem 10.1.9

In problem 10.1.9, I wanted to force a problem to be recursive when it really wasn’t. Matthias and Carl helped me see the difference here in the discussion that followed. Here are some notes:
Matthias:

In HtDP, the word “natural” is a technical word. It means
if your INPUT data definition has a self-reference in the Nth clause for the Kth field then your template has a recursion in the Nth cond clause for the Kth field.
Try this:
An RD is one of:
— ‘doll
— (cons RD empty)
Problem: design a function that counts the number of cons layers around ‘doll.

Carl:

what’s so recursion about it? To be less cryptic, if you read your purpose statement, and apply it to the recursive call, does it make sense? Are you really solving a smaller instance of the same problem, or are you just solving a smaller problem? The former is recursion; the latter is not (and suggests either inlining or a helper function).
For future reference, what I described is a way to tell after the fact whether what you wrote makes sense as recursion, but what Matthias described is the part of the design recipe that tells you whether to use it or not before you even start. Focus on what he said (and what’s in the book) for figuring out how to apply recursion, and you’ll find you can always answer what I asked with “yes”.

The essence of form abstraction

Formlets:

Abstraction is the cornerstone of high-level programming; HTML forms are the principal medium of web interaction. However, most web programming environments do not support abstraction of form com- ponents, leading to a lack of compositionality. Using a semantics based on idioms, we show how to support compositional form construction and give a convenient syntax.

Formlets are now also part of the PLT Web Server.
(via PLT)

Packed Binary Routines for PLT Scheme

Per Doug’s post:

I have implemented an equivalent of the Python pack/unpack functions in PLT Scheme. I needed it primarily to be able to (more easily) read binary data from other applications for analysis in PLT Scheme.

Here is what it does:

This module performs conversions between PLT Scheme values and C structs represented as PLT Scheme byte strings. It uses format strings (explained below) as compact descriptions of the layout of the C structs and the intended conversion to/from PLT Scheme values. This can be used in handling binary data stored in files or from network connections, among other sources.

Comment Boxes

Originally posted here:

In DrScheme you can comment out code either using semicolons or by using a “box”.
The way that it works is that you:
1. Select the code you want to put in a comment box.
2. Go to the Scheme menu and select Comment Out With a Box.
You may find this particularly useful when you get to the structure template definitions in chapter 6. It makes them much nicer to write, read, and maintain.