Ascend FD-23R Manual de usuario Pagina 72

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 81
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 71
60 CHAPTER B. Declaration of Primitives (file basic.toy)
:: real -> real -> real
% integer powers
primitive (^) :: real -> int -> real
% binary integer functions
primitive div, mod, gcd :: int -> int -> int
% rounding and truncating functions
primitive round,trunc,floor,ceiling :: real -> int
% integer to real conversion
primitive toReal :: int -> real
% relational operators
primitive (<),(<=),(>),(>=) :: real -> real -> bool
% equality and disequality functions
primitive (==),(/=) :: A -> A -> bool
% infix operator precedences
infix 90 ^,**
infix 80 /
infixl 80 *
infixl 70 +,-
infix 50 < ,<=,>,>=
infix 20 ==, /=
% ’if_then_else’ and ’if_then’ functions are equivalent to the ’sugar syntax’
% functions if .. then .. else and if .. then, but useful as partial functions
if_then_else :: bool -> A -> A -> A
if_then_else true X Y = X
if_then_else false X Y = Y
if_then :: bool -> A -> A
if_then true X = X
% ’flip’ function is necessary for syntax sections management .
flip :: (A -> B -> C) -> B -> A -> C
flip F X Y = F Y X
Vista de pagina 71
1 2 ... 67 68 69 70 71 72 73 74 75 76 77 ... 80 81

Comentarios a estos manuales

Sin comentarios