valueDiff for arrays?
David Glasgow
dvglasgow at gmail.com
Sun Aug 5 12:23:04 EDT 2018
Maybe 'strain' could be a culinary synonym?
;-)
Best wishes
David Glasgow
Sent from my iPad via iBrain & iFingers
LinkedIn
> On 5 Aug 2018, at 16:36, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> This is getting pretty contorted and is becoming less like natural language. For what it's worth, I have never been confused by the current use of filter. I think of it as pouring soup through a wire strainer. Filtering "with" keeps the solids. Filtering "without" dumps them and keeps the liquid.
>
> Maybe I cook too much. In any case, the solids (what remains after filtering) are the things you're either keeping or discarding.
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>> On August 5, 2018 9:38:45 AM Brian Milby via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Probably better:
>>
>>
>> filter [{lines | items | keys | elements} of] filterSource {keeping | discarding | with | without | [not] matching} {[{wildcard | regex} pattern] filterPattern | where filterExpression} [into targetContainer]
>>
>>
>> So Monte’s example would be:
>> filter keys of tFoo keeping where tFoo[each] is not tBar[each]
>> (And to get Richard’s result you would need to follow this by an intersect each way. The filter would replace the repeat loop in Mark’s solution)
>>
>>
>> Even though “with where” would be syntactically correct, the preferred usage would be “keeping where”.
>>
>> Thanks,
>> Brian
>>> On Aug 5, 2018, 7:32 AM -0500, Mark Waddingham via use-livecode <use-livecode at lists.runrev.com>, wrote:
>>> On 2018-08-05 07:31, Monte Goulding via use-livecode wrote:
>>> > Given I have been wanting to do ^ for a couple of years I decided to
>>> > just go ahead and do it… might be a while before we have time to
>>> > bikeshed the syntax though.
>>> >
>>> > https://github.com/livecode/livecode/pull/6626
>>> > <https://github.com/livecode/livecode/pull/6626>
>>> >
>>> > Examples:
>>> > local tFoo,tBar
>>> > put "foo" into tFoo[1]
>>> > put "bar" into tFoo[2]
>>> > put "baz" into tBar[1]
>>> > put "bar" into tBar[2]
>>> > filter keys of tFoo with expression tFoo[each] is tBar[each]
>>> > — tFoo now has one key 2 which is `bar`
>>> >
>>> > put “yes,foo” & return & “no,bar” into tFoo
>>> > filter lines of tFoo with expression item 1 of each is “yes”
>>> >
>>> > We could feasibly not use `with|without` for this forcing the
>>> > expression to return true to filter. If we went that way then perhaps
>>> > `where` would be nicest?
>>> >
>>> > filter lines of tFoo where item 1 of each is “yes”
>>>
>>> Geez @Monte - you do like creating work for me don't you! ;)
>>>
>>> In terms of syntax - definitely not 'with expression' - that's ghastly.
>>> It is a 'where' clause - in the same vein as SQL and other query
>>> languages - so no bike-shedding required there (also, pleasingly, all
>>> other 'filter' types become sugar for a where clause using operators
>>> which the language does not have yet - but obviously we have the code
>>> for...).
>>>
>>> If we are going to bike-shed over syntax - can we do so over the use of
>>> 'filter' itself. I don't know why but I have a complete mental block
>>> about it - regardless of how many times I use it or read it - I always
>>> have to 'double-think' to work out what form to use - is that just me?
>>>
>>> filter <things> of X with Y
>>> filter <things> of X without Y
>>>
>>> I couldn't tell you just by looking *what* they actually do. I'm not
>>> sure why but I think the verb is actually wrong - in all cases you have
>>> a set of things and you are either keeping an element, or removing an
>>> element... So I wonder if:
>>>
>>> keep <things> of X where Y
>>> discard <things> of X where Y
>>>
>>> (I'm not particularly attached to keep/discard - but it does need to be
>>> a pair of 'true' antonyms which don't intersect with any other 'core'
>>> pairs of such things we have).
>>>
>>> Might be more appropriate?
>>>
>>> Of course, maybe it is just 'with' / 'without' are inappropriate, and
>>> 'where' might actually help me retrain my mind to see with/without as
>>> the sugar they truly are.
>>>
>>> Anyway, thought it worth throwing out there to see what people think?
>>>
>>> Warmest Regards,
>>>
>>> Mark.
>>>
>>> --
>>> Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
>>> LiveCode: Everyone can create apps
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list