return statement



On Wed, Feb 15, 2012 at 10:49:35PM +0100, Volker van Nek wrote:
> 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]

Sorry to drag an old thread up, but can i recommend some syntactic sugar for
this? It seems like a very common thing to want to do; or, atleast if you come
for an imperative programming background (as i do).

Thanks

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk