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

World: r3wp

[Core] Discuss core issues

Gabriele
4-Nov-2009
[14968]
to make that a stable sort it needs to return -1, 0 or 1, not true 
or false. sign? on the difference would do the trick.
Pekr
8-Nov-2009
[14969]
reboltutorial claims, that copying files larger than 1GB fails with 
R2? Anyone having similar experience? http://reboltutorial.com/blog/do-you-need-to-copy-big-files/
BrianH
8-Nov-2009
[14970x2]
Perhaps he means 2GB, which is a known consequence of using 32bit 
signed integers for file indexes.
Fixed in R3, due to the switch to 64bit signed integers.
Henrik
12-Nov-2009
[14972x2]
is it possible to cascade error throws through several functions?
never mind, I did something wrong. got it now.
btiffin
12-Nov-2009
[14974]
Ubuntu 9.04; rebcore (2.7.6) can     devmem: open/read/binary %/dev/mem
rebview hangs.


Do I need to care?   I don't need View for this little informational 
gathering app, but ...


We are planning for an embedded system BIOS tweak so we can label 
an Asset Tag in the SMBIOS;  REBOL won the race getting the information 
decoded for everyone to see; beat Python development by a few minutes 
(in a highly uncompetitive sharing information back and forth development 
"race")
Gabriele
13-Nov-2009
[14975x3]
try /direct or /seek
/seek does not work
are you sure View didn't just pop up its security requestor behind 
the terminal so you couldn't see it?
Graham
13-Nov-2009
[14978x2]
Has anyone got a routine that calcuates the difference between two 
dates as an age in a format appropriate to that age.
So, age is displayed as a days for under a week, in weeks for under 
3 months, and as months upto 3 years, and then as years/months after 
that.
Chris
13-Nov-2009
[14980x2]
I've used 'case for that in the past, rough example:

	age: case [
		1 > diff: d2 - d1 ["less than a day"]
		7 > diff [reform [diff "days"]]
		... etc ...
	]
That way, you can tune it as fine as you need it.
Graham
13-Nov-2009
[14982]
I ended up using case .. and just straight subtraction of years etc 
instead of using 'difference which can sometimes lead to numeric 
overflow.
Izkata
14-Nov-2009
[14983]
Something similar I've used:
   DayConv: func [Days /local Ret Tip][
      Ret: copy {}
      Tip: false
      foreach Val [[365 y] [31 m] [7 w] [1 d]] [
         if Days >= Val/1 [
            append Ret join to-integer divide Days Val/1 Val/2
            Days: mod Days Val/1
            if Tip [return Ret]
            Tip: true
         ]
      ]
      return Ret
   ]


'Tip was to make it stop at just two time-indicators (So 2 months, 
1 week, and 3 days would display just as 2m1w, omitting the days, 
for example)

(Messy looking implementation is due to being reeaally tired at the 
time, just never felt like fixing it up...)
Graham
14-Nov-2009
[14984]
Interesting.
Jerry
14-Nov-2009
[14985x2]
I thought R3 has not support task! yet. Why does the following code 
work?
do make task! [ forever [ print now wait 1 ] ]
Henrik
14-Nov-2009
[14987]
It has support for tasks, but the method for tasking on a low level 
is supposedly not the correct one, given that R3 could be running 
on an OS kernel without threads.
jocko
14-Nov-2009
[14988]
I repost here: task is a discovery for me. I am interested to know 
if  it will be developed. It might be an important feature for R3.
Henrik
14-Nov-2009
[14989]
oops, now I posted the response in the wrong group. :-)
jocko
14-Nov-2009
[14990]
ok, saw it, thanks
Henrik
14-Nov-2009
[14991]
oops, I did it again:


The problem is that OS kernels do it differently, depending on their 
capabilities, so the current threading model used to create tasks 
may have to go.
jocko
14-Nov-2009
[14992]
yes, its a real challenge ...
Henrik
14-Nov-2009
[14993]
Fortunately Carl has a little bit of experience with multitasking, 
so I'm sure a good model will come up. :-)
jocko
14-Nov-2009
[14994]
Of course ! He certainly will find a clever approach !
Brock
15-Nov-2009
[14995]
Graham, is it important to take into account leap years in your solution?
Graham
15-Nov-2009
[14996]
No, just accurate within a couple of days.
Henrik
16-Nov-2009
[14997x2]
What is it that prevents this from working:

a: reduce [make object! [
        t: 3
        g: 5
    ] make object! [
        h: 12
        u: 15
    ]]

c: 2

a/:c/h
== 12 ; good

d: 'a/:c

d/h
== error!


It would be so wonderful to use only paths here instead of relying 
on GET IN GET IN GET IN...
Notice that I use a lit-path. I don't want evaluation to occur until 
the final moment.
Gabriele
16-Nov-2009
[14999]
>> p: 'a/b/c/d
== a/b/c/d
>> pick p 2
== b
>> p/2 
== b
>> p/c
== d
>> select p 'c
== d
Henrik
16-Nov-2009
[15000x3]
Well, that's the inverse of what I would like to see: Path building 
using refinements only.
You can do it with file!:

a: %/c

a/somewhere
== %/c/somewhere
>> b: a/somewhere/else
== %/c/somewhere/else
>> b/subdir
== %/c/somewhere/else/subdir

etc...
Geomol
16-Nov-2009
[15003x3]
When you write

d: 'a/:c


d become a path! datatype, and it's not connected to your block, 
a, in any way. If you wanna expand the path, you can do something 
like:

>> join d 'h
== a/:c/h

Is that what you wanna happen?
You can evaluate it with:

>> do join d 'h
== 12
It seems path! doesn't work like file! but more like block!, which 
is also what Gabriele pointed out, I think.

>> d/a
== :c


And that is also, why d/h fails. h is not found in the d path anywhere.
Henrik
16-Nov-2009
[15006x2]
well, that's actually better, because I can put several refinements 
on top of a path!, which is really what I want:

>> a: 'b/c
== b/c
>> join a 'e/d
== b/c/e/d

but that final bit about using refinements alone would be cool
ok, I didn't get the block connection there, but I see it now.
Geomol
16-Nov-2009
[15008x2]
It is a bit confusing, also because both path! and file! are series, 
so it's easy to think, they should work the same.

>> series? d
== true
>> series? %/a/b/c
== true
A question: can it be justified, that file! is a series?

>> a: %/c
== %/c
>> first a
== #"/"
>> a/1
== %/c/1


Is file! a pseudo-series? What exactly defines a series? It's some 
sort of a sequence of values, that can be picked individually. And 
series can be sorted, right? So the methods (or functions), that 
can be performed on the datatype defines its type. What defines a 
series in REBOL?
Maxim
16-Nov-2009
[15010x4]
hehe I was writting up the EXACT same reply than geomol pointing 
out block and how to use do join x y ... had to for an exam at the 
dentist... I come back and geomol beat me to it  ;-)
each series type handles path actions how it wants to.
files append to themselves, blocks do lookup, strings return chars.


to be a series, in has to support insert, copy, first  which is why 
tuple isn't a serie.
in = it
BrianH
16-Nov-2009
[15014x2]
Henrik, in R3 use get-paths instead:
>> a: reduce [func [] [print "hello"]] c: 1
>> a/:c
hello
>> print mold :a/:c
make function! [[][print "hello"]]


Get-paths solve your problem of delayed evaluation without using 
GET IN. Your example would be d: :a/:c insteac of 'a/:c.
Geomol: "What defines a series in REBOL?"


A series has contents, sequence and persistent position. The characters 
that make up a file (contents) are in a specific order (sequence) 
and you can do an offset reference to a later offset in the filename 
(position). If you do FIRST %a it will return #"a" every time (persistent 
position). Being a series doesn't mean that it is sortable, though 
many are. Being sortable means also having the contents be comparable, 
and the series be modifiable.


We were careful to make sure that things that aren't really series-like 
were removed from the series! typeset in R3. R2 is less consistent 
in this regard, so you have some types attempting to act series-like, 
poorly - pots being the worst example.


Some of the functions that act on series also act (differently) on 
non-series, but not all.
Maxim
16-Nov-2009
[15016]
pots?
BrianH
16-Nov-2009
[15017]
ports (stupid keyboard)