Photo by Alexandr Popadin on Unsplash

Recently (2020), I was asked to help facilitate a workshop focused on the Legal community. The workshop explored the potential of Chatbots and Rules Engines. As a quick demo, I knocked up a simple Chatbot. My Chatbot centers around providing the User with assistance in obtaining digital evidence from different countries. Different countries have different procedures. For example, many countries make the process easy with a bilateral treaty such as the Mutual Legal Assistance Treaty or MLAT for short. For a number of European countries, there is another bilateral agreement known as a European Judicial Network agreement (EJN). So, where…


Photo by Sincerely Media on Unsplash

In Part 8, we touched briefly on file handling; the supplied example required two tools:

(require ‘[clojure.java.io :as io])(require ‘[clojure.edn :as edn])

The first, clojure.java.io, is the main tool used by Clojure to control file input and output.

The second, edn, concerns extensible data notation. This edn tool allowed us to take the Library hash-map created in Part 8 and store (or retrieve) it in a text file. In fact, a hash-map such as our Library example is actually written in edn format. You should think of edn as a schema similar to JSON and XML. …


Photo by Jamie Haughton on Unsplash

Regular Expressions, otherwise known as REGEX, are a method of applying formulas to manipulate text. REGEX allows you to search, and filter swathes of text and extract only the desired. It can also be used to test a character string for specific features. For example, is it a MAC address, a mobile phone number, or an ISBN number? REGEX is a hugely powerful tool and often applied to forms and databases, as it can help control both input and output.

In Part 8, we used a REGEX to control input for an ISBN number.

#”^[0–9xX\-]+$”

The REGEX followed a pattern…


Photo by Roman Mager on Unsplash

A function is just a piece of code that performs a specific task and can be ‘called’ when required. You have seen functions used throughout this course. For instance, mathematical + and println are examples of inbuilt functions. Often, but not always, a function expects an argument or arguments.

For example,

(+ 5 10)

+ is the function for addition.

5 and 10 are the arguments.

This function will work with 1 or more parameters.


Photo by Paul Melki on Unsplash

In this lesson, we will demonstrate all the different ways you can store and retrieve stuff with Clojure.

Lists

A list is simply a collection of data items. There does not have to be any relation between the items and you can mix together items. For example, a list can contain numbers and strings.

Type all the following in a REPL and observe the results.

(println (list “Yoda” 401.0 true))

Here we have a list of three items, string, a floating-point number, and a boolean value: true. The list command in the inner brackets creates our list and then the outer…


Photo by Tara Evans on Unsplash

In programming, we refer to text as a string, as in a string of characters. In this Part, we will discuss string processing, which includes manipulation, formatting, and obtaining information about a string.

Fire up a terminal and begin a new REPL session. Type in the following statements, and observe the results:

(def ourString “Close Encounters of the 3rd Kind”)

The keyword def allows us to create a static variable called ourString and assign it with the string, “Close Encounters of the 3rd Kind”. Creating static variables is useful in programming for many reasons, but mostly because it saves on…


Photo by Jeswin Thomas on Unsplash

Polish notation

We discussed Polish Notation in Part 1. Polish Notation means the operator is prefixed before the operands. We are more used to the infix method, whereby the operator sits in between the operands. So, to understand Clojure’s Polish Notation, take the operator e.g. the plus sign +, and move it to in between the numbers. So, (+ 15 10) is actually evaluated as 15 + 10.

Let’s begin with a new REPL session. Recall from Part 3, Ctrl + T will open a terminal and lein repl will start a new REPL session.

In the REPL, try the following code…


Photo by Markus Spiske on Unsplash

Lein

Lein is an abbreviation of Leiningen and has its own website https://leiningen.org/. Lein, or more appropriately lein is the command used to create a new template for a specific programming project. In other words, lein will create lots of boilerplate code to save you much programming.

For example, we could have a project called First Project. We may want to put this project in a Directory called Project like so:

mkdir Projectcd Projectpwd

Open up a terminal. Use the terminal app or use the keyboard shortcut Ctrl + T. Typing the command mkdir Project creates the Directory called…


Photo by Sebastian Herrmann on Unsplash

For any book or guide, the installation section is usually the most frustrating. Why? Because a number of different components must be installed and come together in a cohesive manner.

Unfortunately, system dependencies and differing operating system versions or constraints often prevent this from being an issue-free process. In reality, you follow the instructions laid out before you and nothing works as it should. After many hours you may succeed in your installation endeavors, else give up on the idea of a computer programming career!

Virtualization

To overcome this issue of ‘why does it work on your computer and not mine’…

Harvey Ellams

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store