valueDiff for arrays?

Mark Waddingham mark at livecode.com
Sun Aug 5 12:51:23 EDT 2018


Well...

strain X through Y

Does kind of work - although it still doesn't explicitly relate what is to be kept (which is implicit in context in a recipe) and that's the deficiency in the current syntax.

We can make all parts optional in the new proposed form which would mean you can still write a significant contraction. However, by being verbose you can make the command a complete representation of what is being done without needing to understand the context of the operation (which means code which is more verbose is much more quickly readable).

Anyway, maybe when we finally get to open language we can have a culinary based variant syntax ;)

Warmest Regards,

Mark.

Sent from my iPhone

> On 5 Aug 2018, at 11:23, David Glasgow via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 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
> _______________________________________________
> 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