valueDiff for arrays?

classic Classic list List threaded Threaded
135 messages Options
1 ... 4567
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
On 08/07/2018 07:57 PM, Dick Kriesel via use-livecode wrote:

> On Aug 7, 2018, at 5:47 PM, Alex Tweedly via use-livecode <[hidden email]> wrote:
>>
>> Is there an easy way to test whether an array is (currently) a sequence array ?
>>
>> something easier than
>>      put the extents of tArray into tmp
>>      if item 1 of tmp = 1 AND item 2 of tmp = the number of elements in tArray then
>
> slightly easier, at least:
> function isSequence p
>
>      return the extents of p is 1, number of elements in p
>
> end isSequence

If I'm understanding things right there's more to it:
The keys all have to be integers and (I think) only those integers from
1 to (the number of keys).

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode

> On Aug 7, 2018, at 8:35 PM, Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 08/07/2018 07:57 PM, Dick Kriesel via use-livecode wrote:
>> On Aug 7, 2018, at 5:47 PM, Alex Tweedly via use-livecode <[hidden email]> wrote:
>>>
>>> Is there an easy way to test whether an array is (currently) a sequence array ?
>>>
>>> something easier than
>>>     put the extents of tArray into tmp
>>>     if item 1 of tmp = 1 AND item 2 of tmp = the number of elements in tArray then
>> slightly easier, at least:
>> function isSequence p
>>     return the extents of p is 1, number of elements in p
>> end isSequence
>
> If I'm understanding things right there's more to it:
> The keys all have to be integers and (I think) only those integers from 1 to (the number of keys).

That was my understanding as well.
.Jerry



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode

> On Aug 7, 2018, at 9:29 PM, Jerry Jensen via use-livecode <[hidden email]> wrote:
>
>> On Aug 7, 2018, at 8:35 PM, Mark Wieder via use-livecode <[hidden email]> wrote:
>>
>> On 08/07/2018 07:57 PM, Dick Kriesel via use-livecode wrote:
>>> On Aug 7, 2018, at 5:47 PM, Alex Tweedly via use-livecode <[hidden email]> wrote:
>>>>
>>>> Is there an easy way to test whether an array is (currently) a sequence array ?
>>>>
>>>> something easier than
>>>> put the extents of tArray into tmp
>>>> if item 1 of tmp = 1 AND item 2 of tmp = the number of elements in tArray then
>>> slightly easier, at least:
>>> function isSequence p
>>> return the extents of p is 1, number of elements in p
>>> end isSequence
>>
>> If I'm understanding things right there's more to it:
>> The keys all have to be integers and (I think) only those integers from 1 to (the number of keys).
>
> That was my understanding as well.
> .Jerry

"the extents" implements those rules, so "isSequence" doesn’t need to.

Or is there evidence "isSequence" fails?

— Dick
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
I think you are right - I will double check.

There is actually an internal function (in C) - two in fact - IsSequence and IsNumericSequence which we should plumb into 'is a' to make this clearer.

They basically use the extents internal impl (well an optimized form in one case).

Warmest Regards,

Mark.

Sent from my iPhone

> On 8 Aug 2018, at 00:11, Dick Kriesel via use-livecode <[hidden email]> wrote:
>
>
>>> On Aug 7, 2018, at 9:29 PM, Jerry Jensen via use-livecode <[hidden email]> wrote:
>>>
>>> On Aug 7, 2018, at 8:35 PM, Mark Wieder via use-livecode <[hidden email]> wrote:
>>>
>>> On 08/07/2018 07:57 PM, Dick Kriesel via use-livecode wrote:
>>>>> On Aug 7, 2018, at 5:47 PM, Alex Tweedly via use-livecode <[hidden email]> wrote:
>>>>>
>>>>> Is there an easy way to test whether an array is (currently) a sequence array ?
>>>>>
>>>>> something easier than
>>>>> put the extents of tArray into tmp
>>>>> if item 1 of tmp = 1 AND item 2 of tmp = the number of elements in tArray then
>>>> slightly easier, at least:
>>>> function isSequence p
>>>> return the extents of p is 1, number of elements in p
>>>> end isSequence
>>>
>>> If I'm understanding things right there's more to it:
>>> The keys all have to be integers and (I think) only those integers from 1 to (the number of keys).
>>
>> That was my understanding as well.
>> .Jerry
>
> "the extents" implements those rules, so "isSequence" doesn’t need to.
>
> Or is there evidence "isSequence" fails?
>
> — Dick
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
On 08/08/2018 04:18 AM, Mark Waddingham via use-livecode wrote:

>> "the extents" implements those rules, so "isSequence" doesn’t need to.
>>
>> Or is there evidence "isSequence" fails?

on test
    local i

    repeat with i=1 to 10
       put "true" into sArray[i]
    end repeat
    put "false" into sArray[pi]
    delete variable sArray[4]
    put the extents of sArray && the number of elements of sArray & cr
after msg
end test

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
Yup - but isSequence would be correct - false.

The extents might be 1,10

But isSequence would check whether it was 1,9 ...

Mark.

Sent from my iPhone

> On 8 Aug 2018, at 12:19, Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 08/08/2018 04:18 AM, Mark Waddingham via use-livecode wrote:
>
>>> "the extents" implements those rules, so "isSequence but " doesn’t need to.
>>>
>>> Or is there evidence "isSequence" fails?
>
> on test
>   local i
>
>   repeat with i=1 to 10
>      put "true" into sArray[i]
>   end repeat
>   put "false" into sArray[pi]
>   delete variable sArray[4]
>   put the extents of sArray && the number of elements of sArray & cr after msg
> end test
>
> --
> Mark Wieder
> [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
On 08/08/2018 10:54 AM, Mark Waddingham via use-livecode wrote:
> Yup - but isSequence would be correct - false.
>
> The extents might be 1,10
>
> But isSequence would check whether it was 1,9 ...

Ah. OK, but I was actually replying to Dick Kriesel's isSequence
function, which incorrectly would reply true. I'm not familiar with any
other isSequence function. Do you have a reference for that?

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
On 2018-08-08 23:19, Mark Wieder via use-livecode wrote:

> On 08/08/2018 10:54 AM, Mark Waddingham via use-livecode wrote:
>> Yup - but isSequence would be correct - false.
>>
>> The extents might be 1,10
>>
>> But isSequence would check whether it was 1,9 ...
>
> Ah. OK, but I was actually replying to Dick Kriesel's isSequence
> function, which incorrectly would reply true. I'm not familiar with
> any other isSequence function. Do you have a reference for that?

Haha - okay yes - I must confess I missed one very important line in
your 'test' handler:

    put "false" into sArray[pi]

This actually means there is a bug in the engine 'extents()' function
(the lower-level routines the engine uses to check for Sequences /
NumericSequences are correct as they use an optimized form, as they
don't require generation of the extents).

Specially, the extents function is parsing the array key (item list -
extents can act on multi-dimensional arrays) as numbers, not as
integers. Therefore it is erroneously returning a set of extents for an
array which contains a non-integer key.

So - Dick's function is correct, it is the extents function which is
currently incorrect.

Warmest Regards,

Mark.

--
Mark Waddingham ~ [hidden email] ~ http://www.livecode.com/
LiveCode: Everyone can create apps


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
On 08/08/2018 04:16 PM, Mark Waddingham via use-livecode wrote:

OK. Bug filed.

https://quality.livecode.com/show_bug.cgi?id=21476

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
In reply to this post by Clarence Martin via use-livecode
Are you working with "LiveCode UI elements appear in lists of stacks"
enabled? I specifically named all the script behaviors for Navigator
starting with "rev" and they don't show up in the Project Browser for me.
Not that I had looked before this, I use Navigator for everything. ;-)

On Sat, Aug 4, 2018 at 11:42 AM Mark Wieder via use-livecode <
[hidden email]> wrote:

> On 08/04/2018 11:23 AM, Mark Waddingham via use-livecode wrote:
>
> > However, over time I'd suggest we look at it sitting in a
> > mobile-permissions script library. Given the dynamic nature of handler
> > dispatch in LC, there's all kinds of things we can do to make it really
> > easy to adapt for particular projects.
>
> Although I do have to bemoan the proliferation of script stacks in the
> Project Browser list. This especially became onerous when the Navigator
> plugin started using script-only stacks. It's a pain having to scroll
> through all those stacks that I'm never going to edit, and it's a pain
> having to remove the plugin each time a new build comes out so that I
> don't have to scroll through them just to work on system stacks.
>
> --
>   Mark Wieder
>   [hidden email]
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
In reply to this post by Clarence Martin via use-livecode
On Sat, Aug 4, 2018 at 12:00 PM Brian Milby via use-livecode <
[hidden email]> wrote:

> Plugins should probably be de-scriptified for distribution for this
> reason.
>

This would be very bad for Navigator. Navigator shows multiple copies of
itself (as many as you like/can tolerate) and this is only possible because
everything is based on behaviors. Before I made the switch, Navigator was
limited to three copies of itself, because making any more caused Bad
Things to happen. It's been so long I don't remember the details, and
obviously that was back in version 5 or earlier, so things might have
changed, but regardless of how many gigabytes of RAM we have, duplicating
Navigator's code over and over again is problematic.

In short, "I can't go back, man! I won't!" :-)
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
In reply to this post by Clarence Martin via use-livecode
I do it both ways, the problem is that behavior scripts created for
maintaining a stack (version control) are inconvenient in the IDE.  I've
thought about suggesting a multiple step scriptify for IDE tools.  The
first step would be to create a card to house all behavior buttons.  The
first round would scriptify everything to buttons on that card.  The second
round would generate the script only stacks.  Prior to distribution, the
second round would be reversed to have a cleaner namespace inside the IDE.

I've taken a different approach for my own work (Script Tracker).  I just
have my tool export all of the scripts to files.  I can version control the
files and edit them outside of the IDE.  My tool keeps them in sync.  Then
the distributed tool doesn't have any external file requirements.  I still
need to go back and move my SvgIconTool into this model (and will before
the next update).

On Fri, Aug 10, 2018 at 7:36 PM, Geoff Canyon via use-livecode <
[hidden email]> wrote:

> Are you working with "LiveCode UI elements appear in lists of stacks"
> enabled? I specifically named all the script behaviors for Navigator
> starting with "rev" and they don't show up in the Project Browser for me.
> Not that I had looked before this, I use Navigator for everything. ;-)
>
> On Sat, Aug 4, 2018 at 11:42 AM Mark Wieder via use-livecode <
> [hidden email]> wrote:
>
> > On 08/04/2018 11:23 AM, Mark Waddingham via use-livecode wrote:
> >
> > > However, over time I'd suggest we look at it sitting in a
> > > mobile-permissions script library. Given the dynamic nature of handler
> > > dispatch in LC, there's all kinds of things we can do to make it really
> > > easy to adapt for particular projects.
> >
> > Although I do have to bemoan the proliferation of script stacks in the
> > Project Browser list. This especially became onerous when the Navigator
> > plugin started using script-only stacks. It's a pain having to scroll
> > through all those stacks that I'm never going to edit, and it's a pain
> > having to remove the plugin each time a new build comes out so that I
> > don't have to scroll through them just to work on system stacks.
> >
> > --
> >   Mark Wieder
> >   [hidden email]
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
In reply to this post by Clarence Martin via use-livecode
In your case it may be a bit more complicated, but I would think still
attainable.  The key would be for the scripts to live in a sub stack that
didn't get duplicated.

On Fri, Aug 10, 2018 at 7:41 PM, Geoff Canyon via use-livecode <
[hidden email]> wrote:

> On Sat, Aug 4, 2018 at 12:00 PM Brian Milby via use-livecode <
> [hidden email]> wrote:
>
> > Plugins should probably be de-scriptified for distribution for this
> > reason.
> >
>
> This would be very bad for Navigator. Navigator shows multiple copies of
> itself (as many as you like/can tolerate) and this is only possible because
> everything is based on behaviors. Before I made the switch, Navigator was
> limited to three copies of itself, because making any more caused Bad
> Things to happen. It's been so long I don't remember the details, and
> obviously that was back in version 5 or earlier, so things might have
> changed, but regardless of how many gigabytes of RAM we have, duplicating
> Navigator's code over and over again is problematic.
>
> In short, "I can't go back, man! I won't!" :-)
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
Or the ui stack is a substack which gets duplicated as another substack under the same root, but empty, mainstack...

Mark.

Sent from my iPhone

> On 10 Aug 2018, at 19:48, Brian Milby via use-livecode <[hidden email]> wrote:
>
> In your case it may be a bit more complicated, but I would think still
> attainable.  The key would be for the scripts to live in a sub stack that
> didn't get duplicated.
>
> On Fri, Aug 10, 2018 at 7:41 PM, Geoff Canyon via use-livecode <
> [hidden email]> wrote:
>
>> On Sat, Aug 4, 2018 at 12:00 PM Brian Milby via use-livecode <
>> [hidden email]> wrote:
>>
>>> Plugins should probably be de-scriptified for distribution for this
>>> reason.
>>>
>>
>> This would be very bad for Navigator. Navigator shows multiple copies of
>> itself (as many as you like/can tolerate) and this is only possible because
>> everything is based on behaviors. Before I made the switch, Navigator was
>> limited to three copies of itself, because making any more caused Bad
>> Things to happen. It's been so long I don't remember the details, and
>> obviously that was back in version 5 or earlier, so things might have
>> changed, but regardless of how many gigabytes of RAM we have, duplicating
>> Navigator's code over and over again is problematic.
>>
>> In short, "I can't go back, man! I won't!" :-)
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: valueDiff for arrays?

Clarence Martin via use-livecode
In reply to this post by Clarence Martin via use-livecode
On 08/10/2018 05:36 PM, Geoff Canyon via use-livecode wrote:
> Are you working with "LiveCode UI elements appear in lists of stacks"
> enabled? I specifically named all the script behaviors for Navigator
> starting with "rev" and they don't show up in the Project Browser for me.

Exactly. And It's not just navigator that's clogging things up here, I
don't mean to single it out in particular. But if I need to work on a
system stack (and I do this all the time) then there's a lot of cruft
that shows up in the PB or the AB that I have to wade through to get to
where I want to be.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
1 ... 4567