Brad Lucas

Programming, Clojure and other interests

Countries without the letter 'A' in their name

March 23, 2015

The problem. Find all the countries in the world without an ‘A’ in their name.

  1. Find a list of the world’s countries. [
  2. Cut/paste the list to a file. countries.txt
  3. Note the file is a list of numbers and names. Need to remove the numbers and filter out the ones without ‘A’s.
     def remove_country_line_numbers():
        return [l.strip() for l in  open('countries.txt').readlines() \
                     if not l.strip().isdigit() and l.lower().find('a')==-1]


In [81]: ", ".join(remove_country_line_numbers())
Out[81]: "Belgium, Belize, Benin, Brunei, Burundi, Chile, Comoros, Congo, 
Republic of the, Cote d'Ivoire, Cyprus, Czech Republic, Djibouti, Egypt,
 Fiji, Greece, Guernsey, Hong Kong, Jersey, Lesotho, Liechtenstein, Luxembourg, 
Mexico, Morocco, Niger, Niue, Peru, Philippines, Puerto Rico, Reunion, Seychelles, 
Sweden, Timor-Leste, Togo, Turkey, United Kingdom, Yemen"

Continue reading →


April 22, 2013


Continue reading →


November 6, 2012

Getting back to things and have updated my personal page at

It is a simple page with six thumbnails using Twitter Bootstrap ( What made it nice is that it is responsive so it works well on any device.

Continue reading →

Building Command Line Applications With Clojure

March 9, 2012

To be able to package your Clojure application as a single jar and to run it from a script or the command line is a very handy thing. At first it might not be all that apparent how to do this if you are staring to learn Clojure and are happily hacking away in the Repl or evaluating code from Emacs using Slime. But, it is possible and very easy to do. You'll need to be using Leiningen so at this point I'll assume you are.

Java and One-JAR

Back in the day when you wanted to deliver your Java application you had to collect all the dependent Jar files and your own Jar or class files and then come up with a script to kick the whole thing off. You had to make sure things were all in the right place and your Classpath was correct.

Continue reading →

Loading Data With Clojure

March 4, 2012

If you are coming to Clojure from Java you are probably familiar with JDBC. If not do a bit of research and you'll find that it is a layer that allows you to program against a database agnostic layer that communicates to your database through a database specific library. In the following example we'll use the wrapper for JDBC-based access to databases. This library is not part of what you would automatically have when you just install Clojure. For use to use it we'll have to download it ourselves or use a build tool to do it for us. To keep things simple here I'll assume you are using Leiningen as a build tool. If not you can find on GitHub. Also, you will have to have a database. Here I'll assume MySQL and explain how to connect to that. The example we'll build here will be an enhancement to the stock quote downloader presented in Reading Files article. Instead of writing the quotes to a file we'll load them into a database. You might want to review the article before continuing.


Here we'll use MySQL but you could be using another. The only difference in the following will be the setting up of your database's JDBC library.

Install and Setup JDBC Driver

Continue reading →