[Scilab-Dev] list as output in function call

Antoine ELIAS antoine.elias at scilab-enterprises.com
Wed Apr 24 09:25:07 CEST 2019


Le 23/04/2019 à 22:46, Stéphane Mottelet a écrit :
> Le 23/04/2019 à 22:28, Antoine ELIAS a écrit :
>
>> Hello Stéphane,
>>
>> Just to be sure, you want that we fill the X-list with all outputs of 
>> ngdrid.
>> Following witch information, size(X) or size(outputs) ?
>> In your cas I suppose that the size is the same.
>> What append if X is not a list or does not have the good size ?
> the same thing that happens if in ngrid(x(:)) x is not a list or has 
> not the good size :-D
I'm not sure that we speak about the same things ( there are 2 X/x in 
your example ).
I speak about number of outputs from the function and size of container 
that "receive" data.
>>
>> Some functions that returns multiple arguments, "look" how many as 
>> expected by caller
>> a = size(x) vs [a,b] = size(x) for example.
>> Does we must provide size(X) to ngrid ?
>
> After messing around the ast module I know it is not simple. But 
> seeing this naïvely, it seems as simple as giving the number of 
> outputs when running
I think it would not be very difficult to do. But my questions are most 
about goals and implications of this kind of features.
I'm not really ready to break code or/and compatibility for very 
situational features to avoid typing few characters ;)
I understand that will be useful but sometimes is not easy to imagine 
implications ( like a + [], we learn from our mistakes :p )

>
> [X(1),X(2),X(3)] = ndgrid(x(:))
>
>>
>> Just a question, specific to ndgrid, why do not update the function 
>> to return a list in case of nargout == 1 ?
>
> This kind of behaviour is the default in Julia, for all functions. But 
> we don't need this in Scilab...
It was the same in very first versions of Scilab 6 ( before alphas I 
think ) but for compatibility with familly 5, we change that ;)

>
> S.
>
>>
>> Regards,
>> Antoine
>> Le 23/04/2019 à 22:14, Stéphane Mottelet a écrit :
>>> Hello all,
>>>
>>> After seeing this question on stackoverflow
>>>
>>> https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/stackoverflow.com/questions/55757856/ndgrid-input-and-output-from-cell-array 
>>>
>>>
>>> I realized that the current features of Scilab are quite asymmetric 
>>> w.r.t. the use of an "expanded" list as input, which is supported, 
>>> as in
>>>
>>> x = list(1:2,1:2,1:2)
>>> ndgrid(x(:))
>>>
>>> and as output, which is not supported, as in
>>>
>>> X = list(,,)
>>> X(:) = ndgrid(x(:))
>>>
>>> Would it be complicated to implement the above ?
>>>
>>> S.
>>>
>>> _______________________________________________
>>> dev mailing list
>>> dev at lists.scilab.org
>>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev 
>>>
>>
>> _______________________________________________
>> dev mailing list
>> dev at lists.scilab.org
>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/dev 
>>
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev




More information about the dev mailing list