Bill Allombert on Tue, 15 Oct 2013 00:42:20 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Branch bill-mt for parallel pari updated |
On Mon, Oct 14, 2013 at 05:05:51PM +0200, Bill Allombert wrote: > On Sun, Oct 13, 2013 at 02:28:25PM +0200, Bill Allombert wrote: > > Dear PARI developers, > > > > An new declaration is available: > > inline(var) > > This declares that var should be inlined in each functions, with the value > > of var at the time the function is created. > > This allows to create functions that are not stored in global variables, > > which is necessar for parallel code. > > I want to clarify that I see inline() as a work-around for a syntactic > limitation in the GP language. > > So maybe we should come with an improved syntax for defining functions. In that spirit I have created a branch bill-nested_braces which changes the way braces are handled in a backward compatible way. The outer braces still serves to extend the logical line, but inner braces will be passed to the parser which will accept fun(arg1,arg2)={BODY} as a valid function definition ending at the second brace. So you can write { my(sinc); sinc(x)= { if(x,sin(x)/x,1) }; fun(a)= { intnum(x=0,a,sinc(x)) }; } parapply(fun,[1..100]) However there is a slight oddity: fun1()= { print(a); }; print(b); and { fun2()= { print(a); }; print(b); } will not be parsed the same way: print(b) belong to fun1() bu tnot to fun2(), instead it belong to the external block. Cheers, Bill.