equiv.scala
来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 42 行
SCALA
42 行
/* __ *\** ________ ___ / / ___ Scala API **** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL **** __\ \/ /__/ __ |/ /__/ __ | **** /____/\___/_/ |_/____/_/ | | **** |/ **\* */// $Id: Equiv.scala 14488 2008-04-03 14:16:41Z washburn $package scala/** A trait for representing equivalence relations. It is important to * distinguish between a type that can be compared for equality or * equivalence and a representation of equivalence on some type. This * trait is for representing the latter. * * An <a href="http://en.wikipedia.org/wiki/Equivalence_relation">equivalence * relation</a> is a binary relation on a type. This relation is exposed as * the <code>equiv</code> method of the <code>Equiv</code> trait. This * relation must be: * <ul> * <li>reflexive: <code>equiv(x, x) == true</code>, for any <code>x</code> of * type <code>T</code>.</li> * <li>symmetric: <code>equiv(x, y) == equiv(y, x)</code>, for any <code>x</code> * and <code>y</code> of type <code>T</code>.</li> * <li>transitive: if <code>equiv(x, y) == true</code> and <code>equiv(y, z) == true</code> * then <code>equiv(x, z) == true</code>, for any <code>x</code>, <code>y</code>, * and <code>z</code> of type <code>T</code>.</li> * </ul> * * @author Geoffrey Washburn * @version 1.0, 2008-04-03 */trait Equiv[T] { /** Returns <code>true</code> iff <code>x</code> is equivalent to * <code>y</code>. */ def equiv(x: T, y: T): Boolean }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?