Ascend FD-23R Manual de usuario Pagina 74

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 81
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 73
62 CHAPTER C. Common Functions (file misc.toy)
false ‘or‘ false = false
% Sequential and
false /\ _ = false
true /\ X = X
% Sequential or
true \/ X = true
false \/ X = X
% Negation
not true = false
not false = true
andL, orL ,orL’ :: [bool] -> bool
andL = foldr (/\) true
orL = foldr or false
orL’ = foldr (\/) false
% orL’ is ’stricter’, but more deterministic, than orL
any, any’,all :: (A -> bool) -> [A] -> bool
any P = orL . (map P)
any’ P = orL’ . (map P)
% any’ is ’stricter’, but more deterministic, than any
all P = andL . (map P)
undefined :: A
undefined = if false then undefined
% (def X) is true if X is finite and totally defined
def X :- X == _
% (not_undef X) is true if X is not undefined
not_undef X :- X /= _
% (nf X) is the identity, restricted to finite and totally defined values
% Operationally, (nf X) forces the computation of a normal form for X,
% if it exists.
nf X = Y <== X==Y
% (hnf X) is the identity, restricted to not undefined values.
% Operationally, (hnf X) forces the computation of a head normal form for X,
% if it exists.
Vista de pagina 73
1 2 ... 69 70 71 72 73 74 75 76 77 78 79 80 81

Comentarios a estos manuales

Sin comentarios