viernes, 25 de marzo de 2011

establecer tipos

En contraste con otros lenguajes de programación de su tiempo, Pascal soporta un tipo de conjunto:
var var
  set1 : set of 1..10; set1: conjunto de 1 .. 10;
  set2 : set of 'a' .. 'z' ; set2: conjunto de 'a' .. 'z';
  set3 : set of pear.. orange ; SET3: conjunto de pera .. naranja;
A set is a fundamental concept for modern mathematics, and they may be used in a many algorithms. Un conjunto es un concepto fundamental para las matemáticas modernas, y pueden ser utilizados en un muchos algoritmos. Such a feature is useful and may be faster than an equivalent construct in a language that does not support sets. Esta función es útil y puede ser más rápido que la construcción de un equivalente en un idioma que no es compatible con juegos. For example, for many Pascal compilers: Por ejemplo, para muchos compiladores de Pascal:
if i in [ 5..10 ] then si yo en [5 .. 10] y
... ...
executes faster than: ejecuta más rápido que:
if ( i>4 ) and ( i<11 ) then if (i> 4) y (i <11) y luego
... ...
Sets of non-contiguous values can be particularly useful, in terms of both performance and readability: Conjuntos de valores no contiguos puede ser particularmente útil, en términos de rendimiento y facilidad de lectura:
if i in [ 0..3 , 7 , 9 , 12..15 ] then si 15] i 9, en [0 .. 3, 7, 12 .. a continuación,
... ...
For these examples, which involve sets over small domains, the improved performance is usually achieved by the compiler representing set variables as bitmasks. Para estos ejemplos, que incluyen conjuntos más pequeños dominios, el mejor rendimiento se consigue normalmente por el compilador que representan variables definidas como máscaras de bits. The set operators can then be implemented efficiently as bitwise machine code operations. Los operadores citados a continuación, se puede implementar eficientemente las operaciones bit a bit de código de máquina

No hay comentarios:

Publicar un comentario