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

World: r3wp

[!REBOL3-OLD1]

BrianH
8-Feb-2009
[10785x2]
My original name for undirize was fileize, but that seemed even more 
contrived. The only advantage "undirize" has is that if you know 
what dirize does, it's not difficult to figure out what undirize 
does. The dirize function is only still called that for historical 
reasons, but we are trying to not just change the names of functions 
that act the same as R2 unless there is a really good reason for 
it. We prefer to only break compatibility for semantic reasons, not 
naming.
That said, I would like to have the BIND? function also assigned 
to the word BOUND? by default, or perhaps BINDING? or CONTEXT? given 
its behavior. Just a preference.
Pavel
9-Feb-2009
[10787]
What is R3 replacement for List! is it Map! or Vector! ?
BrianH
9-Feb-2009
[10788x5]
Neither - it's just gone.
The block-like types that aren't block-like enough to be bound are 
gone. Map! is not block-like, it acts more like object.
Vector! is more like a typed array. There is nothing in R3 like list! 
or hash!.
It was found that they were not useful or even used enough to be 
included.
Most uses of hash! are replaced by map!, the rest by block!. The 
only use of list! that couldn't be done with block! was found to 
be so obscure that no code was found that used that technique.
Dockimbel
9-Feb-2009
[10793]
I found hash! a very useful datatype, I still don't get why it has 
to be removed. Map! looks less flexible because you have to conform 
to the key/value data model and it doesn't seem possible to navigate 
in a map! like in a hash!. Why can't we have both hash! and map! 
in R3?
Pavel
9-Feb-2009
[10794]
Maybe would help to add indexing to Map! ie reverse value -> key 
?
ManuM
9-Feb-2009
[10795]
Exists a way to change user-agent with R3-alpha? I try system/schemes/http/user-agent: 
"Mozilla/4.0" but I get ** Script error: cannot access user-agent 
in path system/schemes/http/user-agent:
sqlab
9-Feb-2009
[10796x2]
probably you have to modify do-request.
save %do-req.r mold do-request
edit in do.req.r the line 
User-Agent: "REBOL"
to whatever you desire, add the rebol [] header and do the file.
sorry 
save %do-req.r mold :do-request
Steeve
9-Feb-2009
[10798]
hum, or you can pass a header block to the write function as is:
>> write [ url!  [ User-Agent: "TOTO" ... ]  #{...data...}]

but it's bugy, you have to add yourself some missing header properties 
in the block to generate a valid request.

like Content-Type: "application/x-www-form-urlencoded; charset=utf-8"
[unknown: 5]
9-Feb-2009
[10799]
I liked list and hash and did use them a lot.  List was was buggy 
though.
Steeve
9-Feb-2009
[10800]
eh ? bug in list ?
[unknown: 5]
9-Feb-2009
[10801x3]
Yes, I reported it some time back.
http://www.rebol.net/cgi-bin/rambo.r?id=4314&
Because of list being buggy sort was modified so that it doesn't 
use list.
Steeve
9-Feb-2009
[10804x3]
bah... not so painfull
it's a little incoherent to use sort on lists
it was slower than using blocks
Oldes
9-Feb-2009
[10807]
there is someone using list!? I wonder if there is any advantage 
of list! over hash! and block!
[unknown: 5]
9-Feb-2009
[10808]
No lists are faster than blocks for inserting data.
Steeve
9-Feb-2009
[10809]
lists are fast with insertion and deletion, i use them sometimes
[unknown: 5]
9-Feb-2009
[10810]
Oldes, yes there is an advantage to each.  Lists are faster for inserting 
and traversal.  Hash is faster for find operations.
Steeve
9-Feb-2009
[10811]
by the way, some times ago, i made an algorhitm to simulate hash 
with blocks, it's quite fast and use much less memory than hash.

But it works only with integers key. i could search for it if someone 
is interested...
Oldes
9-Feb-2009
[10812]
>> b: make list! 10001 tm 100 [clear head b repeat i 10000 [b: insert 
b i]]
0:00:00.25
== 0:00:00.25

>> b: make block! 10001 tm 100 [clear head b repeat i 10000 [b: insert 
b i]]
0:00:00.25
== 0:00:00.25
Steeve
9-Feb-2009
[10813]
Oldes, you do appends not insertion
Oldes
9-Feb-2009
[10814x2]
Anyway.. list! and hash! are no longer in R3
I see.. interesting.

>> b: make list! 10001 tm 100 [clear head b repeat i 10000 [insert 
b i]]
0:00:00.203
== 0:00:00.203

>> b: make block! 10001 tm 100 [clear head b repeat i 10000 [insert 
b i]]
0:00:13.031
== 0:00:13.031
[unknown: 5]
9-Feb-2009
[10816x2]
I don't know much about vector or map but I hope that we haven't 
loss the functionality of list and hash in R3.
Or at least have something better.
Henrik
9-Feb-2009
[10818]
I used list! once in list-view, but found that it had too much overhead, 
when needing to use it as a block, so it had to be converted.
[unknown: 5]
9-Feb-2009
[10819x2]
Yeah that is what made list less desirable for me as well  Henrik.
Should to-block work on vector!?
Oldes
9-Feb-2009
[10821]
I think so.
[unknown: 5]
9-Feb-2009
[10822x2]
>> c: make vector! [32 100]
== vector!

>> c/1
== 0

>> c/1: 100000
== 100000

>> c/2: 200000
== 200000

>> c/1
== 100000

>> c/2
== 200000

>> to-block c
== [vector!]
the last piece seems abnormal to me.
Oldes
9-Feb-2009
[10824]
I don't think is't ready already. Also map! still has some issues.
BrianH
9-Feb-2009
[10825x3]
Map! has issues for now (see CureCode), and the traversal thing is 
being worked on. Vector! is almost completely nonfunctional now.
There are plans to extend FOREACH to map! and object!, and MAP could 
make sense too I suppose, but no plans for that. What did you use 
hash! for that wasn't keyed search, Doc, and what advantages did 
it give you over block! aside from a different datatype?
Also, don't forget user-defined datatypes. We are only including 
the most useful datatypes by default - you will be able to add your 
own later once we have user-defined datatypes.
Dockimbel
9-Feb-2009
[10828]
Multiple keys pointing on the same data (I'm using traversal to locate 
the value once the key is found). I guess that using map!, it would 
require to duplicate the value for each key?
BrianH
9-Feb-2009
[10829]
No, just duplicate *references* to the same value.
Pavel
9-Feb-2009
[10830]
Paul if I understand documentation Vector must be one type (homogenous) 
ie good for file pointer, bad for records (multiple type)
BrianH
9-Feb-2009
[10831]
It only becomes duplicate values if the value is not a reference 
type (numbers, characters, etc.).
Dockimbel
9-Feb-2009
[10832]
Brian: Good to know.
BrianH
9-Feb-2009
[10833]
Pavel, yes, the homogenous type is the only main difference relative 
to blocks. Only use vectors if you need that, else use blocks.
Dockimbel
9-Feb-2009
[10834]
So, if I understand correctly, map! offers a superset of hash! features 
(without giving up anything)?