Language

Ruby

First appeared
1995
Paradigm
Object-oriented, with functional features
Toolchain
CRuby 4.0.9
Container image
ruby:4.0.9-slim-trixie

Ruby is best known for web development with Rails and rarely shows up in data science, but its blocks and collection methods make numeric code read almost like the formulas: values.sum, labels.tally, and sort_by do a lot of the work. Ruby has no statistics in its standard library, so nothing needs avoiding. The only thing we leave out is the csv library: since Ruby 3.4 it’s a bundled gem, installed alongside Ruby but no longer part of the standard library. The implementations split each line on commas instead.

Quirks

Concepts in Ruby

Run the examples locally

You need Docker and Python 3. The harness builds the pinned container and runs every Ruby example:

git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language ruby