Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Implicit Copying: WAS => Re: Re: How to remove the last item of a serie

From: jason::cunliffe::verizon::net at: 6-May-2002 8:56

Gabriele
> remove skip tail test -2
:-)) [...snip...]
> REBOL is very different here. Data is not usually copied > implicitly; i.e. something like: > > a: b > > is always O(1) whatever datatype B is. (The only "implicit" > copying occurring in REBOL is during reallocation, when you grow a > series out of its limits. Even in this case, anyway, you are able > to avoid it, by preallocating the right amount of memory for your > series.)
What does 0(1) mean? when you grow a series out of its limits ..Does that mean every time you add/append to it? In general when I do
>> test: ""
== ""
>> append test {hello }
== "hello "
>> append test {hello }
== "hello hello "
>> append test {hello }
== "hello hello hello " ..is REBOl copying 'test' internally each time? A real example is when HTML pages being built in Vanilla. By default they start off with something like: htmlpage: make string! 1024 htmlhead: {<html><head><title>PageTitle</title></head><body>} append htmlpage rejoin [htmlhead {<h1>Welcome to this example</h1>}] ; then adds lots more html dynamically before returning the completed page. Once 'htmlpage' is over 1024, does REBOL also starts copying it in the background for each addition? We need to build large image hyperlink matrices in HTML and want REBOL to return the result string as fast as possible.
> This means that in REBOL you are really able to control the > complexity of your algorithms, if you are willing to. Most other > scripting languages I know are doing too much things behind the > scenes to make this easy/feasible. > > I really think simplicity has too much advantages. :-)
Yes Good post Gabriele. Thank you. ./Jason