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

World: r3wp

[Core] Discuss core issues

Maxim
20-Apr-2007
[7703]
oh, that is an internal ladislav mastery script
Ladislav
20-Apr-2007
[7704x2]
I mentioned the script recently on the ML: http://www.fm.tul.cz/~ladislav/rebol/peekpoke.r
(but it can be called arcane magic, I guess :-)
Maxim
20-Apr-2007
[7706]
;-)
Ladislav
20-Apr-2007
[7707x2]
>> a: "this is a string"
== "this is a string"
>> adr: string-address? a
== 17496432
>> len: length? a
== 16
>> clear a
== ""
>> as-string memory? adr len
== "^@his is a string"
;-)
Maxim
20-Apr-2007
[7709]
this is quite clean :-)  hum for debugging .
Ladislav
20-Apr-2007
[7710]
Anton used the same words, IIRC
xavier
22-Apr-2007
[7711]
very powerfull.  i learned something more today :)
Anton
23-Apr-2007
[7712]
Anyone remember the way to set all the fields of an object! to another, 
similar object! ?
I want to do this for font objects.
Sunanda
23-Apr-2007
[7713]
a: make object! [b: 445 c: 444]
 b: make object! [b: 999]
b: construct/with third a  b  ;; set b to a's values and fields
Anton
23-Apr-2007
[7714x6]
I have a further requirement; the object should be modified in place.
Let me get my example together:
f: make svv/vid-styles/text/font []
f2: make svv/vid-face/font []
Ok, so I want to modify F's fields so they are the same as F2's fields.
I think I found the way:
set f reduce bind copy next first f2 f2
Sunanda
23-Apr-2007
[7720]
You beat me to it with a better solution -- I was going to suggest 
a loop:
foreach v next first f [set in f v get in f2 v]
Anton
23-Apr-2007
[7721]
Yes, I was hoping for a bulk-set operation.
Gregg
23-Apr-2007
[7722]
Anton's version requires recent releases, where SET works on objects. 
Nice though!
Anton
23-Apr-2007
[7723]
That's ok, it's for the menu style I've been making, which already 
relies on several features added in recent times ... :)
Gregg
23-Apr-2007
[7724x2]
Could you just do: set f get f2?
Or do you need to rebind?
Anton
23-Apr-2007
[7726x2]
Excellent - that's what I was trying to remember.
( I think I only tried   set f f2  )
Seems to work the same.
Anton
27-Apr-2007
[7728]
Does anyone remember where we brainstormed that new SWITCH mezzanine, 
just before it became native ?
Chris
27-Apr-2007
[7729]
RAMBO, late last November.
Anton
27-Apr-2007
[7730]
Ah.. thanks!
Henrik
28-Apr-2007
[7731x2]
>> a: [1 2 3]
== [1 2 3]
>> b: a
== [1 2 3]
>> same? a b
== true
>> b: next b
== [2 3]
>> same? a b
== false


Is there a way to check that b is the same block as a, just at a 
different position?
>> same? head a head b
== true

I guess that is the solution
Anton
28-Apr-2007
[7733]
correct
btiffin
28-Apr-2007
[7734x2]
What is system/options/browser-type ?
What is system/options/browser-type  for?
Anton
28-Apr-2007
[7736]
I guess it is useful for the browser plugin.
btiffin
28-Apr-2007
[7737]
I'll buy that.
Maxim
29-Apr-2007
[7738x3]
yep... needed to switch DOM and the like  :-)
strange, I tried printing that path and in 2.7.2  it doesn't seem 
to exist... in what version did you try that?
btw... I assumed anton was confirming that the above path was usefull 
or part of plugin use... in that circumstance, the browser type would 
be usefull to know if the browser is mozzilla or IE based... but 
now... I'm a bit perplex!
btiffin
29-Apr-2007
[7741x2]
Maxim; REBOL/View 2.7.6.4.2  REBOL/Core 2.7.5.4.2 I just noticed 
it.  It's an integer! 0 in both.
Not in 2.5.6.4.2 REBOL/Pro from Linux SDK, built 5-aug-2003
Henrik
29-Apr-2007
[7743]
the async abilities found in certain releases of REBOL don't apply 
to locally stored files, do they?
Gabriele
30-Apr-2007
[7744]
they don't, afaik.
Geomol
2-May-2007
[7745]
random

I was checking out the random function, and it seems to only produce 
random numbers related to the integer datatype. Even if input is 
a decimal, a whole number comes out. So random can produce 2 ** 31 
- 1 different outputs. Is that correct? Would it be an idea to ask 
for 32 bit or 64 bit random numbers in REBOL v. 3? Maybe if input 
was 1.0, it could produce a 32 or 64 bit number between 0.0 and 1.0?
Any ideas?
Oldes
2-May-2007
[7746]
it would be nice... submit it to Rambo or use feedback
Geomol
2-May-2007
[7747]
A little related: It seems, that the largest whole number in REBOL 
is 10 ** 15 - 1 = 999999999999999.0

But using random on that number will only produce output from 1 to 
2 ** 31 - 1 = 2147483647, which is the largest integer. The implementation 
in REBOL is probably related to the ANSI C rand function, which produce 
output from 0 to RAND_MAX, which is at least 32767 (probably cpu 
related).
Gabriele
2-May-2007
[7748x4]
yep, random is 32 only
however, random/secure on a series might produce more than 2^31 combinations 
- in principle the generator should be able to, but if it's used 
or not i don't know.
is 32 only
 = "is 32 bit only"
Ladislav may know more here. also, r3 has 64bit ints, so maybe random 
will use all of them :)
Sunanda
2-May-2007
[7752]
Random also works on dates and times, so that _may_ get a wider range:
   random now.precise