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.
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.
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:
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.
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
end
# 2
def multiply_numbers2([_head | tail]) do
multiply_numbers2(tail)
end
# 3
def multiply_numbers2([]) do
1
end
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:
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.
While finding a way to capture JWT tokens for a recent project I was working on, I was looking for a way to save the JWT token I was getting in my return promise of my authorization fetch. This lead me down a path of doing research and stumbling across a possible solution to my problem: localStorage. So what is localStorage you ask? Let me tell you.
LocalStorage is a read only property of your DOM’s origin, or the scheme (protocol), host (domain), and port of the URL used to access it. You are able to assign Storage objects places…
Full-Stack Engineer