Anonymous user
Define a primitive data type: Difference between revisions
→[[Define a primitive data type#ALGOL 68]]: fix lang tag
(Added PicoLisp) |
(→[[Define a primitive data type#ALGOL 68]]: fix lang tag) |
||
Line 17:
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}}
▲ # assume max int <= ABS - max negative int #
INT max bounded = ( LENG max int * max int > long max int | ENTIER sqrt(max int) | max int );
Line 118 ⟶ 117:
ABS = (BOUNDED range)BOUNDED: ABS value OF range ASSERTIN []BOUNDED(range);
COMMENT Operators for extended characters set, and increment/decrement
OP +:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a + b ),
+=: = (BOUNDED a, REF BOUNDED b)REF BOUNDED: ( b := a + b ),
Line 159 ⟶ 158:
OVERAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %:= b ),
MODAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %*:= b );
Test:
RANGE range = RANGE(0, 10000);
Line 178 ⟶ 177:
OD;
except bounds error:
SKIP</lang>
Output:
<pre>
Line 192 ⟶ 191:
===Other libraries or implementation specific extensions===
As of February 2009 no open source libraries to do this task have been located.
=={{header|C++}}==
{{works with|g++}}
|