Yos Riady optimize for learning

👋 Hi, I'm Yos.

Decentralized systems and smart contract engineer based in Singapore ☀️

Here are my recent thoughts...

Mixins in Elixir

Mixins in Elixir

Let’s demystify the frequently used use keyword in Elixir.

We can use the use keyword in Elixir to package behaviour and implementation for use in other modules, similar to abstract base classes or mixins in other languages. Mixins reduce the amount of boilerplate in your modules, especially for library authors.

Mixins in Elixir are similar on the surface to Concerns in Ruby and Traits in Scala. Before we start, you should be somewhat familiar with behaviours and macros.

Continue reading →

Syntactic Extension with Elixir Macros

Syntactic Extension with Elixir Macros

An Elixir program can be represented by its own data structures as an abstract syntax tree (AST) of tuples with three elements. For example, the function call run(1, 2, 3) is represented internally as:

{:run, [], [1, 2, 3]}

Macros in Elixir lets you perform syntactic extensions, which are expanded to before a program executes. We use macros to transform our internal program structure by treating code as data, and thus metaprogram.

Many of Elixir’s language features such as if and def are in fact macros, which are translated away into lower-level abstractions during compilation. Armed with the same tools that José utilized to write Elixir’s standard libraries, you can extend Elixir to suit your needs using macros.

Continue reading →

Recently

The days are long, but the years are short.

Continue reading →

Type Checking in Elixir

Type Checking in Elixir

This article was originally published on Elixir Recipes.

While Elixir is dynamically typed, we can supply optional typespecs to make sure our programs are type-safe. Preventing type errors ensures that there’s no discrepancy between differing types of our program’s constants, variables, and functions. Typespecs are also useful as documentation.

If you’ve used type systems in OCaml or F#, Elixir’s type system should feel familiar to you.

Continue reading →

Elixir Recipes

Elixir Recipes

I’ve been spending some time learning Elixir, and I figure the best way to learn is to teach it to someone else. Announcing: Elixir Recipes!

Continue reading →

The Art of Thinking Clearly

Here are my highlights from The Art of Thinking Clearly, a reference guide to cognitive biases and good decision-making.

Continue reading →

DataTron - Data Science for Everyone

DataTron - Data Science for Everyone

Over the Hack n Roll hackathon at NUS, I worked on a particularly interesting project which I thought I’d briefly write about.

Continue reading →

Probabilistic Inference with Naive Bayes

Probabilistic Inference with Naive Bayes

Today, let’s take a look at Naive Bayes from the ground up, and work through a working implementation in Javascript.

Continue reading →

Stateless Authentication with JSON Web Tokens

Stateless Authentication with JSON Web Tokens

Whether you’re writing a public API or an internal microservice, getting authentication right can make or break your API. Let’s take a look at a JSON Web Token-based authentication system.

We’ll begin with basic authentication & JWT concepts, followed by a detailed walkthrough of designing an authentication service with plenty of code examples.

Continue reading →

Recently

If you work on something a little bit every day, you end up with something that is massive.

Continue reading →