Inconsistant contains for list and array
Darcy Shen via Texmacs-dev <[email protected]>
| Newsgroups | gmane.editors.texmacs.devel |
|---|---|
| Message-ID | <[email protected]> |
We may rewrite the contains for array.
For list:
template<class T> bool
contains (list<T> l, T what) {
return (!is_nil(l) && (l->item == what || contains(l->next, what)));
}
For array:
template<class t> bool
contains (t a, array<t> b) {
int i, l= N(b);
for (i=0; i<l; i++)
if (a == b[i])
return true;
return false;
}
_______________________________________________
Texmacs-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/texmacs-dev