Monthly Archives: January 2011

A Closure in Clojure

Back when closures were first explained to me, a long time ago, I thought “sounds like a language with pass-by-reference semantics like Pascal.” Of course, it isn’t quite that simple.

Clojure has a lot of nice features that work naturally to give you a “better Java than Java”. Here’s an example of using a closure that is not at all easy in Java.

Continue reading

Getting enclojure 1.4 to work

I’ve used enclojure for a long time (in internet years). It has always seemed a bit finicky. However, with the 1.4 release and the switch to using Maven as the build tool, things stopped working. Projects that had worked fine before no longer compiled or executed. The “Getting Started” section of the enclojure web page appears to be hopelessly out of date and actually misleading. Here’s what I had to do.

Continue reading

Ideas for Simulated Evolution

Note: This is a re-post of an earlier entry recovered from a different blogging system.

After entering and running the evolution.lisp example from Land of Lisp, I have some ideas for additional traits.

Here is a short list of a few.

  1. Size, Carnivorous Animals. Add a feature to allow the animals to be of different sizes. Larger animals would expend energy faster. When two animals occupy, the same cell, the larger would try to eat the smaller, taking it’s energy. The smaller could try to flee. Chance of successful hunting/fleeing would be based on the size difference. For example, if the larger animal is only slightly larger, the smaller animal would have a pretty good chance of escaping. As the hunter gets larger, the chance of succeeding becomes larger.
  2. Speed. With a higher energy expenditure per turn, animals could move more than one cell at a time. Perhaps this would be a modifying factor in fleeing from hunters too.
  3. Sex. If two animals of the same size occupy the same cell and have enough energy between them, they could reproduce and shuffle their genetic material in the offspring. Number of offspring might be another variation depending on energy.
  4. Plant Toxicity. Immature plants would be poisonous. The animals would require some sense(s) to detect the maturity of a plant before eating it.
  5. Vision. One of the senses to detect plant maturity might be vision with variations in acuity at distance (to see plants further away) and color (for detecting plant maturity).

Of course, a nicer user interface would be a good thing too.

Why did emacs “stick” this time?

Note: This is a re-post of an earlier entry recovered from another blogging system.

After innumerable attempts and false starts, I am now using emacs on a regular basis. What is different about this latest effort?

It’s a bit of a puzzler, but after thinking about it a bit, here are a few things that might be different this time.

  1. Repeated Exposure. Maybe after all of the other attempts, I am finally “ready” to grasp emacs.;-)
  2. Lisp Cabinet. This time, I installed emacs using Lisp Cabinet and it “just worked”. There was not the usual configuration and setup hassle. And it supports several Lisps, Clojure, and Racket.
    The color scheme is nice. Indentation is automatic (in Lisp anyway). It is intended to work with Windows. It just seems easier to use.
  3. Land of Lisp. I started using emacs to work through the examples in Land of Lisp. The examples are long enough that they require actually learning some of the command keystrokes, but short enough that it doesn’t feel like a typing lesson.
    A few years ago I worked through Practical Common Lisp, but it didn’t stick. In fact, I referred back to the early part of PCL to recall some of the emac keystrokes I needed to enter the LoL stuff. I used (the no longer supported) Lisp-in-a-Box for a bit, but it didn’t stick. The Lispbox project has tried to take up the slack, but it didn’t work for me when I tried it and I went down the usual configuration rabbit hole without getting it to work as I wanted, then gave up. (Again.)

So, after years of starts and stops and unmeasurable amounts of frustration, I’m finally getting comfortable with emacs.

Drupal “HTTP request status” failed

Note: This is a re-post of a recovered post about a problem with Drupal. Just in case I ever go back.

After installing the BitNami Drupal stack, the system took forever to load pages. A check of the system status showed that the “HTTP request status” item was experiencing a failure.

This seemed to be related to the settings in the

windowssystem32driversetc

file. (To edit the file, you have to start notepad or wordpad as an administrator [right-click on the program name, select from menu], then open the file.)

At the end of the file, I added the single line:

127.0.0.1 david-pc

where “david-pc” is the name of my computer and since this is a self-hosted site running locally. That seemed to do it. Now things work just fine. (So far.)

Moving Old Posts

Since I’m going through the setup again, I thought I would start out with some older posts from other systems (the few that remain). Don’t pay much attention to the dates.

So, Dr. Clark. We meet again!

Well, here we are again. You, me, and WordPress. It seems like I go through this setup a lot. Over the years, I’ve tried other blogging platforms, and even toyed with the idea of creating one of my own for fun like one of my heroes, Brian Carper. But I just keep coming back here. Why do I ever leave?

There are really a couple of reasons. I do this a lot because of hardware and backup failures. At those times, since I’ve pretty much lost everything, I decide to give one of the other systems a try. And it usually goes ok for a while. But eventually, dissatisfaction creeps in. For example, my most recent foray was into Drupal. I really liked Drupal but was continually frustrated by problems with formatting source code. The crazy combination of editor plugins and highlighter plugins and all the version problems just got me fed up one day. So, here I am again.

Another reason is that WordPress just feels so comfortable to me now. I’m back again. Maybe I’ll stay. Maybe I’ll host this on a real web server with a backup routine that works.