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

World: r3wp

[!REBOL3]

Andreas
14-Dec-2010
[6657]
>> sext16: func [x] [32768 xor x - 32768]
>> sext16 to-integer #{ffff}
== -1
Oldes
14-Dec-2010
[6658x2]
>> shift shift to-integer #{FFFF} 48 -48
== -1

>> shift shift to-integer #{0001} 48 -48
== 1
My version seems to be a little bit faster:
>> sext16_v1: func [x] [32768 xor (to integer! x) - 32768]
>> sext16_v2: func [x] [shift shift to integer! x 48 -48]
>> dt [sext16_v1 #{ffff}]
== 0:00:00.00001
>> dt [sext16_v2 #{ffff}]
== 0:00:00.000009
Andreas
14-Dec-2010
[6660x7]
Your persone is a little bit saner as well :)
version*
Well, another idea for the map! performance degradation: the actual 
hash function used is flawed for >>2^24 keys.
Another indication: plain CHECKSUM computes a 24-bit CRC
I'm now quite confident that this is the underlying problem.
Conclusion: R3 map! is currently basically unusable for 2^24+ entries.
It should be rather easy to fix, though.
Pavel
14-Dec-2010
[6667x2]
2 Andreas:  2 ** 26 limit is hardcoded into checksum/hash function 
IMO, this hash function is used for calculating respective key hashes 
in map! datatype I think, nevertheless this hashing is pretty fast 
and could be used in in-file hashes, there the limit can be theoretically 
limiting. But still 2 ** 26 hash table is pretty huge indeed.
For 2**25 and 2**26 hash table sizes the hash function gives different 
hash numbers, so I think the limit is 2**26 (sorry I missed your 
observation few lines before you are right off course)
PatrickP61
16-Dec-2010
[6669]
Does anyone have any information / Documentation on how to invoke 
a separate R2 program from R3 and/or vice versa?  In other words, 
is it possible to have an R3 script running and start up a separate 
instance of another R2 and/or R3 program to complete some tasks and 
then resume the original script?


Is it possible to time the event to run in a pre-determined amount 
of time?  Say like 5 seconds for the second program to run, if not, 
then show some error message.


What, if any, communications can occur between the programs, passing 
arguments, blocks, files, urls, etc.
Rebolek
16-Dec-2010
[6670]
You can do that with CALL and communicate via TCP.
PatrickP61
16-Dec-2010
[6671]
Thank you Rebolek -- I'll check that out.
Oldes
18-Dec-2010
[6672]
Let's have:
	o: context [a: 1 b: 2]
I can do:
	values-of o ;== [1 2]

Can I update these values somehow to get o == make object! [a: 3 
b: 4]  just using block of values [3 4]?
BrianH
18-Dec-2010
[6673]
v: values-of o
... change v ...
set o v
Oldes
18-Dec-2010
[6674]
Great... and it is possible in R2 as well.. I'm still learning:)
Steeve
18-Dec-2010
[6675x2]
shortcut:
get o 
== [1 2]
if you want to set an object with another one, better to use
resolve/all o1 o2
Oldes
18-Dec-2010
[6677]
I wanted to avoid using objects as an extension's command argument, 
but I decided that it will be more user friendly to use object directly 
anyway... more work on C side, but it worths for it.
Awi
20-Dec-2010
[6678]
Is there a reason why map! does not allow date!, time! or pair! as 
keys?
Oldes
20-Dec-2010
[6679]
Is there a reason why codecs (like image loading) are not in host 
part?
Pekr
20-Dec-2010
[6680]
Oldes - AFAIK, codecs are going to be completly overhauled. We wanted 
streaming support, and current implementation is imo rather primitive. 
Carl agreed in one roadmap document release, but that file is gone 
(we are waiting for new one). I hope proper port based API will be 
available. So - on one hand it is a good thing it is not part of 
the host-kit, as we arelly need one standardised API, not myriad 
of different hack-ins, but otoh Carl could benefit from some community 
experiments in that regards ....
Henrik
20-Dec-2010
[6681]
Just curious: Is there a maximum length to a word name? can you TO-WORD 
a 1 GB string, assuming it's valid?
Maxim
20-Dec-2010
[6682]
easily checked with a little powers of two loop ;-0
Henrik
20-Dec-2010
[6683]
don't have the memory :-)
Steeve
20-Dec-2010
[6684]
have a break :-)
Henrik
20-Dec-2010
[6685]
I'm writing docs. Just getting warmed up. :-)
Sunanda
20-Dec-2010
[6686]
Max word lenth is 255 or 256 in R3
Henrik
20-Dec-2010
[6687]
ok, thanks. that's fair enough.
Sunanda
20-Dec-2010
[6688]
http://www.curecode.org/rebol3/ticket.rsp?id=580&cursor=1
Steeve
20-Dec-2010
[6689]
Btw Henrik, I read your GUI R3 code. It's R2 fashioned. You missed 
some R3 tricks. I suppose you already know it though ;-)
Henrik
20-Dec-2010
[6690]
Steeve, depends on which parts you read.
Steeve
20-Dec-2010
[6691x4]
I give some examples.
The 'merge-values mezz is actually like the native 'resolve
you use a lot the old idiom
select block 'word 
vs
block/:word (which is faster and more compact)
(sorry it's: select block word)
Henrik
20-Dec-2010
[6695]
it's quite possible that some functions are from the original R3 
GUI, long before newer tricks were involved.
Steeve
20-Dec-2010
[6696x2]
Another old R2 idiom:
all [in object 'property object/property]
vs
select object 'property
var: either cond [...][none]
vs
var: if cond [...]
Henrik
20-Dec-2010
[6698]
hmm... yes, that is old
Steeve
20-Dec-2010
[6699x5]
But you know, We all are in the same trend, It will take a while 
before we loose old habits
Today, I saw something horrific in an old script of mine.
>> 8 * to-integer v1 + v2 / 8
V1 and V2 are actually integers
(not related specificaly to R3)
I let you think about this coding horror ;-)
Kaj
20-Dec-2010
[6704]
Was that R1 semantics? ;-)
Gregg
20-Dec-2010
[6705]
I wouldn't always use the IF version in place of EITHER. I generally 
prefer to be explicit.
BrianH
20-Dec-2010
[6706]
We use that IF or UNLESS returning none trick a lot. It is used so 
much that it might as well be considered explicit. It is good to 
remember that REBOL doesn't have an optimizer; we have to optimize 
by hand, and the IF trick is faster than the explicit EITHER.