Re: Inconsistant contains for list and array

TeXmacs <[email protected]>
Newsgroups gmane.editors.texmacs.devel
Message-ID <[email protected]>
Hi Darcy,

Yes, there are a few strange things like that.
But please don't change anything for the moment.
We'll re-assess after version 2.1.

Best wishes, --Joris


On Tue, Jan 28, 2020 at 09:22:11AM +0800, Darcy Shen via Texmacs-dev wrote:
> 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


_______________________________________________
Texmacs-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/texmacs-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.