[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] Inconsistant contains for list and array
From: |
TeXmacs |
Subject: |
Re: [Texmacs-dev] Inconsistant contains for list and array |
Date: |
Tue, 28 Jan 2020 09:40:17 +0100 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
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
> address@hidden
> https://lists.gnu.org/mailman/listinfo/texmacs-dev