Swapped syntax for Natural numbers and Integers
Migrate your code to support the change in syntax for
Naturalnumbers andIntegers
On May 7, 2018 the language standard changed to swap the syntax for Natural numbers and Integers. This section describes what changed and how to migrate your code.
Changes
Before the change, the standard specified that:
literal numbers with a leading
+wereNaturalnumbers,literal numbers without a leading sign were
Integers, and:literal numbers with a leading
-wereIntegers.
In other words:
-- Before
+2 : Natural
2 : Integer
-2 : Integer
After the change, the standard specifies that:
literal numbers without a leading sign are
Naturalnumbers, and:literal numbers with a leading sign (both
+and-) areIntegers.
In other words:
-- After
2 : Natural
+2 : Integer
-2 : Integer
Additionally, Natural/show was changed to render Natural numbers without the leading sign and Integer/show was changed to render non-negative Integers with a leading + sign:
-- Before
Natural/show +2 = "+2"
Integer/show 2 = "2"
Integer/show -2 = "-2"
-- After
Natural/show 2 = "2"
Integer/show +2 = "+2"
Integer/show -2 = "-2"
Migration
To migrate code you need to:
Remove the leading
+from allNaturalnumber literalsAdd a leading
+to all non-negativeIntegerliteralsReplace
Natural/show nwith"+${Natural/show n}"Replace
Integer/show (Natural/toInteger n)withNatural/show n
Also, you can no longer render Integers without a leading + or - sign