[REBOL] Odd behavior with setting variables Re:(3)
From: petr::krenzelok::trz::cz at: 25-Jul-2000 11:14
[webmaster--SILICONSPECIES--COM] wrote:
> That worked even less.
>
> I have no idea what is going wrong. I have tried so many things.
> But it will not clear or delete the contents of the variables in addition,
> I actually set the variable again afterwords and it doesn't take.
>
> Here is basic part of code
I will try to comment although I don't know what you are trying to achieve ....
> block: make block! 300
> currentpath: "ftp://blah:[blah--blah--org]/blah/blah/"
> workpath: "ftp://blah:[blah--blah--org]/blah/blah/"
First - why are you using string here and below you are converting into "to-url"
once again? What about:
currentpath: ftp://blah:[blah--blah--org]/blah/blah/
rebol says:
->> type? currentpath: ftp://blah:[blah--blah--org]/blah/blah/
== url!
> path: ["blah1" "blah2" "blah3" "blah4" "blah5"]
>
> ;This is START OF LOOP
>
> loop 5 [
> append currentpath FIRST path
> workpath: join currentpath ["blah.data"]
> currentdata: load to-url workpath
> currentdata: join #"^"" [currentdata #"^""]
> append block currentdata
>
> append currentpath FIRST path
> workpath: join currentpath ["blah.data"]
> currentdata: load to-url workpath
> currentdata: join #"^"" [currentdata #"^""]
> append block currentdata
>
hmm, I don't understand here. Are you repeating above blocks five times here or you
just tried to show us your loop repeats five times? There is several issues
however:
- maybe more convenient loop could be used, e.g.
for i 1 (length? path) 1 [code-here] ; so you will achieve a little bit more
dynamic aproach ...
so in the case of using for i .... you would do 'append currentpath path/:i
- append currentpath first path ; modifies currentpath and there is no way back
....
what about just one line?:
workpath: join currentpath [first path "blah.data"] ; in the case of my advice
about using url directly it would be %blah.data and in the case o using for i ...
path/:i
that way currentpath will not be modified. 'Join will join each member of block to
'currentpath but will not modify it and 'workpath is gonna point to the result ...
- currentdata: join {"} [load to-url workpath {"}] ; just one line once again ...
also - why to use char datatype? look how I enclosed " ....
> .
> .
> .
> path: NEXT path
once using for i ... this would not be needed
> currentpath: copy ""
> workpath: copy ""
> currentpath: "ftp://blah:[blah--blah--org]/blah/blah/"
> workpath: "ftp://blah:[blah--blah--org]/blah/blah/"
> currentfile: join currentblah [".r"] ;this is set in code but not included here
join currentBLAH? :-) a bug or ... any way - I would suggest using rebollish
current-path, current-file naming convention ...
> save to-file currentfile block
> block: copy []
> ]
> ;This is END OF LOOP
>
If it will not help, send me a real code, except the names and passwords ...
Cheers,
-pekr-