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

World: r3wp

[Core] Discuss core issues

Brett
29-Aug-2005
[1817x2]
reduce-deep: func [
	block [block!]
	/local queue result file eval-state sub-result
][

	; Initialise
	queue: make list! 10
	result: reduce []


 ; Loop until we exhaust all unfinished blocks and we exhaust current 
 block.
	until [

		either empty? :block [
			; If finished this block, but more to process - add our
			; result to higher block result and set that block as current.
			if not empty? queue [
				set/any 'sub-result get/any 'result
				set [result block] queue/1
				insert/only tail result get/any 'sub-result
				queue: remove queue
			]
		][

			; Process current block item.

			either block? block/1 [
				; Save current level to process later,
				; set this new block as current.
				queue: head insert/only queue reduce [result next block]
				result: reduce []
				block: block/1
			][
				; Evaluate item.
				eval-state: do/next block
				insert/only tail result eval-state/1
				block: eval-state/2
			]
		]

		all [tail? block tail? queue]
	]

	; Return final result
	result
]
Not robustly tested.
JaimeVargas
30-Aug-2005
[1819]
How can I access a network drive?
Graham
30-Aug-2005
[1820]
I'm sure it's just  %uncname/
JaimeVargas
30-Aug-2005
[1821]
Humm. Not working here.
Graham
30-Aug-2005
[1822]
perhaps it's %/uncname
Volker
30-Aug-2005
[1823]
IIRC /myserver/volker/...
Anton
31-Aug-2005
[1824]
umm.. tried leading double slash ? eg. %//uncname/
Graham
31-Aug-2005
[1825x3]
My primary scsi hard drive in my server killed windows 2003 somehow. 
 It fails the seagate diagnostics though the seatools can't identify 
the drive.  I put in another scsi drive but even though they all 
have different ids, the new windows 2003 server dies when I reattach 
the old drive ( i want to recover files off it ).  It just reboots 
even in safe mode.  Anyone any ideas as to why it should do that?
Unfortunately BartPE doesn't have the driver for the scsi controller 
so I can't use that to examine the drive.
oops .. wrong channel.
JaimeVargas
31-Aug-2005
[1828]
Not of the suggested ways work for me. I am using XP.
Anton
31-Aug-2005
[1829x2]
Maybe you can read a file directly from the share, but it looks like 
you can't access it because you can't CHANGE-DIR to it ?:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlPCHJ
Hey! The rebol.org mail search is pretty good ! Faster than my computer. 
:)
Sunanda
31-Aug-2005
[1831]
Thanks Anton! We had some fun tuning it (it's done with just REBOL 
objects and blocks by the way)--- It should be even faster if implemented 
on your computer as REBOL.org runs (as far as I can tell) on a shared 
1ghz machine with the slowest hard drives outside of a museum.
Geomol
5-Sep-2005
[1832x5]
context question:
If I inside a context block (an object) in one program write:
do %some-program.r

then I can't reach words and functions in the first program from 
the second. I've also tried to bind words to the first context, but 
without luck. Any ideas? Maybe I should put 2 small test-scripts 
here:
prg1.r:

REBOL []
mycontext: context [
do %prg2.r
o: context [
	f: does [print "Hello World!"]
]
f2
]
prg2.r: 

REBOL[]
f2: does [o/f]
I get this error:

>> do %prg1.r
** Script Error: o has no value
** Where: f2
** Near: o/f
If I exclude mycontext from prg1.r binding the words to the global 
context, then it works. But that's not a nice solution.
Ladislav
5-Sep-2005
[1837x3]
this may work:

prg1.r:

REBOL []
mycontext: context [
#include %prg2.r
o: context [
	f: does [print "Hello World!"]
]
f2
]
include %prg1.r
you just have to use my INCLUDE function
Geomol
5-Sep-2005
[1840]
Okay, taking a look...
Ladislav
5-Sep-2005
[1841]
http://www.fm.vslib.cz/~ladislav/rebol/include.r
Geomol
5-Sep-2005
[1842]
Hmm, still doesn't work.
Ladislav
5-Sep-2005
[1843]
checking
Geomol
5-Sep-2005
[1844x2]
REBOL []

do %include.r

mycontext: context [

include %prg2.r

o: context [
	f: does [print "Hej!"]
]

f2
]	; context
That was prg1.r
Ladislav
5-Sep-2005
[1846x2]
wrong
do %include.r can be only in your user.r
Geomol
5-Sep-2005
[1848]
okay
Ladislav
5-Sep-2005
[1849]
and, moreover, copy the example I posted, don't forget #include !
Geomol
5-Sep-2005
[1850x4]
So I do
#include %prg2.r
inside mycontext in prg1.r? And then write
include %prg1.r
to run it?
>> include %prg1.r
** Script Error: o has no value
** Where: f2
** Near: o/f
oops sorry, forgot something. I got it working now.
Thanks!
Ladislav
5-Sep-2005
[1854]
you are welcome, what did you forget, btw? (asking to be able to 
warn other users)
Geomol
5-Sep-2005
[1855]
Mixed include with #include
Ladislav
5-Sep-2005
[1856x3]
yes, that is a gotcha
I should probably write some instructions
do you find INCLUDE useful?
Geomol
5-Sep-2005
[1859]
I wish, something like your include would be part of core. I'm about 
to use such a functionality with my Canvas project, but it's not 
optimal, as it is now.
Ladislav
5-Sep-2005
[1860]
INCLUDE is available for you, it would be even better if you wrote 
a few usage notes
Geomol
5-Sep-2005
[1861]
The functionality is very usefull. (Maybe your include can do a bit 
too much. I like it simple.) Maybe I could just do %include.r at 
the start of canvas.r, so people doesn't have to do it in their user.r 
files. Or I should go another way and make it one big file for now!? 
Hmmm well, I would like to do modules later on, so only the parts 
needed is included.
Ladislav
5-Sep-2005
[1862x2]
generally #include %something means "put here the contents of %something", 
while include %something means "find %something, process it and do 
the result"
regarding your questions: you can use INCLUDE to make a one big file 
if you like
Geomol
5-Sep-2005
[1864]
But as I understand it, rebol doesn't allow contexts to be mix-matched, 
like I would like to do with a simple: do %something.r
Ladislav
5-Sep-2005
[1865x2]
There is a way how to do %include in your files, if required, of 
course
DO doesn't work as that, it simply does the file without including 
its contents