Epistemology? We Don’t Need No Stinking Epistemology!

What is thought? We don’t really know. There are a lot of theories. There are a lot of assumptions. For instance, we assume that what we perceive with our senses have some grounding in an objective reality outside of ourselves. Further, we assume that there are other people, besides ourselves, that perceive the same objective reality with their senses.

But how does a network of electro-chemical reactions somehow emerge as the complex process that we label thinking. We can’t even agree upon what constitutes the base criteria for judging a process rational thought. In the past we chauvinistically maintained that only humans were capable of rational thought.

Recent experiments with animals from whales, through various primates, studies of dogs and cats, and even crows have demonstrated mental abilities that were once claimed as evidence of conscious intelligence and the exclusive domain of humans.

Alan Turing posed the functional test for intelligence. A person interrogates an entity through an electronic connection and asks them any questions that he likes. He then guesses whether he is talking with a person or a program solely on the basis of their answers. If the program consistently fools the interrogator, it is judged intelligent. By that measure, we have already produced programs that can pass the test.

And yet we still have no clear definition of intelligence and the program that occasionally passes the Turing test is only nominally intelligent. The lack of depth of its so called intelligence is eventually exposed.

So why am I asking these questions? I am trying to figure out why when I try to think, I just get frustrated but when I relax and go with the flow I write coherent, if not brilliant, blog posts. Is it a universal admonition to be here now? Is it evidence of something larger than ourselves? Or is it just a statistical expression of the fundamental laws of physics amortized over millennia of combination and recombination?

I guess I’ll climb out of my navel now. I really am interested in the answers to these questions. I’m not just asking them to seem like I think deep thoughts or anything like that. I think that coming to terms with some of the ramifications of such questions and their possible answers is part and parcel to becoming a good writer.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Epiphany: Types are Orthogonal to Functional Dispatch

Most people are most eloquent in their native tongue and the same seems to be true of programming languages. There are those polyglots that excel at any language they learn but it is often more true than funny what they say about  a good Fortran programmer being able to write Fortran in any language. Only in my case I would have to substitute C for Fortran.

Many years of study and coding in Java, Ruby, Python, Lisp, and various other languages has softened my C accent but it is there for those that know to look for it.

I think it can also be said that the first language in which you encounter a particular paradigm colors your attitude toward that paradigm. For instance, I first learned about object oriented programming in Java. Soon after I encountered it in CLOS, the object extension to Common Lisp. I struggled mightily to understand CLOS. Now, some thirty years later I have realized why I had problems understanding it.

Java, like most of the strongly typed, statically compiled languages, tries to constrain functions that operate upon an object to be encapsulated in it’s class. CLOS, on the other hand, considered classes to be an extension of data types. Methods, with their type driven dispatch, were independent from classes.

Eventually, I grasped how methods worked in Lisp. It was a long time until I was comfortable with it though and I still catch myself falling back into conflating types with method encapsulation.

So, I was thrilled to discover that Julia followed the CLOS model of specifying data hierarchy with object types and letting method dispatch be orthogonal to them. There is much to be learned from such an elegantly designed language.

I obsess like this with each new programming language that incorporates what we have learned about expressing ourselves about data and functions in ever more eloquent fashions. It is part and parcel of my infatuation with programming languages. In that, I hope you will indulge me.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Placebos Are Effective More Often Than Not

Watching a show on the placebo effect on the BBC tonight I realized that the power of the mind to control the chemistry of the body is far more profound than conventional western science would expect. In case after case, the show described studies where patients had profoundly positive results with only placebos and caring treatment from their physician. In some cases, the patients were told they were receiving placebos and yet they still experienced positive results.

The show described one study where a surgeon studied the results of conducting a placebo procedure instead of a very effective surgical treatment. In one of the cases presented, the patient had received the actual procedure for a previous injury so she knew what the real procedure felt like and yet she had positive results from the placebo procedure.

The show went on to explore the practice of medical hypnosis and studies that focused on the impact of positive suggestions from the physician in the case where all patients received placebo acupuncture. It became clear that the operative factor was the caring attention and confidence of the physician.

I have studied meditation and the western mystery tradition. I believe that the effectiveness of these so called magical traditions are closely akin to that of the placebo effect and the key thing to understand here is that the placebo effect is real. The results, while not universal or in all cases permanent, are verifiable with conventional, repeatable scientific studies. This indicates to me that we have only studied the tip of the iceberg when it comes to the power of the mind over matter, in particular the body.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

First Thoughts on Julia

I’ve been coding the Countdown Numbers game that we designed several days ago in the Julia language this afternoon and evening. So far, I’ve implemented the number selection and target selection functions. I’m currently working on the code that generates potential solutions and evaluates them using the criteria established in the definition of the game.

I am using the Juno development environment. It is developed as a plugin for the Atom editor. So far the only criticism I have of it is that it is a little overly aggressive with suggestions for autocompletion. There is probably a configuration option to tone down the aggression but I was so eager to start coding that I haven’t taken time to read the Juno tutorial.

My first impressions of Julia are very favorable. It seems to adopt the best features of a bunch of the best dynamic languages while managing to avoid feeling like a hodgepodge of features. It is built with the best of current compiler technology and consequently delivers a very performant end product.

Several of its features in particular impress me. First and foremost, it is homoiconic, that is to say, the compiled objects in the language are expressed as data elements of the language and as such lend themselves to dynamic manipulation. This supports the second impressive feature, it supports a full blown, Lisp like macro language. Macros allow you to easily extend the syntax of the language. You don’t need them often but when you do, they can turn writing and maintaining a complex code base into a walk in the park.

It also has full blown multiple dispatch, which is to say, you can have a function that has separate implementations depending on the types of arguments that you pass into it. For example, you might have a function that computes the area of a rectangle. If you passed in parameters of type inches you would be dispatched to a function that computed the area of a rectangle in inches from the height and width of the rectangle in inches. Or, if you passed in one parameter in inches and the other parameter in millimeters, it would be dispatched to another function that converted the parameters in millimeters to inches and then called the original function to compute the area in inches.

Behind most of these features is a type system that helps insure your computations make sense without burdening you with declaring variables, particular when the  compiler can infer what they are from context without your explicit intervention.

The last thing I’ll say tonight about Julia is that the code just looks clean. There is no extraneous boilerplate that tends to clutter up many other languages (cough cough java cough cough).

As promised in the blog post where we designed the Countdown Numbers game, I will walk you through the implementation of it when I get it written. I’ll also discuss why I made tweaks to the design while implementing it.

Go download Julia and have a look at the manual that is available there. It is a good place to start.  If you are impatient, Learn Julia in a few minutes is a good way to get up to speed fast, especially if you have written any Python or Ruby code.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Musings on Programming Languages

It is interesting to read about programming languages. They are very similar to natural languages in many regards. For instance, you tend to prefer the first language that you learn or, failing that, languages that are similar to it. Some times people try to make excuses along the lines of “I know how to do things in that language.”

The languages grow and evolve over time. Idioms arise and fall into disuse as more expressive ones are found. The best languages encourage evolution through function definition at minimum and often through macro definition and expansion.

Macros have always intrigued me. They are code that rewrites code. They help bring the expression of a solution closer to the form that it was originally conceived in the programmer’s mind.

When I first learned about macros, I was convinced that they were a necessary, if perhaps not sufficient, attribute of a language in which an artificial intelligence would be written. I have since come to believe that artificial intelligence will emerge from the substrate of the protocols and distributed computing facilities of the internet. I still suspect macros will be involved in some way.

What is a macro? It is a piece of code that instead of encoding a solution directly, allows a programmer to specify how one expression of a solution can be transformed to another, often more complex, expression of an equivalent solution. They often take the form of templates that are filled in with arguments inserted from the macro invocation, after which the resulting code is evaluated as it would be if a programmer had written it directly.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Three Tidbits of Programming Goodness

I’m extremely tired tonight. I am going to mention a few tidbits that I discovered today and then call it a night. I discovered that the Julia programming language had evolved a good bit since I last looked at it. I started reading a tutorial on it and took a quick look at the manual.

Second, I discover the Pony language. I am still investigating what it is but on the surface it appears to be a very pragmatic functional language based on the actor-model paradigm. I’m still getting my head around what that means. It will probably be good for a blog or two when I start to understand it.

I did have a mini-epiphany while I was writing my journal entry this morning. It occurred to me that I didn’t actually need to shuffle the number cards in the Countdown numbers implementation. It is sufficient to pick them randomly and make sure that I don’t pick the same card twice. I figured out that this was a case where modeling the mechanisms that we use to try to insure arbitrariness in our distribution of cards in the real world, i.e. shuffling, was totally extraneous if I was depending on the arbitrariness of a pseudo-random number generator for that in the first place.

I know. I’m tired. I hope that last paragraph made sense. Hopefully I won’t be quite so tired when I write my blog tomorrow.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.

Old Programmer, New Idioms

Last night I talked my way through the analysis and design of a program to solve the Countdown numbers game. Tonight I have spent some time attempting to implement this software using Clojure, a modern dialect of Lisp. In doing so, I discovered a blind spot in my programming experience. Clojure is a functional programming language. I’ve spent most of my life writing software in imperative and object oriented languages. I have studied the functional paradigm but I haven’t practiced it to any great extent. Tonight I’m going to discuss what that means and what I will do to move beyond this temporary hurdle.

Functional programming languages are based on the concept of mathematical functions. In pure functional programming languages all data is immutable and functions transform their input into their output with no side effects. That is fine in theory, but the valuable part of most programs, that is reading input from various devices and writing output to other devices for instance, are inherently entangled with side effects. You can’t read a keyboard twice and expect to get the same character unless the user just happens to type the same character twice in a row. To put it simply, the input function depends on the side effect that is the key that the user has pressed on the keyboard.

So, languages like Clojure make clearly defined distinctions between the bulk of the language that honors the functional principles and the non-functional parts of the language that allows practical work to be accomplished. This should be easy to get your mind around but it’s not.

In traditional imperative languages, we deal with variables which serve as containers to store values. We can store a value in the container and retrieve it later and it will still hold the value that we stored in it. In fact, the only way that we can change the value that it holds is to store a different value in the container. Since the container can only hold one value at a time, that clobbers the original value with the new one. This is fine in the case where you have a single processor executing a single instruction at a time.

But in the modern world few computers have a single processor in them and even if there is only one physical processor the software simulates multiple processors and multiple threads of execution. The problem arises when one of those threads stores a value in one of those variables that it shares with another thread, and then another thread decides to read it just as the first thread decides to change it. The results are unpredictable and account for one of the more difficult bugs to find in modern software.

We have been doing this kind of coding for decades now and there are text book solutions to the problem but they are complicated and easy to get wrong and Murphy, the patron saint of programmers, has his way more often than not.

Clojure has made a crucial distinction between values and identities. A value is constant. The number seven has a value that we can count on never to change. Now we might have two containers that can hold a number. The first one we give the identity X and the second we give the identity Y. We assign X the value 7, using a special mechanism that insures that no one will be able to read the contents of X until we have completed writing the value 7 into it.

The key thing to know about the difference between values and identities is that values don’t change and identities don’t actually hold values but rather point to them. Thus, if one thread has a copy of the pointer to the value that an identity was pointing to at one point in time, that value won’t change unpredictably when the identity is changed to point to another value.

This calls for a very different way of programming. You spend most of your time creating temporary values that don’t ever get changed and only rarely give a value a longer lived identity. The idioms of this style of programming are different. I am having to figure them out as I go. I also have to analyze them to decide which ones perform better than others.

In short, you can teach an old dog new tricks but you and the dog have to want to learn and be patient. When I manage to implement this algorithm in Clojure I will devote a blog post or several of them to walking through the solution.


Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.