/RomanNumerals.jl

Roman numeral arithmetic

Primary LanguageJuliaMIT LicenseMIT

RomanNumerals.jl

Stable Dev Build Status Codecov Coveralls

Julia package for Roman numerals.

Installation

] add https://github.com/harryscholes/RomanNumerals.jl

Examples

julia> using RomanNumerals

julia> foreach(i->println(RomanNumeral(i)), 1:5)
I
II
III
IV
V

julia> I + I
II

julia> V - I
IV

julia> 3X - 2I
XXVIII

julia> M ÷ X
C

julia> rand(RomanNumeral, 5)
5-element Array{RomanNumeral,1}:
 LXXI  
 CXX   
 XCVIII
 XLIX  
 VIII

julia> RomanNumeral(2019)
MMXIX

julia> Int16(rn"MMXIX")
2019

julia> rn"I" == RomanNumeral("I") == RomanNumeral('I') == RomanNumeral(1)
true