valueDiff for arrays
Monte Goulding
monte at appisle.net
Wed Aug 8 05:52:42 EDT 2018
So the difference between transplant and filter is that transplant mutates both source and target by taking from source and adding to target while filter copies from source to target? Oh and that transplant would mutate an existing target rather than clobbering any existing value.
Hate the name but interesting idea. Personally I’ve been thinking about something like map reduce:
map <chunktype> of <source> [as <valueExpression>] [grouping by <groupExpression>] [where <filterExpression>] into <target>
So if you had a list:
foo,1,2,3
bar,4,5,6
baz,7,8,9
map lines of tList as sum(item 2 to -1 of each) \
grouping by item 1 of each \
where item 1 of each begins with “b” into tArray
Would create the array:
“bar” -> 10, “baz” -> 24
> On 8 Aug 2018, at 8:35 am, 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