r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

BrianH
13-Feb-2009
[12378]
make blk -> make block!
Steeve
13-Feb-2009
[12379]
not only that :)
BrianH
13-Feb-2009
[12380]
The resluting block will be pairs of references to the beginning 
and end of his subseries. He can then get any subseries he needs 
by referencing it using the beginning and references with the /part 
option of COPY or INSERT, though using CHANGE or REMOVE will mess 
up the offsets of any subsequent references unless he is referring 
to a list! type.
Tomc
13-Feb-2009
[12381]
a rose by any name ....  new and block both end up with the data 
so it is still copying
BrianH
13-Feb-2009
[12382]
No, you are not inserting copies, you are inserting *references to 
the original*.
Steeve
13-Feb-2009
[12383]
ok Brian, but still missing something, (insert/only new) :)
BrianH
13-Feb-2009
[12384]
Yeah. I am actually working on something else right now, so errors 
are to be expected here.
Tomc
13-Feb-2009
[12385]
Ahhh! I see  hmmm  I think all I will  need to do is reorder *between* 
references and subject those  sub-blocks 
 to further partitioning
BrianH
13-Feb-2009
[12386]
The new block is really an index (in the database sense). You can 
sort and manipulate the index, then use the result to build a new 
version of the data if you like.
Tomc
13-Feb-2009
[12387]
yep
Steeve
13-Feb-2009
[12388]
the only thing you can't do is a mold or a form of this index :)
BrianH
13-Feb-2009
[12389x2]
I'm backporting the last of the R3 reflection functions to R2 right 
now...
TYPES-OF - it's a nasty one to implement.
Tomc
13-Feb-2009
[12391]
what are the costs when a (sub)block is reordered ?
Steeve
13-Feb-2009
[12392]
skiped or sorted ?
Tomc
13-Feb-2009
[12393]
both actually
BrianH
13-Feb-2009
[12394x2]
You want to make all of your planned changes to the index, then build 
them all at once into new data.
Otherwise the positions get messed up.
Steeve
13-Feb-2009
[12396]
skiping a block has no cost (no data modified), sorting has cost 
(data modified)
BrianH
13-Feb-2009
[12397]
SORT with a custom compare function would be fast to use here.
Tomc
13-Feb-2009
[12398x2]
positions get messed up if and only if the end points of the sub 
range are shuffled in the sort ...
and as their index can be known  beefore hand they can be reset if 
needed. i think
BrianH
13-Feb-2009
[12400]
No, positions get messed up if the length of the data series *anywhere 
before the position* changes. The only datatype this is not true 
for is list!, which is not future compatible.
Tomc
13-Feb-2009
[12401]
but reordering should not change a length
Steeve
13-Feb-2009
[12402x2]
but if the sort on the default data block is applied with a skip 
size equal to your span, then positions are not messed up, is that 
what you mean ?
in that case, it's right
BrianH
13-Feb-2009
[12404]
Reordering will change the length of the portion of the series before 
the moved segments, depending on where they are moved.
Steeve
13-Feb-2009
[12405]
but not if he's sorting data with a skip size equal to the span
BrianH
13-Feb-2009
[12406]
However, sorting the index won't change any of the references that 
the index is pointing to, because the underlying data doesn't change. 
Once you are done sorting and manipulating your index you can commit 
the changes, which means building new data from the index references.
Tomc
13-Feb-2009
[12407x2]
all movement between (and including ) two reffrences stays between 
those same two reffrences
and yes the span (# of columns) is the same  for sorting and skipping
Steeve
13-Feb-2009
[12409]
so no prob, if you don't insert or remove data
BrianH
13-Feb-2009
[12410]
Right. I am more concerned with movement that happens *before both* 
of the two references. That is what can mess up positions.
Tomc
13-Feb-2009
[12411x3]
the initial offset  (which column)  the sort is on changes, but that 
is 
sort/skip/compare/part  ref1 span   column  ref2

Brian's concern is what does this sort do to ref5 and ref 6  position. 
are they still valid.

time to experiment
as this is building a tree, structure later operations always occur 
strictly within earlier operation boundaries
thanks Brian and Steeve. good night
BrianH
13-Feb-2009
[12414]
Good night.
TomBon
19-Feb-2009
[12415x2]
how can this avoided?


does a object! defined within a object! (embedded) breaks with the 
clone/ingherit rule?

calling a function within a object! which e.g. changing a value within 
the embedded object!
changing the parent AND the child object!.

template: make object! [
	obj-in-obj: 	make object! [a: make integer! 0]
	b: 		make integer! 0
	c: func [val] [
		obj-in-obj/a:   val
		b:		val
	]
]  

wcopy: make template []
probe template
probe wcopy
wcopy/c 1000
probe template
probe wcopy

what I am doing wrong here?
and is there any easy way to clear a object at once
without resetting every single variable in the object
I have a big loop (20.000+) which fills many objects with datas.
the objects contains also functions writing and calculating
data within other objects (all within a global context/object). 

each loop is a new run, so I need a new or cleared set of objects 

for every loop. looks like cloning doesn't work for me (see above). 

I could reset every single value, but this will cost me a day minimum.

do I overseen some simple solution here?
[unknown: 5]
19-Feb-2009
[12417]
Not sure what your trying to do but in your function change the object 
reference to self such as:

self/obj-in-obj/a:

see if that makes a difference
sqlab
19-Feb-2009
[12418]
Why you do not make your template just an unevaluated block and then 
you always generate a new object or you never change your template, 
just the descendants ?
DideC
19-Feb-2009
[12419x2]
Its by design : subojbect are not copied by 'make. All R2 VID is 
build on this concept (shared objects).
You need a 'make-deep function that (recursively ?) digg into the 
copied object and copy each subobject it find. I'm sure people arround 
have one in their HD (not me).
TomBon
19-Feb-2009
[12421x3]
paul, makes no difference..sqlab, wrap the object into a unevaluated 
block?
DideC, yes I guessed that. thx
a copy/deep second or third object! doesn't work either.
[unknown: 5]
19-Feb-2009
[12424]
Have you considered using a construct?
TomBon
19-Feb-2009
[12425x2]
paul, I never used construct. can it serve nested constructs also?
will take a look into the docs about it...
Graham
19-Feb-2009
[12427]
does this work?

create-template: func [ d [integer!]
] [
	make object! [
		obj-in-obj: 	make object! [a: make integer! d]
		b: 		make integer! 0
		c: func [val] [
			obj-in-obj/a:   val
			b:		val
		]
	]
]

a: create-template 0
b: create-template 1000
probe a
probe b
b/c 3000
probe a 
probe b