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

World: r3wp

[!REBOL3-OLD1]

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)?
Pavel
9-Feb-2009
[10835]
Not bad if the performance would be good (especially for quite large 
pointer table to database file), save in size was already mentioned
BrianH
9-Feb-2009
[10836x2]
You give up position and persistent ordering, and in theory you also 
give up duplicate keys though there is a bug ticket about that.
You also have to conform to the key/value pattern. Map! is more comparable 
to object! nowadays.
Pavel
9-Feb-2009
[10838]
Doc question arise when large insert into large table comes, in hash 
inserting is the slower the bigger is table (maybe even nonlinear)
BrianH
9-Feb-2009
[10839x2]
It can be key/[block of values] though.
We are extending support of many of the functions that people traditionally 
associated with series to objects and maps, without making them into 
series. So that means that APPEND works, but INSERT doesn't because 
of the position stuff.
Pavel
9-Feb-2009
[10841]
For Map also limit about 500000 items was mentioned, it suggest an 
idea use Map in pagged manner. Ie for larger set use multiple Maps 
rather fixed size in the manner of cache.
Dockimbel
9-Feb-2009
[10842]
Pavel: is map! any better in that case?
Pavel
9-Feb-2009
[10843]
I have no exact comparison all mentioned is only ideas
BrianH
9-Feb-2009
[10844]
SELECT works on object! and map! but FIND doesn't. PICK and POKE 
work, but they take keys rather than indexes. There are some (at 
this point undocumented) limits on what can be used as keys too (at 
least you can't use a block as a key in practice), but that may be 
a bug.
Dockimbel
9-Feb-2009
[10845]
Lot of new exceptions to remember...
Pavel
9-Feb-2009
[10846]
Brian Block as key would be good for reversed index IMO. Question 
if it would be usefull.
BrianH
9-Feb-2009
[10847]
Well, in some cases to fix, but yes, lots of exceptions. The guideline 
is that maps and objects don't have position, but series do. So the 
position-dependent functions don't work but their non-position-dependent 
counterparts do. Ports don't work like series either, so there is 
another whole set of differences to remember.