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

[REBOL] Re: comments for beginner ugly code ;-)

From: sags:apollo:lv at: 15-Mar-2005 11:18

Thanks Anton! On 15 Mar 2005 at 0:33, Anton Rolls wrote: >It doesn't look so much like beginner code. :) I started to code from end of eighties, but neverdid it as proffesional - no diploma either. Thinking about it. >But I have one thing to point out. Look at this >console session: >> f: func [var][rez: [] append rez var rez] > f 2 > ;== [2] >... >You can seethis potential problem in procArtFile. >Should do a COPY: >> rez: copy [] Aha its clear - so Rebol fynction values remains outside functions?
> next next next artText  ==>  skip artText 3  ==> 
at artText 4 Actualy this was a bit my lazines >There are lots of places in the code where you can optimize >in the above way. All those REPEND RESULT are repetitive and it's >usually more convenient to put everything to be repended into a block >and repend that just once, eg: >> repend result [>  blah >  blah >  blah > ] >It is o'k. Now my code is more viewable. And then I can't use "if" because it returns none, but of course I use either, that in else case returns "". >JOIN will keep the type of its first argument, so as underDir is >already a file!, there is no need to convert it backwards and >forwards. This should be just as good: >> join underDir [fileName2 chapter-info] >>You should also be able to do this: >> underDir/:fileName2/:chapter-info Very shortly and fine. >Sorry I haven't commented on the overriding aspects of your code