[scilab-Users] path

Serge Steer Serge.Steer at inria.fr
Thu Oct 13 10:25:11 CEST 2011


Le 12/10/2011 22:12, Ricardo Fabbri a écrit :
> @Samuel:
>
> Thanks, that aliasing through assignment is awesome!
>
> What would one do in cases where the original function is actually a
> built in which returns something and doesn't need to be called with '(
> )' :
It works for macro coded functions:
-->ls1=ls
-->ls1
> pw=pwd
>
this is a bug, note that haowever pw() works
> This does not make pw an alias to pwd. The only way I got this to work
> was through the funptr/newfun combination I mentioned:
>   newfun("pw",funptr("pwd"));
>
>
> @Samuel + @Serge:
>
> I opened a feature request in scilab regarding the PATH idea:
> bug #10094
>
> It would be cool to have Serge's implementation, although I'd like
> non-functions as well as this is very handy for really quick
> development of ideas.
it is possible to for scripts, transforming them into functions with no 
input nor output and then calling these function with exec

example:

Suppose you have a script foo.sce that contains some instructions (instr)
it is possible to create a function
function foo
instr
endfunction

the execution of the initial script can then be replaced by exec(foo). 
Warning calling just foo will also execute the script but into a 
temporary scope, which is destroyed at the end of the execution.


> Best,
> Ricardo
> --
> Linux registered user #175401
> www.lems.brown.edu/~rfabbri
>
>
>
> On Wed, Oct 12, 2011 at 3:30 PM, Samuel Gougeon<sgougeon at free.fr>  wrote:
>> Hello Ricardo,
>>
>> Le 12/10/2011 20:09, Ricardo Fabbri a écrit :
>>> Hello, all,
>>>
>>> I have some simple questions, I knew their answer, but I wonder if
>>> things in recent scilab versions:
>>>
>>> - Is there anything like a search PATH setting? For instance, I would
>>> like to execute myscript.sce, but without specifying its full path. I
>>> would also like to load a function automatically if it is in the path,
>>> more or less matlab style.
>>>
>> As far as i know, it is presently not possible. Surprisingly, no wish has
>> yet been posted about such a feature!
>> Yours is welcome! :-)
>> http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab%20software
>>
>>> - Aliases: is there a way to define an alias to a function? for example,
>>>      alias ("doc", help)
>>>
>> doc = help
>> doc isnan // opens the doc for isnan()
>> // This works for primitive (like help) as well as for macros (as isnan:
>> Try)
>> isNAN = isnan
>> isNAN(%pi)
>> isNAN(%nan)
>>
>> HTH
>> Samuel
>>




More information about the users mailing list