We are finally going to discuss the last two methods, insert/2 and remove/1, that a link list should have.

Let’s talk about insert first.

insert/2 method

We have some sort of value and an index we need to insert that value at. We first check our edge cases. If the index is less than zero or greater than the length of the list, it is not possible to insert the value and therefore we return false. If the index is equal to the length of the list we simply push it on, and coerce the return value of running push/1 to a…

If you missed it catchup with the code on the first blog I wrote about singly-linked lists in JavaScript. I won’t be doing a recap about the code we have so far so if you are lost please check it out!

We will now start implementing some more advanced methods to our linked-list. Let’s take a look at a get/1 method.

get/1 method

Here we take a desired index, an integer value, and check for edge cases. We make sure the number exists within the range of our list and if it does not, return undefined.

Next we create a counter variable…

In a real time application, keeping users up to date with the latest information possible is crucial. As such, creating an efficient data pipeline is a necessity. According to Stephen Bussey in his book , there are a few traits a data pipeline must have to be considered efficient.

  • The data pipeline delivers messages to all relevant clients and sends the correct data.
  • Fast data delivery. The pipeline should be as fast as possible.
  • As durable as needed. Your guarantees of delivery should be as strong as your application calls for. …

In this blog, I hope to quickly run down the basics of implementing a singly linked list in JavaScript.

What is a linked list? A singly-linked list is a data structure represented by a collection of nodes that are connected to one another through a “next” pointer. They contain the following properties:

  • head: The first node in the linked list.
  • tail: The last node in a linked list.
  • length: the total amount of nodes in the list.

What are nodes? Nodes are what makeup a linked list. Each node is connected to the other by a unidirectional connection. …

The modern web framework Phoenix allows us easily build and deploy soft real time applications. Phoenix does this through two modules, Phoenix.Socket and Phoenix.Channel.

Phoenix Sockets are the point of connection to your application. They serve as an access point for client subscriptions. They can also be utilized by other server instances as a method of communication between nodes on a server cluster. You define channels within a socket, allowing for clients/servers to subscribe to certain topics of their choosing.

Sockets and channels have different performance costs associated with them. In Phoenix, each separate socket is considered an independent connection…

Coming from the dynamically typed Ruby, the concept of function overloading was a very foreign concept to me. I hope to succinctly explain the concept to other developers by looking at some code from a project I have been working on.

Elixir has very powerful pattern matching capabilities that allow us to test for specific input cases.

An example of function overloading

As you can see above, the function make_move is being defined twice here. If you also come from a language like Ruby, you would probably expect this to throw an error. …

In Elixir there exists two built in modules Enum and Stream. Enum and Stream both give us access to a set of algorithms for working with enumerables. Both also work in linear time (O(n)). In fact, many of the built in functions that can be found in the Enum module, can be found in the Stream module.

Stream and Enum do have their differences however! The biggest difference between the two is the way their algorithms are evaluated. Enum is evaluated eagerly whereas Stream is evaluated lazily. What this means is Stream will wait to evaluate the functions defined using…

In Elixir the most used tool for iterating through collections is recursion. Most of us know recursion as referencing a function within its own invocation. This function gets called until it arrives at a base terminating case or after it has been called a fixed number of times. An example of a recursive function in elixir would be as follows:

# 1
def multiply_numbers2([head | tail]) when is_number(head) do
multiply_numbers2(tail) * head

# 2
def multiply_numbers2([_head | tail]) do

# 3
def multiply_numbers2([]) do

The problem with this implementation is that at greater collection sizes…

Phoenix is a modern web framework for the functional programming language Elixir. Phoenix comes shipped with something called Phoenix Channels, a feature of Phoenix that allows for soft real-time communication out of the box.

Channels can be used for:

  • Chat rooms and APIs for messaging apps
  • “Breaking” news (like emergencies or sports info.)
  • Events in games
  • Much more!

Channels may seem intimidating but I hope to demystify whats going on behind the scenes for you!

The structure of a channel is quite simple. At a very high level, channels enable clients to connect to a web server and subscribe to…

In Elixir the for keyword is used differently than most other language. The for keyword starts something called a comprehension in Elixir.

A comprehension is basically syntactic sugar for looping through enumerables in Elixir.

The first part of the expression, x <- list, is what is known as a generator. They are responsible for “generating” the next value to be called upon by the comprehension. You can have multiple generators, much like you can have nested loops. Comprehension are not just limited to lists. Any enumerable is able to utilize comprehensions.

Comprehensions also have a second piece to them: filters.

Cody DeMartin

Full-Stack Engineer

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