3 ms·
"can't do" is not the same as "is not a syntactical built-in". Of course Haskell can represent bounded integers: http://stackoverflow.com/q/7302735 http://stac
by papln 7y ago
"can't do" is not the same as "is not a syntactical built-in". Of course Haskell can represent bounded integers:
http://stackoverflow.com/q/7302735 http://stackoverflow.com/q/7302735
Also, Pascal's ranged integers are only for literals; the are not thoroughly enforced by the compiler. They are trivial to circumvent:
var
y,z: 5..10;
Begin
Read(y); Writeln(y); // 60 works here
y := 10;
z := 2*y; Writeln(z);
https://tio.run/##y0/KSk0u0S1ILE5OzNFNK0j@/z@gKD@9KDFXISU1N9@aS0GhLLEISAJBpU6VlYKpnp6hgTUXl1NqemYeUBAkFZSamKJRqWkNZIYXZZak5uRBePr6WgpmBgpa@iBFlQpWtgogrUB2FYhtpFUJ5sC0VGlac7nmpej9/29mwAUA https://tio.run/##y0/KSk0u0S1ILE5OzNFNK0j@/z@gKD@9KDFXISU1N9...