[REBOL] Re: Rebol Challenge was: A collection of garbage
From: carl::cybercraft::co::nz at: 24-Dec-2003 22:22
On 10-Jul-03, A J Martin wrote:
> Carl wrote:
>> foo: has [file] [
>> file: read %large-file.txt
>> print length? file
>> file: none
>> ]
> Let's assume that the function was like:
> foo: has [file] [
> file: read %large-file.txt
> print length? file
> file
> ]
> How would one arrange to set the value of 'file to none, while still
> being able to return the contents of %large-file.txt ? And do it
> "nicely"? :)
foo: does [
print size? %large-file.txt
read %large-file.txt
]
;)
This isn't done nicely, but I think it'd work...
foo: func [/clear /local file][
either clear [
file: none
][
file: read %large-file.txt
print length? file
file
]
]
Usage...
value: foo foo/clear
--
Carl Read