[Maxima] return statement

Volker van Nek volkervannek at googlemail.com
Wed Feb 15 15:49:35 CST 2012


Yes. Here is an example:

(%i1) f(x) := catch( block([y:0], for i thru 3 do if i = x then throw(i),
y) )$
(%i2) map(f, [1,2,3,4,5,6,7]);
(%o2)                        [1, 2, 3, 0, 0, 0, 0]

Volker van Nek

2012/2/15 Stavros Macrakis <macrakis at alum.mit.edu>

> I believe you need to use catch/throw for this.
>
>             -s
>
> On Wed, Feb 15, 2012 at 11:45, Edd Barrett <vext01 at gmail.com> wrote:
>
>> Hi,
>>
>> Is there kind of return statement which actually returns from a function
>> and not just a block (even when nested)?
>>
>> I don't see one in the manual, did I miss it?
>>
>> Cheers
>>
>> --
>> Best Regards
>> Edd Barrett
>>
>> http://www.theunixzoo.co.uk
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120215/ff66c9a5/attachment.html>


More information about the Maxima mailing list