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

World: r3wp

[Core] Discuss core issues

Ingo
22-Sep-2005
[2180x2]
Why do I get an error "invalid argument" here?


>>       comp-length: func [a b][compare (length? a/2) (length? b/2)]
>>       sort/skip/compare files 2 :comp-length
** Script Error: Invalid argument: 2
** Near: sort/skip/compare files 2 :comp-length
>> source compare
compare: func [

    {compares to values, and returns -1 / 0 / 1 for values a<b / a=b 
    / a>b}
    a b
    /local return
][
    case [
        a > b [-1]
        a < b [1]
        true [0]
    ]
]

REBOL/View 1.3.1.3.1
files is somthing like [%abc [%a/ %xx/] %def [%xyz/] ...]
Sunanda
22-Sep-2005
[2182]
Add /all to the sort:
sort/all/skip/compare files 2 :comp-length
Ingo
22-Sep-2005
[2183]
That still doesn't work, I just checked wether I had accidentally 
overwritten 'sort, but no ...
Sunanda
22-Sep-2005
[2184]
It works for me:
files: copy  [%abc [%a/ %xx/] %def [%xyz/]]
compare: func [

        {compares to values, and returns -1 / 0 / 1 for values a<b / a=b 
        / a>b}
        a b
        /local return
    ][
        case [
                a > b [-1]
                a < b [1]
                true [0]
            ]
    ]


print system/version
sort/compare/all/skip files  :compare 2
probe files

1.3.1.3.1
== [%def [%xyz/] %abc [%a/ %xx/]]
Graham
24-Sep-2005
[2185]
not core .. but I wonder what RT has to do to make use of dual core 
CPUs.  Is this an OS, or an application thing?
Henrik
24-Sep-2005
[2186]
that's an OS thing for now. I don't think programs can be threaded 
across multiple CPU's yet and since REBOL still doesn't have real 
threading, it doesn't matter anyway.
Graham
24-Sep-2005
[2187x2]
I was thinking more of running more rebol instances than threads
for example running more IOS servers and the like
Sunanda
24-Sep-2005
[2189]
It'll depend on how the OS does it. Expect them to start primitive 
and slowly improve

*probably* any started task can be dispatched on any spare CPU. And, 
after any suspension, it'll get restarted on any spare CPU.
*probably* (as Henrik says) subtasks will run on the same CPU.

In many people's cases all their spyware and viruses will hog one 
CPU. leaving the other free for productive work.


Separate instances will *probably* run on separate CPUs, leaving 
serialisation and such an issue as now. If they need to talk, a tcp/ip 
pipe may be easiest (as now).
Graham
24-Sep-2005
[2190]
I wonder then what localhost will refer to ...
Henrik
24-Sep-2005
[2191]
OSX I believe, starts new tasks on additional CPUs if a current program 
hogs the currently used CPU. So yes two instances of REBOL would 
run on each CPU, but only if CPU utilization is "correct".
Graham
26-Sep-2005
[2192]
Is it inconsistent that with an object, you can do

first object
pick object 1

but  not 

object/1 ?
Pekr
26-Sep-2005
[2193x2]
imo paths are inconsistent on more places ... we just recently got 
block/(compute value) functionality and block/4: "text" etc. to simply 
change value directly ...
why not block/"my string"? I know it looks terrible, but .... and 
also, if block/literal-value: assigned-value works, but when you 
use block/numeric-value, it means its position, while in the case 
of literal value, it performs seek ...
Anton
26-Sep-2005
[2195]
Graham, you may also ask if it is inconsistent that objects and functions 
respond differently to FIRST SECOND etc. That is what causes the 
problem, I think.
Pekr
26-Sep-2005
[2196]
that is probably true, Anton, have not thought about it that way 
...
Volker
26-Sep-2005
[2197]
Pekr, if ugly is ok, try this: block/("my string") ;)
Pekr
26-Sep-2005
[2198]
:-)
Allen
3-Oct-2005
[2199]
GMail's not letting me post at the moment. Can someone post this 
reply for me


Jeff Kries, did a zine article called "Dining with Dynamic Interpreters"

http://www.rebolforces.com/zine/rzine-1-02/#sect5.which covers some 
of the same ground.

--Allen K

on 10/4/05, Glenn M. Lewis <[glenn-:-hometot-:-com]> wrote:

Hi all!

       Has anyone done anything like this for REBOL:
http://www.rubyquiz.com/quiz49.html

       If so, I would love to hear about it!  Thanks!
-- Glenn
Tomc
3-Oct-2005
[2200]
I got that email om my gmail account  an hour ago
Izkata
3-Oct-2005
[2201]
I got that already, too... Gmail must just not be telling you it 
sent  =P
Allen
4-Oct-2005
[2202]
in that case, you might get it a few times.. It kept giving me a 
javascript alert saying it was unable to send
Graham
5-Oct-2005
[2203]
I wonder if there can be some refinement to 'read so that when it 
reads a directory, it returns the full path for each file rather 
than just the file name.
Pekr
5-Oct-2005
[2204]
you can join in loop, no?
Graham
5-Oct-2005
[2205x2]
sure .. but it would be easier to have this sorted out in the function 
...
the alternatives are .. 1. I learn to do it properly each time 2. 
I change the language to do it the way I expect :)
Pekr
5-Oct-2005
[2207]
of course - I also requested read/dir read/file ... to read only 
directories, no files and reverse ... but we now have speedy remove-each 
.... so I can filter out myself ...
[unknown: 5]
5-Oct-2005
[2208]
At work we have an issue with supporting extremely large pst (outlook 
personal folder files).  The issue is that we wont to make sure these 
files get backed up when the sales force connects with the network. 
 Problem is that the M$ solutions built into Windows XP cause problems 
because if it sees a changed file it then trys to copy the entire 
file - I believe this to be the case with offline folders files and 
briefcase files also.  What I would like to see is a solution whereby 
only certain contents of the file detected as changed are copied 
over the network and update the master file.  It occurred to me that 
 this should be a capability of any X-Internet application that deals 
with significant file sizes.  So my question is - does anyone know 
of any method's, algorithms or such that currently do such work?
Alan
5-Oct-2005
[2209]
Paul:try talking to Graham as his mailing list reader only dls the 
new mail and saves to the master.Probaly a way to modify for your 
task ? Graham ?
Volker
5-Oct-2005
[2210]
rsync does that afaik.
Graham
5-Oct-2005
[2211]
What's Carl Read complaining about with my formatting answer on the 
mailing list?
Gabriele
5-Oct-2005
[2212x3]
dunno - i guess he's just kidding. you idea is quite interesting 
indeed.
>> pad: func [n d] [d: to integer! 10 ** d next form d + n]
>> pad 1 3
== "001"
>> pad 1 5
== "00001"
in the end though, maybe it's slower.
Graham
5-Oct-2005
[2215]
Ok.
Gabriele
5-Oct-2005
[2216]
but... not if d is fixed. (and of course n must be less than 10 ** 
d)
Graham
5-Oct-2005
[2217]
I guess it's whether one wishes to write a generalised solution, 
or one to solve the problem at hand.
Gabriele
5-Oct-2005
[2218]
yep... in the case at hand it's a very good solution
Graham
5-Oct-2005
[2219]
though a printf type of solution would be handy :)
Gabriele
5-Oct-2005
[2220]
we need the format function... people should bug Carl about it... 
:)
Tomc
5-Oct-2005
[2221]
Graham  I think it is a slick solution to the question asked
Sunanda
5-Oct-2005
[2222]
Gabriele -- Is 'format something Carl has hinted RT have in development?
Otherwise, no reason it couldn't be a small community exercise...
Gabriele
5-Oct-2005
[2223x2]
it's not in development, but it has been on the list for ages.
of course it can be done in REBOL, but i think it should be native. 
also, i'm pretty sure carl has ideas about how the dialect should 
look like.
Sunanda
5-Oct-2005
[2225]
Thanks.....Obviously, it'd be much faster to run as a native.

But it may be much faster to develop as a mezzanine -- and would 
be (with a little care) backward compatible with existing and older 
versions of REBOL.

What would be useful  is some agreement on the dialect......The RT 
could schedule work on the native while others do it mezzanine as 
a usual (and b/w compatible) prototype.
Gabriele
5-Oct-2005
[2226]
well... just let Carl know that you need it, and he'll probably react 
in some way :)
Sunanda
5-Oct-2005
[2227]
Okay -- will do. Thanks.
Pekr
6-Oct-2005
[2228x2]
I wrote generalised solution in the past. Dunno what Carl Read was 
complaining about, but not having 'pad by default sucks pretty much!
it is pretty common function imo for string formatting and I am not 
sure I am willing to talk about its need once again, as in the past 
I was told I could easily write some mezzanine function for that. 
But we are probably not able to learn ourselves one important thing 
- if there are repeated request and we see new ppl facing still the 
same problems, we should think twice if it would not be able to be 
included by default ;-)