valueDiff for arrays
Mark Waddingham
mark at livecode.com
Wed Aug 8 07:37:12 EDT 2018
I'd suggest transplant is actually move - an idea which has been taken to the level of obsession in modern c++ and new languages like Rust (which I want to like - but it's highly technical demands just leave a bitter taste in my mouth - impressive, yes; the right approach - definitely not, IMHO anyway!).
For LCS 'move' would allow to elide a put and delete. However there are few cases I can think of (if any!) where it is required save for the fact it would make certain things potentially more performant in the absence of even a relatively simple data-flow based optimisation phase.
Also I'm not sure it could be implemented in the current LCS mechanism to actually give that performance so it would essentially be a bit of syntactic sugar for 'put' then 'delete'.
Perhaps reasonable from the point of view of clear expression of intent though!
Warmest Regards,
Mark.
Sent from my iPhone
> On 7 Aug 2018, at 17:35, Quentin Long via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Suggestion for the language-token for this function: "transplant".
>
> transplant [qualification] from [SourceArray] to [TargetArray]
>
> [qualification] is a pattern/expression which describes exactly which bits you want to move from SourceArray to TargetArray.
>
> If TargetArray doesn't exist, it should be created to hold the stuff from SourceArray.
>
> It occurs to me that "transplant" might also be useful as a string-manipulation function:
>
> transplant [ChunkType]s where [qualification] from [SourceContainer] to [TargetContainer]
>
> Am thinking that the default behavior should be to have the transplanted bits be added to the *end* of TargetContainer. Again, if TargetContainer doesn't exist, it should be created. It might be useful to be able to specify exactly where the transplanted bits get inserted, so maybe:
>
> transplant [ChunkType]s where [qualification] from [SourceContainer] to [Location] of [TargetContainer]
>
> "Location" could be "start", or "end", at minimum, or possibly an expression that evaluates to a location within TargetContainer.
>
> Am unsure how much of a hassle it would be to implement this, so I shall leave it in the capable hands of Mr. Waddingham & Co.
>
>
>
> "Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
> Read the webcomic at [ http://www.atarmslength.net ]!
> If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].
> _______________________________________________
> 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