Posts
-
ex_roman: A Roman Numeral Converter in Elixir
I’m excited to share another one of my open-source projects: ex_roman. It’s a small Elixir library for converting integers to and from Roman numerals.
The project was born as a fun exercise in Test-Driven Development (TDD) and a way to explore the power of pattern matching in Elixir. The core of the library is a set of functions that use pattern matching to handle the conversion logic, which makes the code concise and easy to understand.
-
Traffic Light Simulation with Ruby
Today, I want to share an interesting project I found on GitHub: traffic_light. It’s a simulation of a traffic light controller, implemented in Ruby.
The project uses Ruby’s
Fibersfor concurrency and theCurseslibrary for a terminal-based graphical interface. It’s a great example of how to use these technologies to create a simple simulation.The core of the simulation is a state machine that defines the different states of the traffic lights (red, green, yellow). The state transitions are managed by the Fibers, which are lightweight concurrency primitives in Ruby.