[GRASS-dev] r.mapcalc operator precedence table

Glynn Clements glynn at gclements.plus.com
Tue Jun 6 03:38:40 EDT 2006


Huidae Cho wrote:

> > > While editing the operator precedence table in r.mapcalc.html, I found that
> > > operators with higher precedence have HIGHER numbers.  Shouldn't the highest
> > > precedence have the lowest number or 1?
> > 
> > That's the usual convention.
> 
> You mean the convention is that the higher precedence has the higher number?

I meant that your suggestion was the usual convention, but in
retrospect it's less clear-cut. E.g. Haskell uses higher numbers for
higher precedence:

	infixr 9  .
	infixl 9  !!
	infixr 8  ^, ^^, **
	infixl 7  *, /, `quot`, `rem`, `div`, `mod`, :%, %
	infixl 6  +, -
	--infixr 5  :    -- this fixity declaration is hard-wired into Hugs
	infixr 5  ++
	infix  4  ==, /=, <, <=, >=, >, `elem`, `notElem`
	infixr 3  &&
	infixr 2  ||
	infixl 1  >>, >>=
	infixr 1  =<<
	infixr 0  $, $!, `seq`

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list