This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
As I wrote previously, I am learning the Clojure programming language as one of my personal Learning Projects. Naturally I started with hello world because there are a ton of examples of hello world available and just being able to get it working proves that you're gotten your development environment setup correctly.Now that I have moved past hello world, I am ready for the first programs that I…
As I wrote previously, I am learning the Clojure programming language as one of my personal Learning Projects. Naturally I started with hello world because there are a ton of examples of hello world available and just being able to get it working proves that you're gotten your development environment setup correctly.Now that I have moved past hello world, I am ready for the first programs that I will have to write myself. No copy and paste of a complete working version, or because I am using lein I get a copy supplied everytime I start a new project. So, it is time to write the simplest programs that it is possible to write in almost every programming language I've ever used, the equivalents of the Unix utilities true and false. These are so simple to write because they do nothing except exit and pass an integer value back to the operating system. In the Unix world, where these come from, the convention is that a zero indicates success and a non-zero indicates failure, with again the convention being that the false utility returns a one. (Naturally, other utilities are free to return any non-zero value they wish, but false is going to give you a one.)A challenge when setting up the projects was finding that Clojure does not allow language keywords as filenames, so true.clj and false.clj were not options. Necessity brings out invention, so I named them cljtrue.clj and cljfalse.clj. Not the most exciting names, but they work. (That's actually pretty good considering that I'm a graduate of the Jocko school of naming things!)Read on simonpeter.org ↗
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.