Bill Allombert on Wed, 18 Apr 2012 15:27:52 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
new GP syntax |
Dear PARI developers, As discussed at the Ateliers PARI, I have finally added two new syntax to GP: 1) ranges: [a..b] is a shortcut for [a,a+1,...,b]: ? [1..10] %2 = [1,2,3,4,5,6,7,8,9,10] 2) comprehension: [a(x)|x<-b,c(x)] is a shortcut for apply(x->a(x),select(x->c(x),b)) ? [x^2|x<-[1..10],isprime(x)] %2 = [4,9,25,49] ? [x^2|x<-primes(10)] %3 = [4,9,25,49,121,169,289,361,529,841] Please experiment with them. Cheers, Bill.