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
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to