#330 closed defect (fixed)
Sort function
| Reported by: | Alfredo Torre | Owned by: | danirus |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | SetAlgebra | Version: | head |
| Severity: | normal | Keywords: | |
| Cc: | imendez |
Description
Set Set01 = SetOfAnything(Real 1, Text "hola");
Set Set01_Ord = Sort(Set01, Real(Anything any01, Anything any02)
{
Text gram01 = Grammar(any01);
Text gram02 = Grammar(any02);
WriteLn("gram01: "+ gram01);
WriteLn("gram02: "+ gram02);
Compare(gram01, gram02)
});
Change History (4)
comment:1 Changed 20 years ago by
comment:2 Changed 20 years ago by
| Status: | new → assigned |
|---|
comment:3 Changed 20 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
This tiny enhancement has been implemented.
Sort must accept a 2nd argument with arguments of type "Anything".
In that case, that 2nd argument will care about comparison stuff.
Alfredo, your code works now without problems.
Cheers
Daniel
comment:4 Changed 19 years ago by
| bug_file_loc: | → http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000330 |
|---|

Sort function does not allow Sets with elements from diferents Grammar as you
can see in the example:
Set Set01 = SetOfAnything(Real 1, Text "hola");
Set Set01_Ord = Sort(Set01, Real(Anything any01, Anything any02)
{
WriteLn("gram01: "+ gram01);
WriteLn("gram02: "+ gram02);
});
I think that should work in TOL as EvalSet does:
Set Set01 = SetOfAnything(Real 1, Text "hola");
Set Set01_ES = EvalSet(Set01, Set(Anything any)
{ SetOfAnything(Grammar(any), any)});