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

World: r3wp

[!REBOL3-OLD1]

Maxim
23-Jun-2009
[15711x2]
IMO we need choice.  this is such a fundamental part of data management 
that we cannot let the compiler decide.


would you code in C if all structure copies behaved this way?  if 
this where the case an OS would probably need 1TB of RAM to run.
allowing COPY on objects makes much more sense to me.
BrianH
23-Jun-2009
[15713]
I added a fairly comprehensive comment, with tests. I had to generate 
3 CureCode tickets as a result :(
Maxim
23-Jun-2009
[15714x2]
what is the replacement for first context []  in R3  I can't remember 
the function's name
the why? in R3 is a fabulous idea!
BrianH
23-Jun-2009
[15716]
WORDS-OF, but the 'self word is not included.
Maxim
23-Jun-2009
[15717]
no self ...   COOL  :-)
BrianH
23-Jun-2009
[15718]
And the returned words are bound to the object.
Maxim
23-Jun-2009
[15719x2]
oh that is cool.
I see unbind is now part of R3  :-D
BrianH
23-Jun-2009
[15721]
WORDS-OF works on any-object!, any-function! and map! too, though 
it's only bound to any-object!.
Maxim
23-Jun-2009
[15722]
I could see the binding to map being usefull, it might be impossible 
due to the inner implementation of map
BrianH
23-Jun-2009
[15723]
I'm trying to backport UNBIND to R2, but it's really tricky.
Maxim
23-Jun-2009
[15724]
I've tried several times... I usually end up doing:     load mold 
myblock
BrianH
23-Jun-2009
[15725x2]
You can't bind to a map! because the keys are handled differently, 
with the keys going away when assigned none.
You can't bind to something that might go away :)
Maxim
23-Jun-2009
[15727]
yep  :-)   I guess asking for a word in a map which isn't there returns 
none  ?
BrianH
23-Jun-2009
[15728x2]
Yup :)
Most of map!'s behavior was my idea.
Maxim
23-Jun-2009
[15730x2]
it makes me think of the array type in AREXX  ;-)
are only words supported in map! or are other types usable for the 
key?
BrianH
23-Jun-2009
[15732]
Other types too, but not all other types.
Maxim
23-Jun-2009
[15733]
so scalars, pairs, tuples, strings, words at least?
BrianH
23-Jun-2009
[15734]
Yup.
Maxim
23-Jun-2009
[15735x3]
a trick question... are set and get words enabled? and are they differentiated 
from lit-words?
to me an unbound word is a lit-word in the context of the map...
I'm not sure what I wrote above makes sense.. hahaha
BrianH
23-Jun-2009
[15738x2]
Binaries too, but not block, object or vector types. Word types are 
converted to word!.
All types can be used as values though, except #[none] which will 
make the key disappear.
Maxim
23-Jun-2009
[15740x3]
yep this means we can use the map exactly like in AREXX, very usefull 
for sparse arrays  :-)
if you used the object's pointer in the map internally, we could 
use objects too, it would actually be very usefull and not that much 
heavy to implement.
like find with blocks is very fast.  it only maps the exact same 
object, not a similar object AFAIK.
BrianH
23-Jun-2009
[15743x2]
You can use objects as the values, but the keys need to be hashable 
:)
Map keys get hashed when the map gets large enough. No, I don't know 
how large that is :)
Maxim
23-Jun-2009
[15745]
but the object pointers can be hashed? no?
BrianH
23-Jun-2009
[15746]
Bring it up with Carl :)
Maxim
24-Jun-2009
[15747]
he'll ask me for an example of usage... now I have to scan my brain 
for the last 10 years of REBOL usage... and remember when I'd used 
this... hehe
BrianH
24-Jun-2009
[15748]
The advantage of map keys is that they don't have to be the SAME? 
as the key, they can just be EQUAL? and the hashing speeds things 
up. With objects you either have a reference to it or you don't. 
If you have a reference, you can extend it with new fields, which 
can refer to the values you want to associate with the object. If 
you don't have a reference you need to specify a key within the object 
that you are searching for, and hashing won't help there, but we're 
going to add a mezzanine to do that kind of searching.
Maxim
24-Jun-2009
[15749x2]
the EQUAL? note is very important to mention in the docs... and its 
important for the difference between them to be very explicitely 
defined for all types, somewhere.
the difference between EQUAL? and SAME?
BrianH
24-Jun-2009
[15751]
I believe there is a blog conversation about that now :)
Maxim
24-Jun-2009
[15752]
yep... I just meant... it has to be very precisely/explicitely documented 
 :-)


btw, I added other qualitative word examples for equality-likeness-sameness 
on the post...  might give you ideas for a better scalling of the 
four levels
Sunanda
24-Jun-2009
[15753]
Just updated my article about my early R3 porting adventures.  Highlights 
of changes:

-- shout outs to Ladislav and Steeve -- thanks, guys
-- fix of to-pair issue

-- aside about the largest prime discoverable prime number in REBOL 
-- I suggest any discussion on that goes into [Puzzle answers]

-- problem with parse --- see ISSUE under rse-ids.r  -- Can anyone 
help diagnose the issue? Thanks!

http://www.rebol.org/art-display-article.r?article=j26z
BrianH
24-Jun-2009
[15754x2]
Some tweaks:
- OR~, not ~OR

- AND~, OR~ and XOR~ work in R2 as well, and should be used instead 
of AND, OR and XOR for prefix use.
Interesting article :)
It's great to see how easy porting from R2 to R3 is :)
Steeve
24-Jun-2009
[15756x2]
sunanda, in insert-compact, replace:
>>prev: pick here -1
by
>>prev: pick here 0
for RSE-IDS source
Sunanda
24-Jun-2009
[15758]
Thanks Steeve -- will try that later.

Thanks Brian -- though it's early days yet. I've deliberately picked 
the nursery-slope scripts. I have others I'll build up to that regularly 
acted as R2 stress-testers.
Steeve
24-Jun-2009
[15759]
As Brian pointed, it's not difficult to port to R3 but it's not optimized 
for R3 and to do so; it will need more rewrite.
Ladislav
24-Jun-2009
[15760]
Sunanda: Correction! I told you, that it was the largest INTEGER! 
prime in R3, I did not claim a larger one is not findable