Normal, Applicative and Lazy Evaluation

A lambda expression is said to be in normal form if it cannot be reduced any further, meaning that the expression no longer contains any function applications. More formally, a reducible expression is called a redex, and a lambda expression is in normal form when it contains no more redexes. Redex A reducible function expression. Normal Form A lambda expression that contains no redexes. Given a lambda expression, there are two primary strategies for reducing it to normal form: normal-order evaluation, or applicative-order evaluation. This article discusses both methods, their pros and cons, and an alternative evaluation strategy that combines the pros from both — lazy evaluation. ...

September 18, 2018 · 5 min · Kevin Sookocheff

Representing Pairs and Lists in Lambda Calculus

Having covered types, let’s now turn our attention to lists. Lists are general purpose data structures for storing sequences of items. In lambda calculus, lists are represented using pairs, with the first item of the pair representing the head of the list, and the second item representing the rest of the list. A special value, nil, at as the second item of the pair terminates the list. Pairs Let’s start by focusing on pairs (or tuples). A pair is built from two arguments, \(a\) and \(b\), and returns a function \(f\) enclosing those two arguments: ...

September 7, 2018 · 3 min · Kevin Sookocheff

Typed Lambda Calculus

Lambda calculus is a very simple language. If you take away any syntactic sugar, all you are left with is functions that take arguments and return results. You can use these simple building blocks to construct functions that represent numbers and arithmetic, but there is no way to restrict, for example, arithmetic functions to require numeric operands. This is where types come in. Generally speaking, types allow you to control the use of functions so that only meaningful combinations of inputs and outputs are used. ...

August 21, 2018 · 4 min · Kevin Sookocheff

A Guide to the Kubernetes Networking Model

Kubernetes was built to run distributed systems over a cluster of machines. The very nature of distributed systems makes networking a central and necessary component of Kubernetes deployment, and understanding the Kubernetes networking model will allow you to correctly run, monitor and troubleshoot your applications running on Kubernetes. Networking is a vast space with a lot of mature technologies. For people unfamiliar with the landscape, this can be uncomfortable because most people have existing preconceived notions about networking, and there are a lot of both new and old concepts to understand and fit together into a coherent whole. A non-exhaustive list might include technologies like network namespaces, virtual interfaces, IP forwarding, and network address translation. This guide intends to demystify Kubernetes networking by discussing each of Kubernetes dependent technologies along with descriptions on how those technologies are used to enable the Kubernetes networking model. ...

July 11, 2018 · 33 min · Kevin Sookocheff

Infrastructure in an Age of Commodities

Early computers were described using mathematical notation and theoretical constructions, which were then translated by enterprising machinists into custom built calculation engines. The first computer programmers using these machines built applications directly in hardware by plugging together wires and sockets in varying configurations. Even with these short-comings, the value of general purpose computing machines was evident. As companies began to realize the utility of computing, they saw computing as a means for differentiating themselves from their competitors. ...

June 19, 2018 · 6 min · Kevin Sookocheff

Recursive Lambda Functions the Y-Combinator

In a purely functional language — like lambda calculus — programs are expressed as nested function calls. Repetition in such an environment requires that nesting of function calls continues until some condition is met. During the repetition, each function passes its result to the next function in the nested chain and this repetition is completed when a test for some condition passes. The repetitive behaviour I’ve just described is recursion: ...

June 11, 2018 · 8 min · Kevin Sookocheff

Simplifying Lambda Syntax

Evaluating lambda functions requires using lots of brackets, which can be tedious and are a major source of error for evaluating expressions by hand. To simplify expressions, you can omit brackets when it is clear what the intention of the function is. Particularly, a function application can omit the brackets surrounding each individual parameter and assume the function is applied to the nearest argument. So, instead of expressing a function of three arguments as ...

May 25, 2018 · 2 min · Kevin Sookocheff

Introducing Lambda Calculus

Lambda calculus provides some of the foundational structures that functional programming is built from. It therefore seems fitting to start my journey through functional programming with a thorough examination of lambda calculus. This first post will introduce Lambda calculus with references to the book An Introduction to Functional Programming Through Lambda Calculus. Syntax The complete syntax for Lambda calculus is surprisingly small and comprehensible. This section lists the syntax in its entirety, while following sections break the syntax down to explain each part. ...

April 27, 2018 · 9 min · Kevin Sookocheff

A Principled Approach to Architecture

A principle is a concept or value that is a guide for behaviour or evaluation. — Wikipedia This post presents a principled approach to architecture. These principles specify what I believe is important about architecture, without diving into any details about how an architect should work. No matter how an architect works day-to-day, by following principles, you can be sure you are providing value in the right areas. As usual, this post is personal opinion, and I’m interested in hearing any differing or similar opinions in the comments. ...

March 23, 2018 · 5 min · Kevin Sookocheff

Range, Domain, and Codomain

Three common terms come up whenever we talk about functions: domain, range, and codomain. This post clarifies what each of those terms mean. Before we start talking about domain and range, lets quickly recap what a function is: A function relates each element of a set with exactly one element of another set (possibly the same set). Math is Fun That is, a function relates an input to an output. But, not all input values have to work, and not all output values. For example, you can imagine a function that only works for positive numbers, or a function that only returns natural numbers. To more clearly specify the types and values of a functions input and output, we use the terms domain, range, and codomain. ...

March 9, 2018 · 2 min · Kevin Sookocheff