The merge function is awesome!

Geoff Canyon gcanyon at gmail.com
Thu Jan 17 15:45:38 EST 2019


On Thu, Jan 17, 2019 at 11:01 AM hh via use-livecode <
use-livecode at lists.runrev.com> wrote:

> > Geoff wrote:
> > ... you've just given me an idea how to handle things like font/styling
> > tags. Something like:
> > function ifTag b,o,s,c
> >     if b then return o & s & c else return s
> > end ifTag
>
> Allow me two remarks.
>
> 1. You could use, in order to avoid the check:
>
> function tag s,o,c
>     return o & s & c
> end tag
>
> And both, tag("inner") and tag("inner","left-","-right") work.
>

I'm thinking about situations where the tags are optional, so something
like:

ifTag(word 1 of tID is "group","<b>",the name of tID,"</b>")

I'd have to do a timing test to see whether it's more costly to do the
function call or perform the test twice. And of course in this instance it
would be easy enough to simply use:

<?if word 1 of tID is "group" then return "<b>", & the name of tID & "</b>"
else return the name of tID?>

But it would become unwieldy for more complex strings.

>
> 2. Also array-things work with merge, like [[a[1]]].
>

Yep, definitely planning to take advantage of this if possible:
https://github.com/gcanyon/navigator/issues/21



More information about the use-livecode mailing list