Thanks for your optimization

-----Message d'origine-----
De : Gabriele Santilli [mailto:[EMAIL PROTECTED]]
Envoyé : lundi 15 avril 2002 18:20
À : 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ères
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 <[EMAIL PROTECTED]>  --  REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.

Reply via email to