Skip to content

Instantly share code, notes, and snippets.

@joseoliv
Created June 12, 2019 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseoliv/c1d517fc52d83a8815db6c75ff78ae49 to your computer and use it in GitHub Desktop.
Save joseoliv/c1d517fc52d83a8815db6c75ff78ae49 to your computer and use it in GitHub Desktop.
concept
package metaobjectTest
import generic
@doc{*
Annotation 'concept' should be attached to a prototype. It tests
whether one or more prototypes obey some restrictions. That
includes parameters to the generic prototype.
*}
object Concept
func run {
var GroupWork<IntGroupPlus> gwi = GroupWork<IntGroupPlus> new;
var a = IntGroupPlus(1);
var b = IntGroupPlus(5);
var c = IntGroupPlus(11);
var zero = IntGroupPlus(0);
assert a inverse inverse == a;
assert a unit == zero;
assert a * a inverse == zero;
assert a * a unit == a;
assert (b inverse * a inverse) * a * b == a unit;
assert (c inverse * b inverse * a inverse) * a * b * c == zero;
assert b * b * a == c && c * b inverse * a inverse == b;
GroupWork<IntGroupPlus> work: a, b, c;
GroupWork<IntGroupPlus> workout: a, b, c;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment