Scheme: for-each Redundancy

I use Fish as my command-line shell. But when I feel the need to write a shell script these days I use Scheme, via scsh. It has been a while since I’ve written Scheme (or any Lisp) on a regular basis, and so I find myself typing down some dumb, novice mistakes. And tonight I want to share one.

Spot the Problem

Here is a piece of a script I use to update certain software, namely fetching updates from repositories and compiling them. See if you notice the problem:

 (lambda (dir)
   (update-git-sub-directories dir))

See the issue? Keep in mind that for-each calls a given function (here an anonymous function) for each element of a list. Think about that until you see the facepalm-quality redundancy.


Add Your Thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s