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

[REBOL] Re: My function seems to have no effect

From: richard:coffre:francetelecom at: 16-Apr-2002 9:47

Thanks for your optimization -----Message d'origine----- De : Gabriele Santilli [mailto:[g--santilli--tiscalinet--it]] Envoy=E9 : lundi 15 avril 2002 18:20 =C0 : COFFRE Richard FTO Objet : [REBOL] Re: My function seems to have no effect Hi COFFRE, On Monday, April 15, 2002, 11:46:04 AM, you wrote: CRF> get_func_name: make function! [ chaine ] [ CRF> use [ guillemet ] [ CRF> guillemet: make string! {"} CRF> remove/part chaine 6 CRF> foo: copy/part chaine 1 1 CRF> if foo == guillemet [ remove/part chaine 1 ] CRF> ; Supprimer les 2 derniers caract=E8res CRF> clear skip tail chaine -2 CRF> return (chaine) CRF> ] CRF> ] I see others have answered your question, but I'd like to point out another way to write your function; I hope it can be useful. get_func_name: func [chaine /local chars-to-skip start end] [ chars-to-skip: either chaine/7 = #"^"" [7] [6] start: skip chaine chars-to-skip end: skip tail chaine -2 copy/part start end ] which can be reduced to: get_func_name: func [chaine] [ copy/part skip chaine either chaine/7 = #"^"" [7] [6] skip tail chaine -2 ] which will probably be much faster than your version. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r