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

World: r3wp

[Core] Discuss core issues

ICarii
23-Jun-2007
[8354]
it is clear - i was just noting that there is nothing in the rebol 
docs at the moment - nor in wikibooks
Henrik
23-Jun-2007
[8355]
I think deep is in fact default behaviour in R3, because plain copy 
introduces many mistakes for beginners.
ICarii
23-Jun-2007
[8356x4]
a: [a b c [d e f]]
b: copy a
append a/4 'g
;b now has g
c: copy a
append a/4 'h
;c does not have h but b does.
tested and working fine here now :)  i generally use copy/deep with 
complex series but never stopped to wonder why..
something like the following would be useful for new people:
;given the following series
a: [a b c [d e f]]
;perform copy
b: copy a
probe b
>> [a b c [d e f]]
;b contains [a b c [{and references a/4}]]
;this can be seen by appending to a/4 and checking b again
append a/4 'g
probe b
>> [a b c [d e f g]]

;now on copy/deep an exact copy with no referencing of internal series 
is made
c: copy/deep a
append a/4 'h
probe c
>> [a b c [d e f g]]
;c does not have h but b does.
probe b
>> [a b c [d e f g h]]
append a 'i
;and neither b nor c will contain 'i as it is in the outer series
probe c
>> [a b c [d e f g]]
probe b
>> [a b c [d e f g h]]
wikibooks entry updated: http://en.wikibooks.org/wiki/REBOL_Programming/Programming_in_REBOL#Copy_vs_Copy.2Fdeep
Geomol
23-Jun-2007
[8360]
Should we prepare for a revision of the REBOL wikibook, when R3 is 
out? Either change directly or make a now book copying over, what 
is ok and adding new?
BrianH
23-Jun-2007
[8361]
Copy/deep is not the default in R3. Nor would I want it to be - I 
almost never use copy/deep, but use copy quite often, intentionally.
Henrik
24-Jun-2007
[8362]
brianH, sorry, I just seemed to remember Carl talking about inverting 
the behaviour so you'd need a refinement to avoid copying deep.
BrianH
25-Jun-2007
[8363]
Well, he hasn't done it yet. If he did I'd use that refinement all 
of the time - I almost never use /deep.
Pekr
26-Jun-2007
[8364]
Brian - was there already any talk about rebcode on extended R3 testing 
team?
BrianH
29-Jun-2007
[8365]
Yeah. It's not there yet, but its primary implementation technique 
has been generalized for wider use. Several of the dialects that 
have been implemented so far operate in the same way that rebcode 
did, including DRAW.
TimW
30-Jun-2007
[8366x2]
How do you set or reset objects within other prototype objects. i.e.
prot: make object![
	num: none
	names: make object![
		a: copy "A"
		b: copy "B"
	]
]

x: make prot[
	foo: 56
	;how do I set a to be different
	;how do I add a 'c here to set
]
okay.  I got it working.
Anton
1-Jul-2007
[8368]
x: make prot [
	foo: 56
	names: make names [
		a: copy "Different"
		c: copy "Added"
	]
]
Henrik
2-Jul-2007
[8369]
Geomol, the book probably needs a good rewrite or rethinking. Only 
a few sections are still usable.
Sunanda
5-Jul-2007
[8370]
I'm trying to get a list of all the arguments to get-modes. But, 
right now, the online dictionary is broken for that function:
http://www.rebol.com/docs/words/wget-modes.html
Can anyone help?
(Meanwhile, I'll rambo the problem)
btiffin
5-Jul-2007
[8371]
Math question.  Aside from a routine! or Rebcode is there existing 
code to do 32bit by 32bit multiply in REBOL which evaluates to be 
equivalent to C code a * b;  with no overflow throw?
Ladislav
5-Jul-2007
[8372]
c-multiply: func [a [integer!] b [integer!]] [first (1x0 * a) * (1x0 
* b)]
Gregg
5-Jul-2007
[8373]
I thought I had a list somewhere, but can't find it. You probably 
already have all these.

files:
	file-modes
	copy-modes
net ports:
	network-modes
	interfaces
ports:
	port-modes
btiffin
5-Jul-2007
[8374]
Ladislav;  Thank you sir.
Sunanda
5-Jul-2007
[8375]
Thanks Gregg -- I was looking for the definite list of file modes: 
world-write etc.
A bit of extra Googling got me to here:
http://www.rebol.com/docs/core25.html#sect1.1.

It would have been easier with some SEO on the .com and .net sites.
Izkata
5-Jul-2007
[8376]
Like this?
>> print mold get-modes %Fonts.r 'file-modes

[status-change-date modification-date access-date owner-name group-name 
owner-id group-id owner-read owner-write owner-execute group-read 
group-write group-execute world-read world-write world-execute set-user-id 
set-group-id full-path]
>> print mold get-modes %Fonts.r 'world-write
false
Sunanda
6-Jul-2007
[8377]
Thanks Izkata.

The difficulty there is that it returns only the modes availlable 
on your platform.
I needed all the possible modes for cross-platform coding/
Pekr
7-Jul-2007
[8378]
guys, do you have recursive directory read function? Simply put - 
what I need for our kiosk is:

 - script running in the background, window-less
- script checks for new drive to appear periodically
- then it reads specific directory, e.g. %/e/kiosk-update

- then it reads files, and stores them to target dir, not carring 
about adding new dir/file, simply overwriting it

It is kind of one-sided sync :-)

I can't find anything usefull on rebol.org ....
Sunanda
7-Jul-2007
[8379]
Here's some code that traverses an entire dircetory tree:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlTQBC
ICarii
7-Jul-2007
[8380x4]
what in the following code would cause cannot insert on port error?
updatedir: func [current-dir basedir /local contents base-contents 
item base-item item-info base-item-info][

 unless exists? current-dir [return] ;returns if source is not present 
 - eg someone removes a cd
	contents: read current-dir

 unless exists? basedir [make-dir basedir while [not exists? basedir][wait 
 0]]
	base-contents: read basedir
	foreach item contents [
		base-item: find base-contents item
		either dir? item [
			updatedir join current-dir item join basedir item
		][
			either none? base-item [

    write/binary join basedir item read/binary join current-dir item
			][
				item-info: info? join current-dir item
				base-item-info: info? join basedir base-item
				if item-info/date > base-item-info/date [

     write/binary join basedir item read/binary join current-dir item
				]
			]
		]
	]
]
updatedir %sourcedir/ %destdir/
when run repeatedly (if i trap the error) it completes successfully.. 
is there a 1 write at a time rule in rebol?
but apart from the error - is that the sort of thing you were looking 
for Petr?
Pekr
7-Jul-2007
[8384x3]
Icarii - yes, that might help ....
oh my, how usefull is read %/, if you can't use it further dynamically?

== [%c/ %d/ %e/ %g/]


it is missing one backslash. You simply can't  do thing like foreach 
drive drives [print exists? join drive "kiosk/"]
it has to be a bug, because it is not logical - it is a result of 
'read operation, yet if you query the result, e.g. exists? %c/ you 
get 'false result. That is not imo correct.
ICarii
7-Jul-2007
[8387]
that only probably happens under windows where the filesystem is 
so screwy
Pekr
7-Jul-2007
[8388]
:-)
Gabriele
7-Jul-2007
[8389x6]
petr, no, that is not a bug.
>> read %public/www.rebol.com/
== [%index.r %docs/ %bay.jpg %view/ %downloads/]
do you see %public/www.rebol.com/   in the block?
so what you do is, for any dir,
foreach file read dir [do-something-with dir/:file]
>> print-dir: func [dir] [foreach file read dir [print dir/:file]]
>> print-dir %public/www.rebol.com/
public/www.rebol.com/index.r
public/www.rebol.com/docs/
public/www.rebol.com/bay.jpg
public/www.rebol.com/view/
public/www.rebol.com/downloads/
>> print-dir %/
/c/
/d/
/e/
/f/
/g/
/h/
/z/
Gregg
7-Jul-2007
[8395]
Petr, my file-list stuff should be on REBOL.org.
Pekr
7-Jul-2007
[8396x3]
gabriele - how does it relate to my report?
I strictly refuse following result:

>> exists? %rebol.exe
== true
>> exists? %c/
== false
both queried items are result of regular 'read function call on filesystem 
...
Chris
7-Jul-2007
[8399]
>> change-dir %/
== %/
>> exists? %c/
== true
Pekr
7-Jul-2007
[8400x2]
still does not explain my results
what is first slash representing? It is a root-dir? Then it might 
make sense. Or is it just a syntax?
Chris
7-Jul-2007
[8402]
Yes, filesystem root.
Pekr
7-Jul-2007
[8403]
then your example stands for something like following?

>> exists? join %/ %c/
== true