[exim] Reduce & inlist

2024-02-28 Thread Slavko via Exim-users
Hi all,

i found in ML archives recipe how to remove duplicates from list,
i tried it in that form in file used -be input:

APPEND_ITEM = ${if def:value {$value,$item}{$item}}
INLIST = inlist{$item}{<,$value}

${reduce{<, item1, item2, item1}\
  {}\
  {${if INLIST{$value}{APPEND_ITEM

It works in 4.94, but doesn't work in 4.96 nor 4.97 (all stock debian
packages). In the 4.96 & 97 it returns only "item1". From debug
output and docs i understand, that when item is in list, the $value
inside inlist contains matched item not that one from reduce, thus
that matched item replaces result in reduces..

I found some discussion about that in this thread
https://lists.exim.org/lurker/message/20220922.124818.33ca8de7.es.html
but i lost in it...

Then i want to replace inlist by forany, but here is collision with $item
values, thus i didn't try it. Finally i replaced inlist with match condition,
which works, but i would to awoid regex if possible .

Please, is here better way to remove duplicates than use regex
in condition?

regards

-- 
Slavko
https://www.slavino.sk/

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
##   exim-users-unsubscr...@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


[exim] Re: Reduce & inlist

2024-02-28 Thread Ian Z via Exim-users
On Wed, Feb 28, 2024 at 05:30:35PM +, Slavko via Exim-users wrote:

> Please, is here better way to remove duplicates than use regex
> in condition?

I have no real solution, but as tricky as it seems to be, I think a
new built-in expansion operator to uniquify a list would be a good
thing.

If I were in the OP shoes, I'd try to work around by using a db
lookup instead of a list, maybe with the help of the "seen" feature.

-- 
Ian

-- 
## subscription configuration (requires account):
##   https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
##   exim-users-unsubscr...@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/