Natural

com.phasmidsoftware.number.top.Natural
See theNatural companion trait
object Natural

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Natural.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete fields

val Eight: Natural
val Fifty: Natural
val Five: Natural
val Forty: Natural
val Four: Natural
val Nine: Natural
val One: Natural
val Seven: Natural
val Six: Natural
val Ten: Natural
val Three: Natural
val Two: Natural
val romanSymbolMap: Map[String, Natural]

A mapping of Roman numeral symbols (represented as strings) to their corresponding Natural values.

A mapping of Roman numeral symbols (represented as strings) to their corresponding Natural values.

This map is constructed using the romanValues sequence, which contains tuples of Roman numeral strings and their associated Natural values. The additional entry ("", Zero) is appended to ensure a mapping for the empty string to the Zero natural number.

Roman numeral keys in this map adhere to the conventional Roman numeral format (e.g., "I", "V", "X").

The map can be used for parsing or validating Roman numeral strings by retrieving the Natural value associated with a particular Roman numeral key.

Attributes

val romanValues: List[(String, Natural)]

A list of tuples associating Roman numeral symbols with their corresponding Natural values. NOTE: this list must not change its order since it is used in toString.

A list of tuples associating Roman numeral symbols with their corresponding Natural values. NOTE: this list must not change its order since it is used in toString.

The Roman numeral system is represented as pairs of strings (symbols) and their Natural value equivalents. The list is structured to facilitate conversion between Roman numerals and natural numbers.

Roman numeral symbols included:

  • "M" represents 1000 (Thousand)
  • "CM" represents 900 (NineHundred)
  • "D" represents 500 (FiveHundred)
  • "CD" represents 400 (FourHundred)
  • "C" represents 100 (Hundred)
  • "XC" represents 90 (Ninety)
  • "L" represents 50 (Fifty)
  • "XL" represents 40 (Forty)
  • "X" represents 10 (Ten)
  • "IX" represents 9 (Nine)
  • "V" represents 5 (Five)
  • "IV" represents 4 (Four)
  • "I" represents 1 (One)

Attributes

Givens

Givens