[REBOL] Why doesn't this work? Re:(2)

2000-03-06 Thread rex

On Sat, Mar 4, 2000,  [EMAIL PROTECTED] wrote:

Hi,

two possibilities, the first looks better:

1)

obj: make object! [a: "" b: ""]
t: obj
new-obj: make t []

2)

obj: make object! [a: "" b: ""]
t: 'obj
new-obj: make get t []

Thanks for the help. The error message I received seems pretty odd though.

.:Eric

 ** Script Error: Expected one of: word! - not: block!.
 ** Where: new-obj: make t []



[REBOL] Why doesn't this work? Re:(2)

2000-03-04 Thread Al . Bri

Caution!

REBOL currently doesn't deep copy derived objects with embedded objects in
them.

Your best bet is:

obj!: [a: "" b: ""]
obj: make object! obj!

t!: append copy/deep obj! [c: ""]
t: make object! t!

Extend: func [Base [block!] Extension [block!]] [
append copy/deep Base Extension
]

r!: Extend t! [d: ""]
r: make object! r!

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



[REBOL] Why doesn't remove work? Re:(2)

2000-02-09 Thread tjohnson

Hello Eric:
That did it!! Thanks so much. I have to say that
I haven't looked at the list too much, so let me ask
you this:
I've been programming in C/C++ for years, and have
built numerous libraries of reusable code and useful
classes. 
Does rebol have a parallel strategy?
Any suggestions?
Thanks, Eric 
:) Tim
At 11:25 AM 2/9/00 +0900, you wrote:

Hi Tim,

REMOVE removes by default the first element of a series. So when you say

remove first fp

the first element of FP is a string, and REMOVE will remove the first
element of that string. You want to zap the whole string, I take it,
so you should do:

remove fp

Here's a function based on your code to do what you want. I changed
remove-flag to a true/false flag, which is easier to test for. Also,
when you go through a series deleting some items and skipping others,
FORALL doesn't give you enough control. You have to use

while [ not tail? series-value ] [ ... ]

and use either NEXT or REMOVE every time you go through the loop.

remove-text: func [fp [file!]][
fp: open/lines fp
remove-flag: false
lines-done:  0
while [ not tail? fp ] [
if find first fp "begin insert here" [
print "found"
remove-flag: true
]
either remove-flag [
either find first fp "end insert here" [
remove-flag: false
print "done"
fp: next fp
][
either zero? lines-done [
print "setting lines-done"
lines-done: 1
fp: next fp
][
print ["Removing " first fp]
remove fp
]
]
][
fp: next fp
]
]
update fp
close fp
]

See you,
Eric