valueDiff for arrays?

Monte Goulding monte at appisle.net
Sun Aug 5 16:37:09 EDT 2018



> On 6 Aug 2018, at 12:38 am, Mark Waddingham via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>  keeping where P -> P
>  keeping with P -> each matches wildcard P
>  keeping without P -> not (each matches wildcard P)
>  keeping matching P -> each matches pattern P
>  keeping not matching P -> not (each matches wildcard P)
> 
>  discarding where P -> not P
>  discarding with P -> not (each matches wildcard P)
>  discarding without P -> each matches wildcard P
>  discarding matching P -> not (each matches pattern P)
>  discarding not matching P -> each matches wildcard P
> 
> So the actual underling operation is the same: P is a boolean predicate operating on 'each', where each is taken to be each 'chunk' of X in turn; if P(each) returns true, the element is kept, otherwise it is discarded.
> 
> I quite like the above - it has a very simple underbelly (a single operation!), but the actual English-like syntax is a true and correct sentence.
> 
> What do people think?

I think it’s nice sugar but it adds complexity when trying to understand the statement. You need to comprehend the expression or pattern then comprehend the relationship between discarding/keeping and with | without | not matching | where in order to figure out what will actually happen. I would rather [by { keeping | discarding }] be a parser error if used with without and not matching.

Cheers

Monte


More information about the use-livecode mailing list