2015-02-23 Tweets

A Small Bit of Clojure Enlightenment

I have started looking at Clojure. I think can handle concurrency well, I think functional programming will become more important, and I think all roads lead to Lisp.

I started out by looking at some of the short introductions and tutorials on the Clojure subreddit.

Lisp variants actually have less punctuation than other languages, yet they can still be a bit hard to get used to.

I had a bit of enlightenment about anonymous functions. I could not see where they would be used. One of the tutorials said you would use then when you need a function that you might use only once.

Then I noticed that the tutorials seemed to use them as arguments to the “collection functions”, like map, reduce, filter, remove, split-with. Those functions take a function and a collection as arguments. I noticed that those functions were a common place to use anonymous functions.

You’re welcome.

2015-02-09 Tweets

2015-01-26 Tweets

Issue With Groovy Validator

I am having some issues with the Groovy Validator project. Here is an email I sent to the Groovy user mailing list:

I am making some annotations to do validation on POGOs. The github project is here:


One of my annotations is @StringAnnotation, which has the properties minLength, maxLength and regEx. I also have annotations for ints, longs, floats and doubles.

I got them working with POGOs and POGOs that have the @Immutable annotation.

So far I have the annotations working for POGOs by calling a static method on a class called AnnotationProcessor, and the annotations are handled by @Immutable objects with AstImmutableConstructorTransform.



I decided I would like to process the individual annotations with their own processor, so I started with the @StringAnnotation.
The AST class is here:


There are a lot of println statements since I am trying to figure all of this stuff out.

The issue that I am having is that when I run some tests the StringAnnotationTransform does not seem to work. All the strings wind up null in my tests.
Here is the command I use:
gradle clean; gradle -Dtest.single=BookSequelTest test -info

Yet, when I try these in the Groovy console (which I run with “gradle console”) things work as expected.

Why does everything work in the console but not in tests? Any ideas?

2015-01-25 Update

I have a bit more free time on my hands these days.

I plan on getting more into Clojure soon. I might use it to build my mail server. Or I might try that with GPars first.

Before that, I will take another crack at Groovy Validator. I would like to get rid of the static class that processes the annotations for mutable objects. I have one way of processing them for immutable objects, and another for mutable. It should be the same to the end developer.