2011-06-15 11:19:50 -07:00
|
|
|
|
|
|
|
|
|
|
|
fn id[T](&T x) -> T { ret x; }
|
|
|
|
|
2010-06-28 23:18:51 -07:00
|
|
|
|
2010-08-03 17:52:35 -07:00
|
|
|
/* FIXME (issue #141): See test/run-pass/constrained-type.rs. Uncomment
|
|
|
|
* the constraint once fixed. */
|
2011-06-15 11:19:50 -07:00
|
|
|
type rational = rec(int num, int den);
|
2010-08-03 17:52:35 -07:00
|
|
|
|
2011-06-16 16:55:46 -07:00
|
|
|
|
|
|
|
// : int::positive(*.den);
|
2010-08-03 17:52:35 -07:00
|
|
|
fn rational_leq(&rational x, &rational y) -> bool {
|
2011-05-12 17:24:54 +02:00
|
|
|
// NB: Uses the fact that rationals have positive denominators WLOG:
|
2010-09-22 15:44:13 -07:00
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
ret x.num * y.den <= y.num * x.den;
|
2011-04-06 17:56:44 -07:00
|
|
|
}
|
|
|
|
|
2011-06-15 11:19:50 -07:00
|
|
|
fn orb(&bool a, &bool b) -> bool { ret a || b; }
|
2010-09-22 15:44:13 -07:00
|
|
|
// Local Variables:
|
|
|
|
// mode: rust;
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
2011-06-15 12:01:19 -07:00
|
|
|
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
2010-09-22 15:44:13 -07:00
|
|
|
// End:
|