Fixed quick_sort when array is length 0 or 1
[nit.git] / lib / core / kernel.nit
index 72b6fc9..39a5958 100644 (file)
@@ -651,11 +651,6 @@ universal Byte
        #     assert 5u8 >> 1    == 2u8
        fun >>(i: Int): Byte is intern `{ return self >> i; `}
 
-       # Returns the character equivalent of `self`
-       #
-       # REQUIRE: `self <= 127u8`
-       fun ascii: Char is intern `{ return (uint32_t)self; `}
-
        redef fun to_i is intern
        redef fun to_f is intern
        redef fun to_b do return self
@@ -863,8 +858,11 @@ universal Int
 
        # Return the corresponding digit character
        # If 0 <= `self` <= 9, return the corresponding character.
+       #
        #     assert 5.to_c    == '5'
+       #
        # If 10 <= `self` <= 36, return the corresponding letter [a..z].
+       #
        #     assert 15.to_c   == 'f'
        fun to_c: Char
        do
@@ -882,6 +880,9 @@ universal Int
        #     assert 10.abs    == 10
        #     assert 0.abs     == 0
        fun abs: Int do return if self >= 0 then self else -self
+
+       # Is `self` an ASCII whitespace ?
+       fun is_whitespace: Bool do return self == 0x7F or self <= 0x20
 end
 
 # Native characters.
@@ -961,14 +962,6 @@ universal Char
                end
        end
 
-       # The ascii value of `self`
-       #
-       #     assert 'a'.ascii    == 97u8
-       #     assert '\n'.ascii   == 10u8
-       #
-       # REQUIRE: `is_ascii`
-       fun ascii: Byte do return code_point.to_b
-
        # The unicode code point value of `self`
        #
        #     assert 'A'.code_point == 65