valueDiff for arrays?

Monte Goulding monte at appisle.net
Sun Aug 5 01:31:59 EDT 2018



> On 5 Aug 2018, at 11:59 am, Monte Goulding via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Just to throw it out there I still want to add `each` to filter one day. So in this case I think it would be:
> 
> filter keys of tArray1 with expression \
>      each is among the keys of tArray2 and \
>      tArray1[each] is not tArray2[each]


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”

Cheers

Monte




More information about the use-livecode mailing list