문제

I know about perlop. What I am looking for is a quick lookup like the GHCi :info command:

ghci> :info (+)
class (Eq a, Show a) => Num a where
    (+) :: a -> a -> a
    ...
    -- Defined in GHC.Num
infixl 6 +

where I learn (+) is left-associative and has a precedence level of 6 from the infixl 6 + line.

도움이 되었습니까?

해결책

I realize that it is not exactly what you ask for, but what about:

perl -MO=Deparse,-p -e "print $a+$b*$c**$d;"

it prints parentheses around the expressions according to precedence:

print(($a + ($b * ($c ** $d))));

And for things out of perl distibution, you can look on perlopquick - the pod arranged very similar manner as you specified in your question.

다른 팁

Any reasonable reference manual and electronic version or help facility for the language should include the operator precedence in a list either horizontal or vertical, starting with the first entry as the highest prcedence.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top