Type Gymnastics with Builder Pattern

scalabuildertypesseries

The Builder pattern provides a way to construct complex objects step by step with a fluent API, where each method call returns the builder itself, allowing for method chaining. Let us play some type …

Read more →

Understanding Contramap

scalacontramapfunctorfp

A contramap is defined as the converse of the map. I have never been satisfied with the definition. In this post, I will explain the concept in a way that is easy to internalize.

Read more →

Scala 2 Symbols

scalasymbols

This post provides a concise overview of key symbols used in Scala 2, such as symbols for function types, function literals, import renaming, and more. It serves as a quick reference for Scala …

Read more →

A Rogue JSON Parser

jsonparserscalaquiz

Recently, someone quizzed me to write a JSON parser. Time was limited. So, I told them I might not be able to write a disciplined parser that builds an AST and creates JSON objects out of it. In the …

Read more →

Top K Frequent Items

javascalaproblem

This post explores a functional style implementation in Scala and Java to a famous interview question to find the top k frequent items in an array. Beware the functional implementation may not be …

Read more →