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

World: r3wp

[Core] Discuss core issues

[unknown: 5]
16-Jun-2008
[10610x6]
Well I'm testing a new indexing system for TRETBASE and need to know 
some significant data to fine tune it.
That is where my interest lies Anton.
Interesting the limit for file size in REBOL is 2 ** 31
when the port/state/tail value reaches 2 ** 31 it converts it to 
a negative number and gives an error which is an "access error writing 
to port".
Now the port can still be read via open/direct but no longer accessible 
via open/seek at that point.
Not sure how OLDES was able to get his file over 5GB on NTFS as my 
test was also on NTFS.
Henrik
16-Jun-2008
[10616]
I wonder if WRITE/APPEND allows files over 4 GB?
[unknown: 5]
16-Jun-2008
[10617x6]
I would have thought that write would be using open also.
REBOL should be able to break this limitation.  Even if it means 
holding a pointer to a file position and then looping over again.
I tried Oldes method and able to get it over the limit.
I noticed using his refinements I no longer have access to tail from 
querying the port.
The only limitation I could find is in /seek.
So next question - do we have any source of /seek to understand why 
we have such a limitation?
BrianH
16-Jun-2008
[10623]
The source of OPEN, isn't. It seems likely that the 32-bit integers 
of R2 are at fault here.
[unknown: 5]
16-Jun-2008
[10624x2]
Well I would assume that the 32 bit integers are being used on open/direct 
so I'm not sure why this limitation only affect /seek and not /direct 
as well.
My need is to be able to get the tail or index of files larger than 
the 32 bit integer limit.
BrianH
16-Jun-2008
[10626]
I expect that /direct is just using file handles and isn't setting 
offsets like /seek.
[unknown: 5]
16-Jun-2008
[10627x4]
I don't know what the port flags or the port/state/misc counters 
are used for.
Do you know anyway around this limit?
A work around?
ahhh time to eat - be back in a few.
BrianH
16-Jun-2008
[10631]
This may be one of those use-another-tool-through-call or use-R3's-64-bit-integers 
situations.
[unknown: 5]
16-Jun-2008
[10632x2]
That isn't the kinda of answer I was looking for but expected.
Any ideas what the numbers mean in the port/state/misc section of 
a file port?
BrianH
16-Jun-2008
[10634]
Nope. Anyone else want to give this a shot?
[unknown: 5]
16-Jun-2008
[10635x2]
Would be nice to have the feature to access the currently indexed 
position of the open port and perform a function on it.  For example, 
modify /awake to work with files.  Such that any reference to the 
file or altering of the position can be handle via an awake/handler.
looks like in R3 we get  'AT expanded to 64 bit possible to access 
the open/direct files.
[unknown: 5]
18-Jun-2008
[10637]
I have a handy little function I made and don't know if there is 
already an easy way to do this in REBOL but I have a function called 
'any+ that simply keeps me from repeating any statements.  For example:

>> a: 3
== 3
>> if any+ [1 2 4 > a][print "cool"]
cool

Got a bit tired of writing  ANY [1 > a 2 > a 4 > a]

This is one of those things that I often wonder if we already can 
do this easlier and I just don't know what it is.
Gregg
18-Jun-2008
[10638]
There isn't anything built in that does that. For simple min/max 
comparisons, you could do something like this:

	if a < first maximum-of [1 2 4] [print "cool"]

I also have a shortcut for FIRST MAXIMUM-OF.


 pick-max: func [series [series!]] [attempt [pick maximum-of series 
 1]]
	if a < pick-max [1 2 4] [print "cool"]


For the general case, I would use a map and anonymous func combo. 
R3 has a native MAP func, but you have to roll your own in R2.
[unknown: 5]
18-Jun-2008
[10639x4]
nice Gregg.
;here is my little 'any+ function:

any+: func [blk /local op args arg blk2][
    op: first back back tail blk
    arg: last blk
    if word? :arg [arg: get :arg]
    args: copy/part blk find blk op
    blk2: reduce [op arg]
    foreach item args [
        insert blk2 item
        if attempt [do blk2][return true]
        remove blk2
    ]
    false
]
for the any+ function you put the multiple items on the left side 
of your block and the single item to compare to on the right side
For example:

any+ [1 2 3 4 > 3]
Henrik
18-Jun-2008
[10643]
it's good, but I wonder if we can come up with an even better syntax.
[unknown: 5]
18-Jun-2008
[10644]
I think we can.  One that can probably accomodate much more.
Henrik
18-Jun-2008
[10645x2]
I would want to put all values that are going to be tested in a block.
a < [1 2 3 4]
[unknown: 5]
18-Jun-2008
[10647x2]
Would be nice if we use op! values as an argument to functions.
yeah that is what I initially wanted to do Henrik.
Henrik
18-Jun-2008
[10649]
I remember from my HP48 calculator that any numbers put in a block, 
could be operated on like that. But I think this is the beginnings 
of vector operations, which is a big area that should be done right.
[unknown: 5]
18-Jun-2008
[10650]
My function is actually very restricted in that it looks for the 
op! as the second to last value and the comparator as the last item.
Henrik
18-Jun-2008
[10651]
because I would also like to see:

>> 1 + [2 3 4 5]
== [3 4 5 6]

in R3 there are ways to do this with a bit more code.
[unknown: 5]
18-Jun-2008
[10652x2]
I could make that change to my function and easily accomodate that.
No outside of a single block though.
Henrik
18-Jun-2008
[10654]
I would love to see it in R3, but so far nothing from Carl WRT this 
particular feature. I think it might complicate op! way too much.
[unknown: 5]
18-Jun-2008
[10655x5]
I'm sure we can do something in the mezz sense once R3 gets released.
Shouldn't < > and = return as a logic values as well as being op 
values?
>> logic? get to-word "<"
== false
>>
I guess because it doesn't return true or false until it operates 
on something it wont return a logic value.  But maybe we should at 
least subclassify some operators to distingish them more.
some modifications made: