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

copy/deep

 [1/8] from: rotenca::telvia::it at: 24-Jul-2003 15:04


I should like that with a new refinement (es. only) copy/deep does not make 2 copies of the same block, referenced twice, but only one and adjust references. For example now happens: a: [] b: reduce [a a]; == [[] []] same? b/1 b/2; == true c: copy/deep b; == [[] []] same? c/1 c/2;== false Instead I should like: c: copy/deep/only b; == [[] []] same? c/1 c/2; == true --- Ciao Romano

 [2/8] from: lmecir:mbox:vol:cz at: 24-Jul-2003 15:17


Hi Romano,
> I should like that with a new refinement (es. only) copy/deep does not make 2 > copies of the same block, referenced twice, but only one and adjust
<<quoted lines omitted: 11>>
> Ciao > Romano
I wrote a function like that in http://www.fm.vslib.cz/~ladislav/rebol/identity.html#section-24 -L

 [3/8] from: rotenca:telvia:it at: 24-Jul-2003 15:32


Don't you think that the copy/deep/only beahviour should be the default for functions like foreach which make a copy/deep of the body? Now they change the internal structure of the body. --- Ciao Romano

 [4/8] from: AJMartin:orcon at: 25-Jul-2003 5:04


Romano asked:
> Don't you think that the copy/deep/only beahviour should be the default
for functions like foreach which make a copy/deep of the body?
> Now they change the internal structure of the body.
Can you give an example, please? Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ http://Valley.150m.com/

 [5/8] from: rotenca:telvia:it at: 25-Jul-2003 0:50


Hi Andrew,
> Can you give an example, please?
The example was in the previous message and is the reason for which Brett collect does not work with Foreach: it uses a reference to the result block used by insert, but after the copy/deep, the reference has changed and it refers now to a copy of the the result block.
>From the previous message:
now happens: a: [] b: reduce [a a]; == [[] []] same? b/1 b/2; == true c: copy/deep b; == [[] []] same? c/1 c/2;== false Instead I should like: c: copy/deep/only b; == [[] []] same? c/1 c/2; == true Visual explanation (i hope): b is: [ 1 2 ] | | \ / a After the copy/deep c is: [ 1 2 ] | | | | copy of a another copy of a What it should be? [ 1 2 ] | | \ / copy of a --- Ciao Romano

 [6/8] from: rotenca:telvia:it at: 25-Jul-2003 1:31


> How about this?
a: [] b: reduce[a a] c: copy b
>Or am I being simplistic? :)
As you know, this does not make a copy of the nested blocks. And foreach (and others functions) needs a copy also of nested blocks. same? a c/1;== true --- Ciao Romano

 [7/8] from: andrew:martin:colenso:school at: 25-Jul-2003 11:18


Romano wrote:
> Instead I should like: > c: copy/deep/only b; == [[] []] > same? c/1 c/2; == true
How about this?
>> c: copy b
== [[] []]
>> same? c/1 c/2
== true Or am I being simplistic? :) Andrew J Martin Attendance Officer & Information Systems Trouble Shooter Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 http://colenso.net/scripts/Wiki.r?AJM http://www.colenso.school.nz/ DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0 Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]

 [8/8] from: g:santilli:tiscalinet:it at: 25-Jul-2003 9:48


Hi Andrew, On Thursday, July 24, 2003, 7:04:28 PM, you wrote:
>> Now they change the internal structure of the body.
AJM> Can you give an example, please? Brett's code in COLLECT didn't work for FOREACH because of COPY/DEEP (the two instances of RESULT were made to be two different blocks). Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted