math::roman(1.1)
๐ math::roman โ bestie edition ๐
okay so this is math::roman, version 1.1, and it's literally the cutest little Tcl library for doing roman numerals. like, actual XIV type stuff. no cap.
โจ NAME โจ
math::roman โ tools for creating and manipulating roman numerals ๐๏ธ
๐ธ SYNOPSIS ๐ธ
package require Tcl 8.5 9
package require math::roman ?1.1?
::math::roman::toroman i
::math::roman::tointeger r
::math::roman::sort list
::math::roman::expr args
๐ฆ DESCRIPTION ๐ฆ
::math::roman is a pure-Tcl library, bestie. pure. no compiled extensions, no sneaky C, just vibes and Tcl. it converts back and forth between integers and roman numerals, and it also hands you utility functions for sorting roman numerals and doing arithmetic on them. it's giving ancient Rome but make it scriptable. ๐
this code was originally harvested from the Tcler's wiki over at http://wiki.tcl.tk/1823, and as such it's free for any use for any purpose. huge thank you to the ingenious folk who came up with these clever routines and generously dropped them into the Tcl community โ absolute icons, we stan. ๐ซถ
and yeah, it was written and tested under Tcl 8.3, but the expectation is that this library works under all 8.x versions of Tcl. so like, if you're on an old one, you're probably fine. ๐
๐ฅ COMMANDS ๐ฅ
::math::roman::toroman iโ converts an integer into roman numerals. the result is always upper case, periodt. and heads up: the value zero gets converted to an empty string. not "N", not "0", justโฆ nothing. it's giving silence. ๐คซ::math::roman::tointeger rโ converts a roman numeral into an integer. that's it, that's the whole thing. โจ::math::roman::sort listโ sorts a list of roman numerals from smallest to largest. because alphabetically sorting roman numerals is a whole lie, ngl.::math::roman::expr argsโ evaluates an expression where all the operands are roman numerals. yes bestie, math but fancy. ๐งฎ
okay so out of these four, only toroman and tointeger are exported, so they're the easy ones to just call. the other two are not exported, because they could interfere with โ or get confused for โ existing Tcl commands. they said "we're not doing namespace crimes today." ๐
๐ญ BUGS, IDEAS, FEEDBACK ๐ญ
this document, and the package it describes, will undoubtedly contain bugs and other problems. like, it's software, babe. please report them in the category math :: roman of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist.
also please report any ideas for enhancements you may have for either the package and/or the documentation. we love ideas. ๐ซถ
when proposing code changes, please provide unified diffs, i.e. the output of diff -u. fr fr, that's the format.
note further that attachments are strongly preferred over inlined patches. you can make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk. ๐
๐ KEYWORDS ๐
conversion, integer, roman numeral
๐ CATEGORY ๐
Mathematics
๐ COPYRIGHT ๐
Copyright (c) 2005 Kenneth Green <kenneth.green@gmail.com>
and that's the whole page, bestie ๐ this was Tcl Math Library, shipped as part of tcllib, for math::roman(1.1). go forth and convert integers with main character energy. slay. โจ๐๐ธ
๐ฆ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 ยท TCL
- fedora 44: tcllib 2.0-4.fc44 ยท TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2005 Kenneth Green <kenneth\&.green@gmail\&.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms