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

World: r3wp

[Rebol School] Rebol School

Steeve
4-Jan-2009
[1253]
Graham, your functions could append their results in a global result 
block, so that you just need to loop and wait into that one ?
Graham
4-Jan-2009
[1254x4]
What happens if the functions fail?  I could end up waiting for a 
while ....
Ordinarily if I had a couple such functions, I would just call one 
in the callback of the other.
Just that here I don't know how many functions I need to call in 
advance.
OTOH, I have done what you have suggested before .. which is basically 
turning an async function into a synchronous one by waiting till 
it finishes by use of a flag of some type.
BrianH
4-Jan-2009
[1258]
Steeve, the function was not added for the /innto option, it was 
added for unset! skipping, which needs to be done all the time.
Steeve
4-Jan-2009
[1259]
the result stack could receive some messages too, to know the current 
status (your flag), you could throw errors in the result stack too
BrianH
4-Jan-2009
[1260]
Good idea about preallocating for the /into option though.,
Steeve
4-Jan-2009
[1261]
Brian, is the R3 map function dealing with unset! values too ?
BrianH
4-Jan-2009
[1262]
Yes.
Steeve
4-Jan-2009
[1263]
ok
BrianH
4-Jan-2009
[1264x2]
It's not retrocompatibility with R3: R3 is the future, so it's forward 
compatibility. If it's not forward compatible with R3, it won't get 
added as a mezzanine to R2. That is a major difference between writing 
mezzanines and just writing fuunctions.
I really do want to make it fast though, because slow functions don't 
get used in optimal code. This is why most of the loop functions 
from R2 have been converted to natives: The non-native loop functions 
were getting optimized out of R2 code.
Steeve
4-Jan-2009
[1266]
so you could use 2 differrent foreach blocks
BrianH
4-Jan-2009
[1267]
How would that help?
Steeve
4-Jan-2009
[1268]
faster when using default map
BrianH
4-Jan-2009
[1269]
The foreach block isn't affected by the /into option, so the code 
would be the same.
Steeve
4-Jan-2009
[1270]
not the same implementation than with /into
BrianH
4-Jan-2009
[1271]
How so?
Steeve
4-Jan-2009
[1272x2]
you don't need to use a result var by default, remember
IIRC, insert tail [], is faster than result: insert result
BrianH
4-Jan-2009
[1274x2]
No, you use tail instead, which is slower. The increase in overhead 
comes from the if value? stuff.
There is not that much difference between insert tail and res: insert 
res (ignoring caching issues, tail is faster). The if value? stuff 
is the big hit though.
Steeve
4-Jan-2009
[1276]
hum...
BrianH
4-Jan-2009
[1277x3]
That is not optional though. You might find it interesting that I 
did break compatibility by not backporting a bug :)
The divide-by-zero error is better than the infinite loop :(
The problem with preinserting with the /into option is break handling. 
If you break in the middle of the process, you end up with a bunch 
of nones in the middle of your series. I am interested in solutions 
to this.
Steeve
4-Jan-2009
[1280]
something i don't uderstand with your unset! test.
>>head insert [] do []
== []

so, unset! values cause no problem with insert ??? why do you need 
to test that ?
have you an example ?
BrianH
4-Jan-2009
[1281]
>> head insert [] ()
== [unset]
Steeve
4-Jan-2009
[1282]
about the preinserting, perhaps you should insert in a second block, 
and then add the second into the result at the end of the process
BrianH
4-Jan-2009
[1283]
What version of REBOL are you testing with?
Steeve
4-Jan-2009
[1284]
R2
BrianH
4-Jan-2009
[1285x2]
Be more specific.
In 2.7.6:
>> head insert [] do []
== [unset]
Steeve
4-Jan-2009
[1287]
lol, SYSTEM/VERSION is a tuple of value: 1.3.2.3.1
BrianH
4-Jan-2009
[1288]
I wondering if there was a regression in INSERT at some point in 
the last few years.
Steeve
4-Jan-2009
[1289x2]
shit
about the preinserting when /into.
1/use a new result block! (like for default)

2/when exiting the foreach loop, insert the result into the input 
result
BrianH
4-Jan-2009
[1291]
The problem is that the whole point of the /into option is to reduce 
the number of intermediate blocks.,
Steeve
4-Jan-2009
[1292x4]
will work with break but not with return.
or you do a remove/part at the end (need of 2 pointers)
or you do nothing...
and it stay slow
BrianH
4-Jan-2009
[1296x2]
It's a quandry. I already had to add a local function to get around 
the limits of FOREACH, because the alternatives were slower. Do you 
have a solution that handles both breaks and returns?
Keep in mind that returns are supposed to be passed through, but 
you can't detect them.
Steeve
4-Jan-2009
[1298x2]
local function again.
the into option begins th have a huge cost....
BrianH
4-Jan-2009
[1300]
Only in one case: Inserting into the middle of a series, which is 
usually slow. We could just special case that one situation, or accept 
that it is as slow as it is in the rest of REBOL.
Gregg
4-Jan-2009
[1301]
Graham, how about making a jog processor context. The callback func 
is in there, along with a block to collect the data, so it knows 
what results it should get. Have each function call it back with 
its chunk of data. The callback collects the results, and checks 
to see when a "batch" is complete. Then you just need a timeout element 
(store the start time), and something to ping it. If you store the 
original calls, the processor can retry failed calls.
Steeve
4-Jan-2009
[1302]
(about the unset! drawback) it was core 2.6.3.
i wondering if it's not a bug of 2.7.6