Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

romannum source realm

Package romannum is an on-chain port of the classic Roman-numeral converter kata: ToRoman/FromRoman. Pure and determi...

Overview

Package romannum is an on-chain port of the classic Roman-numeral converter kata: ToRoman/FromRoman. Pure and deterministic — no time, randomness or I/O.

Functions 3

func FromRoman

Action
1func FromRoman(s string) int
source

FromRoman parses a Roman numeral back to an integer. It panics on any malformed input (e.g. "IIII", "IC", "VV").

func Render

1func Render(path string) string
source

Render drives gnoweb:

  • "" or "/" → a table of example conversions
  • "/<n>" → integer → Roman
  • "/r/<roman>" → Roman → integer

func ToRoman

Action
1func ToRoman(n int) string
source

ToRoman renders an integer in 1..3999 as a Roman numeral. It panics if n is out of range.

Imports 2

  • strconv stdlib
  • strings stdlib

Source Files 2