About WindowShape

Jan Schenkel janschenkel at yahoo.com
Tue Jun 3 01:45:02 EDT 2003


--- Geoff Canyon wrote:
> On Monday, June 2, 2003, at 09:10  AM, Jan Schenkel
> wrote:
> 
> > Ah, and my FoxPro background shows again : I
> didn't
> > mean replicate() as in cloning a control, but as
> in
> >   replicate("0",10) => "0000000000"
> > which would come in handy for this sort of
> > mass-production of the same character.
> 
>  From LispLib:
> 
> function dupef pDelimiter,pTimes,pList -- returns
> pList repeated pTimes 
> with pDelimiter between
> 
> So:
> 
> dupef("",10,"0") => "0000000000"
> dupef(", ",3,"wocka") => "wocka, wocka, wocka"
> -- note lack of trailing comma/space
> 
> regards,
> 
> Geoff Canyon
> 

--- Shao Sean wrote:
> there's something like that in my string library
> (libString_repeat)..
> 
> -Sean

Thanks for the pointers, guys. Of course this function
is easy to write in Transcript, but I have a feeling
that the engine could do this faster than :

function replicate pString, pTimes
  repeat pTimes times
    put pString after tResult
  end repeat
  return tResult
end replicate

because every time you put after, the engine has to
resize the variable ; unless Scott Raney has put in
some advanced optimisation code, of course.

Jan Schenkel.

PS: To be honest with you, I didn't do any speed
checks so this may be a moot point ; but it just
sounds logical that this could be optimised.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com



More information about the use-livecode mailing list