Thanks Mathieu, for pointing out  the difference.<br><br>Please go through the mail for in line reply.<br><br><div class="gmail_quote">On Fri, Sep 23, 2011 at 1:25 PM, Mathieu Dubois <span dir="ltr"><<a href="mailto:mathieu.dubois@limsi.fr">mathieu.dubois@limsi.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Le 23/09/2011 02:54, Manjusha Joshi a écrit :<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello<br>
<br>
<br>
    For your problem you should have a look at the funcprot function.<br>
<br>
    However, the default mode is to issue a warning when redefining<br>
    predefined functions.<br>
<br>
Thanks for reply.<br>
<br>
I tried following<br>
  A  =<br>
<br>
     2.    3.    4.    78.<br>
<br>
<br>
-->funcprot(2)<br>
<br>
<br>
-->sum(A)<br>
  ans  =<br>
<br>
     87.<br>
<br>
-->sum=98<br>
       !--error 223<br>
It is not possible to redefine the sum primitive this way (see clearfun).<br>
<br>
<br>
-->deff('y=f(x)','y=x*x')<br>
<br>
-->deff('y=f(x)','y=2*x*x')<br>
                          !--error 111<br>
Trying to re-define function f.<br>
<br>
<br>
User defined function should be redefined. At the same time scilab<br>
predefined functions should not.<br>
I tried following:<br>
<br>
-->clearfun f<br>
  ans  =<br>
<br>
   F<br>
<br>
-->clearfun sum<br>
  ans  =<br>
<br>
   T<br>
Now it is allowing to redefine sum which should be protected. On the<br>
other hand it is not allowing to redefine the function f. Which one<br>
needs to redefine several times in one session.<br>
<br>
</blockquote></div></div>
clearfun is to clear predefined functions like sum (maybe it should be called clearpredef).<br>
<br>
To redefine your function f, use clear f.<br>
You can check that f exists with the exists function (not mandatory).</blockquote><div> </div> True! Variables and user defined function can be cleared by clear command.<br><div><br> <br>-->exists('f')<br> ans  =<br>
 <br>    1. <br>works fine with user defined functions. How ever, which are already known to user since, it is defined by user.<br>How ever, Scilab defined functions, which I will call as predefined functions are not all known to user, so there is risk of pre defined function <br>
get assigned by user by mistake.<br><br>   <br>-->exists('prod')<br> ans  =<br> <br>    0.  <br><br>Is there any way to check that (for example)  prod is a predefined function?<br>Regards,<br><br><br> 
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
What is going wrong? Am I missing something.<br>
Regards<br>
<br>
<br>
<br>
    On 09/22/2011 12:51 PM, Manjusha Joshi wrote:<br>
<br>
        Hello,<br>
<br>
        sum, prod etc. are predefined functions in scilab.<br>
<br>
        if some one with out knowing the name of the  predefind function<br>
        use  it as avariable name, as follows:<br>
<br>
<br>
        -->A=[2,3,4,78]<br>
          A  =<br>
<br>
            2.    3.    4.    78.<br>
<br>
        -->sum(A)<br>
          ans  =<br>
<br>
            87.<br>
<br>
        -->sum=96<br>
          sum  =<br>
<br>
            96.<br>
<br>
        -->sum(A)<br>
               !--error 21<br>
        Invalid index.<br>
<br>
<br>
<br>
          scilab not even complains. In old versions at least there was<br>
        some error message.<br>
<br>
        This happens in the current session only.<br>
        Is there any way to protect the predefined functions and their<br>
        names?<br>
        I think we should declare these function names as predefined<br>
        functions.<br>
<br>
<br>  
 <br>
<br>
<br>
<br>
<br>
<br>
-- <br></blockquote></div></div></blockquote></div> <br>-Manjusha<br>