Bill Allombert on Mon, 06 Aug 2012 01:00:09 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[a<-b,f(a)]


Dear PARI developers,

Some month ago, I have added a syntax extension
[a<-b,f(a)] as a short cut for
[a|a<-b,f(a)].

Unfortunately this conflicts with some valid syntax:
? [a<3]
  ***   syntax error, unexpected integer, expecting '-': [a<3]
  ***                                                        ^-
? [a<-3]
  ***   syntax error, unexpected ']', expecting ',': [a<-3]
  ***                                                     ^-
? [a<3,1]
  ***   syntax error, unexpected integer, expecting '-': [a<3,1]
  ***                                                          ^-

The origin of the problem is that '<-' is not a single token because
x<-1 should be normally parsed as x < (-1), and we parse with a single
token of look-ahead.

Avoiding this problem was a motivation for reserving the single | sign
for comprehension. But there are none in this [a<-b,f(a)] variant.

So is there an alternative to [a<-b,f(a)] ?

Cheers,
Bill.