Define a primitive data type: Difference between revisions
Content added Content deleted
(Added PicoLisp) |
(→[[Define a primitive data type#ALGOL 68]]: fix lang tag) |
||
Line 17: | Line 17: | ||
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}} |
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}} |
||
⚫ | |||
<!-- Note: I cannot use<lang algol68> here because algol support UTF-8 characters ÷×≤≥↑ etc, and some code is COMMENTED out, sorry --> |
|||
⚫ | |||
INT max bounded = ( LENG max int * max int > long max int | ENTIER sqrt(max int) | max int ); |
INT max bounded = ( LENG max int * max int > long max int | ENTIER sqrt(max int) | max int ); |
||
Line 118: | Line 117: | ||
ABS = (BOUNDED range)BOUNDED: ABS value OF range ASSERTIN []BOUNDED(range); |
ABS = (BOUNDED range)BOUNDED: ABS value OF range ASSERTIN []BOUNDED(range); |
||
COMMENT Operators for extended characters set, and increment/decrement |
COMMENT Operators for extended characters set, and increment/decrement: |
||
OP +:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a + b ), |
OP +:= = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a := a + b ), |
||
+=: = (BOUNDED a, REF BOUNDED b)REF BOUNDED: ( b := a + b ), |
+=: = (BOUNDED a, REF BOUNDED b)REF BOUNDED: ( b := a + b ), |
||
Line 159: | Line 158: | ||
OVERAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %:= b ), |
OVERAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %:= b ), |
||
MODAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %*:= b ); |
MODAB = (REF BOUNDED a, BOUNDED b)REF BOUNDED: ( a %*:= b ); |
||
END COMMENT |
|||
Test: |
Test: |
||
RANGE range = RANGE(0, 10000); |
RANGE range = RANGE(0, 10000); |
||
Line 178: | Line 177: | ||
OD; |
OD; |
||
except bounds error: |
except bounds error: |
||
SKIP |
SKIP</lang> |
||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 192: | Line 191: | ||
===Other libraries or implementation specific extensions=== |
===Other libraries or implementation specific extensions=== |
||
As of February 2009 no open source libraries to do this task have been located. |
As of February 2009 no open source libraries to do this task have been located. |
||
=={{header|C++}}== |
=={{header|C++}}== |
||
{{works with|g++}} |
{{works with|g++}} |