-1 if <, +1 if > and 0 otherwise

Note, the implementation must ensure that: (x<=>y == 0) == (x==y)

Property definitions

core $ Comparable :: <=>
	# -1 if <, +1 if > and 0 otherwise
	# Note, the implementation must ensure that: (x<=>y == 0) == (x==y)
	fun <=>(other: OTHER): Int
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/kernel.nit:333,2--344,4

ai $ Tile :: <=>
	redef fun <=>(o) do return goal_idx <=> o.goal_idx
lib/ai/examples/puzzle.nit:226,2--51

trees $ BKMatch :: <=>
	redef fun <=>(o) do
		if distance == o.distance then
			return key <=> o.key
		end
		return distance <=> o.distance
	end
lib/trees/bktree.nit:141,2--146,4

core $ UInt32 :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/fixed_ints.nit:647,2--656,4

core $ Int8 :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/fixed_ints.nit:163,2--172,4

core $ Int16 :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/fixed_ints.nit:284,2--293,4

core $ UInt16 :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/fixed_ints.nit:405,2--414,4

core $ Int32 :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/fixed_ints.nit:526,2--535,4

popcorn $ BrowserCount :: <=>
	redef fun <=>(o) do return o.count <=> count
lib/popcorn/pop_tracker.nit:183,2--45

gmp $ Ratio :: <=>
    redef fun <=>(r) do
        var res = val.cmp(r.val)
        if (res) < 0 then
            return -1
        else if (res) > 0 then
            return 1
        else
            return 0
        end
    end
lib/gmp/gmp.nit:303,5--312,7

core $ Byte :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/kernel.nit:660,2--669,4

core $ Float :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/kernel.nit:547,2--556,4

gmp $ BigInt :: <=>
    redef fun <=>(i) do
        var res = val.cmp(i.val)
        if (res) < 0 then
            return -1
        else if (res) > 0 then
            return 1
        else
            return 0
        end
    end
lib/gmp/gmp.nit:135,5--144,7

core $ Int :: <=>
	redef fun <=>(other)
	do
		if self < other then
			return -1
		else if other < self then
			return 1
		else
			return 0
		end
	end
lib/core/kernel.nit:765,2--774,4

core $ ArrayCmp :: <=>
	redef fun <=>(o)
	do
		var i = 0
		var l = length
		if l == 0 then return 0
		var it = _items.as(not null)
		var oit = o._items.as(not null)
		var ol = o.length
		var len
		if l < ol then len = l else len = ol
		while i < len do
			var a = it[i]
			var b = oit[i]
			if a != null then
				if b == null then return 1
				var d = a <=> b
				if d != 0 then return d
			else
				if b != null then return -1
			end
			i += 1
		end
		return l <=> ol
	end
lib/core/collection/array.nit:923,2--946,4