export(f=i->i^2+1);
parsum(i=1,1,f(i))
parsum(i=1,10,f(i))

\\ errors
f(i)=z=3;i^2+1;
export(f);
parsum(i=1,10,f(i))

f(i)=local(z);i^2+1;
export(f);
parsum(i=1,10,f(i))

f(i)=local(z=3);i^2+1;
export(f);
parsum(i=1,10,f(i))

world="sequential";
export(world="parallel");
inline(prpar,prseq,prsin)


prsin()=parfor(i=1,1,world,E,return(E));
prseq()=parfor(i=1,3,1,E,if(i==3,return(world)));
prpar()=parfor(i=1,3,world,E,if(i==3,return(E)));
prsin()
prseq()
prpar()

parfor(i=3,3,prsin(),E,if(i==3,return(E)))
parfor(i=3,3,prseq(),E,if(i==3,return(E)))
parfor(i=3,3,prpar(),E,if(i==3,return(E)))

parfor(i=1,3,prsin(),E,if(i==3,return(E)))
parfor(i=1,3,prseq(),E,if(i==3,return(E)))
parfor(i=1,3,prpar(),E,if(i==3,return(E)))

parfor(i=1,3,1,E,if(i==3,return(prsin())))
parfor(i=1,3,1,E,if(i==3,return(prseq())))
parfor(i=1,3,1,E,if(i==3,return(prpar())))
