Iteration is part of the bread and butter of any programming
language, and this is the case in functional programming just as
much as in imperative programming, but how is it possible to iterate
without for, foreach or while?
What is a species? It’s a question that has agonized scientists
since well before Darwin. With some exceptions, the thinking has
landed on an evidently firm reproductive barrier: Members of
different species don’t mate. If they do, their offspring are
sterile and can’t contribute to future generations. The reproductive
barrier has thus created a useful demarcation of “what is a
species”—until a deep dive into butterflies showed otherwise.
Go‘s interfaces and “duck typing” makes it
very easy to create simple mock or stub implementations of a
dependency for testing. This has not dissuaded a number of people
from writing generalized mocking libraries such as
gomock and
testify/mock,
among others.
Here I want to describe a simple alternative pattern I frequently
use when writing tests for an interface, that I think is generally
applicable to many use cases.
Tab completion is a ubiqutious time-saver, and I use it everywhere I
can. Here’s how I set it up to autocomplete hostnames when I use the
ssh or scp commands.
My Functional Programming journey was filled with dead ends, false
starts, failed attempts and frustration. And I suspect that I’m not
alone in this struggle. So why is this a common problem and what can
be done about it? And how can you avoid the these same pitfalls?
In honor of my new license plate, I decided I wanted to do a quick,
little post on rebase vs merge, how each one works, and how I choose
to use each one. Let's first look at how each one works.
A DSL, short for Domain Specific Language, can be explained as a
special kind of API that focuses on providing a simple syntax that's
tailored to working within a specific domain. Rather than being
complete stand-alone languages - like Swift is - DSLs are often
hosted in other languages, and as such, need to use a grammar that's
also perfectly valid in their host language.
Principal Components Analysis (PCA) is an algorithm to transform the
columns of a dataset into a new set of features called Principal
Components. By doing this, a large chunk of the information across
the full dataset is effectively compressed in fewer feature
columns. This enables dimensionality reduction and ability to
visualize the separation of classes or clusters if any.
In this tutorial, I will first implement PCA with scikit-learn,
then, I will discuss the step-by-step implementation with code and
the complete concept behind the PCA algorithm in an easy to
understand manner.
Functional Programming is, like Object Oriented Programming (OOP), a
programming paradigm. There isn't a formal agreed-upon definition of
what FP entails, but there are two core concepts most people would
agree are central to the paradigm:
Avoiding mutating state and side-effects
Using functions as the central building block of programs
Property wrapper is the Swift language feature that allows us to
define a custom type, that implements behavior from get and set
methods, and reuse it everywhere.