Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Odd behavior with setting variables Re:(3)

 [1/6] from: al:bri:xtra at: 25-Jul-2000 20:59


Just a few comments.
> currentpath: "ftp://blah:[blah--blah--org]/blah/blah/"
Did you know that Rebol works with URLs directly? Like this:
>> currentpath: ftp://blah:[blah--blah--org]/blah/blah/
== ftp://blah:[blah--blah--org]/blah/blah/ This:
> path: ["blah1" "blah2" "blah3" "blah4" "blah5"]
is better written as: paths: [%blah1/ %"blah blah2/" ... This:
> loop 5 [
is better as: foreach path paths [ Then this:
> append currentpath FIRST path > workpath: join currentpath ["blah.data"] > currentdata: load to-url workpath
becomes clearer as: workpath: join currentpath [path %"blah.data"] and workpath is already a url. You also seem to be repeating a lot of things in the loop, which perhaps should be broken up into a separate function? I think you'll find that when you clean up your script, your problems will vanish. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/

 [2/6] from: webmaster:siliconspecies at: 25-Jul-2000 4:08


Thank You! I will try em. At 08:59 PM 7/25/00 +1200, you wrote:
>Just a few comments. > > currentpath: "ftp://blah:[blah--blah--org]/blah/blah/"
<<quoted lines omitted: 139>>
> > http://www.brainbyte.com > >
Jeff Rubin, CTO/Co-Founder Audiopia Shutup and Listen... http://www.audiopia.com also check out my personal site Brainbyte! http://www.brainbyte.com

 [3/6] 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
<<quoted lines omitted: 9>>
> 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-

 [4/6] from: agem:crosswinds at: 25-Jul-2000 15:55


Maybe simple the glorious all-beginners error ? ;-)
> currentpath: "ftp://blah:[blah--blah--org]/blah/blah/" ??
currentpath: COPY "ftp://blah:[blah--blah--org]/blah/blah/" ; !! rebol-magic, note the internal SOURCE CHANGED below! because of this use [copy "whatever string or other series"] . or copy/deep to be shure. this magic way is called simpler by Carl. else a lot of special cases for advanced uses have to be introduced, i think (now :) . [REBOL[] demo: func[a][ b: "" append b a source demo ] demo "first" demo "second" demo "third" ]
>> demo "first"
demo: func [a][ b: "first" append b a source demo ]
>> demo "second"
demo: func [a][ b: "firstsecond" append b a source demo ]
>> demo "third"
demo: func [a][ b: "firstsecondthird" append b a source demo ]
> currentpath: copy "" > workpath: copy ""
<<quoted lines omitted: 6>>
> > > >Andrew Martin
Volker

 [5/6] from: webmaster:siliconspecies at: 25-Jul-2000 0:50


I have been writing some code and can't seem to get consistent behavior from 1 loop cycle to another in a FORALL basically when I set some variables initially before going into the loop, the loop cycles and at end of loop before it comes in again i reset the variables to what they need to be. but even though i use clear variable or variable: clear variable variable: "string" it does not clear it or set the variable, yet it did work at the beginning. so i come into loop fine works, i reset variables it loops back around and goes in again i reset variables loops back and dies HELP! Thanks, Jeff Jeff Rubin, CTO/Co-Founder Audiopia Shutup and Listen... http://www.audiopia.com also check out my personal site Brainbyte! http://www.brainbyte.com

 [6/6] from: al:bri:xtra at: 25-Jul-2000 20:02


Try: MyNewString: copy "" MyNewBlock: copy [] Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted