• Hash Functions

    Recently I’ve been reading about what hash functions are and how they work. Essentially a hash function takes an input of data and returns a fixed size length of data back. A hash function is a one way function. This means given the output value you are not able to...


  • Multimethods Vs. Protocols

    There a few different ways to define polymorphic behavior in Clojure. The two main ways are through Multimethods and Protocols. Lets first take a look at Multimethods Multimethods Multimethods have something called a dispatch function which can be thought of like an air traffic controller. They determine where in the...


  • Anonymous Functions

    There are a few ways to denote a function in Clojure. The most common way is something like this (defn merge-vector [v1 v2] (into v1 v2)) This is a function that takes two vectors and returns a new vector that is the combination of the elements in both these vectors....


  • Lazy Sequences

    Lazy sequences are powerful tools in Clojure. But before we dive further into lazy sequences I want to briefly go over the differences between a collection and sequence in Clojure. Collections Types of collections: vector, list, hash-map Immutable Functions that can be used on them: count, conj, seq, first rest,...


  • Symbols in Clojure

    Symbols in Clojure are frequently used. Clojure.org states that symbols are used to “refer to function parameters, let bindings, class names, and global vars”. Essentially symbols are a piece of data. Symbols are not storage locations, but instead they are used to refer to the value of a variable. It...


  • Recursion

    Recursion is often found in many built in functions within Clojure for example in filter and map. This blogpost will specifically cover linear and tree recursion. Linear Recursion Linear recursion for a vector works by processing the first element and working it’s way down the sequence. The size of the...


  • Threads

    Threads are something used by computer programs. A single thread is responsible for a set of instructions that together perform a specific task. It controls what is executed in a specific order. A thread also allows the capability of context switching away from it and resuming it from the point...


  • Ruby Mutability

    This post will cover the differences between immutability and mutability in Ruby. Variable References An object has state which is often referred to as a value. When a variable is assigned to an object it has a reference to that object. Ex: >> a = "hello world" => "hello world"...


  • SQL Prepare Statement

    The PREPARE statement is a useful and widely used statement in SQL. The way it works is it essentially creates a template of the query you would like to run. Instead of the actual values being passed in, placeholders are passed in (similar to parameters). Here’s an example PREPARE insert_new_emp(text,...


  • SQL Query Optimization

    This blogpost will specifically cover cross joins and how they can lead to slow queries. Cross joins also known as a Cartesian Product joins all rows of each table together. The wikipedia page on a Cartesian Product has a good visual of what that would be mean. Lets say you...


  • Database Cleaning

    If you are using a database for your application you are probably writing some tests to verify the correct results are written to your database. In my case, I set up a test database that I write results out to and verify the results. I initially made the mistake of...


  • Rake

    For my next assignment with the time logger application I have been exploring and learning about Rake. Rake is a build language and it is also a Domain Specific Language (DSL). It executes tasks in a dependency way (ex: do this first then that). One way to use it is...