[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filter and filter-out functions do they preserve order

From: Krzysztof Cieniuch
Subject: Re: filter and filter-out functions do they preserve order
Date: Wed, 19 Aug 2009 12:36:06 +0100
User-agent: Thunderbird (Windows/20090605)

On Fri, 14 Aug 2009, Krzysztof Cieniuch wrote:


Short question as in subject does filter function preserves original
elements order
I did some tests like:
org:= a b c d e
res:=$(filter a d c,$(org))
$(info $(res))

and this prints  a c d so it looks like it preserves order but can I
relay on that
or is this just coincidence in my simple example ?

Found answer to my question in source code. Yes they do preserve order. The filter/filter-out algorithm is clear and simple tokenize inputs (filter patern and serach text) then iterate over filer patterns and text list and mark on input text list elements that match or do not match (in case of filter-out) and then build result list once more iterating over input list
but only copying elements that matched/didn't matched, nice :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]