Define a primitive data type: Difference between revisions

m
ooRexx move to proper position
(add ooRexx)
m (ooRexx move to proper position)
Line 926:
op ( +. ) a b ;;
- : float bounded = {value = 7.8; bounds = {min = 1.; max = 10.}}</lang>
 
=={{header|Oz}}==
Normally new data types are implemented as classes or as abstract data types in modules. We cannot extend operators, though.
 
In this case we are lucky. As a feature of constraint programming we can easily constrain the domain of integers.
 
<lang oz>declare
I
in
I::1#10
I = {Pow 2 4}</lang>
 
Output:
<pre>
%***************************** failure **************************
%**
%** Tell: I{1#10} = 16
%**
%** Call Stack:
%** procedure 'IntPow' in file "/Users/raph/devel/mozdss-branch/mozart/share/lib/base/Number.oz", line 32, column 3, PC = 16461488
%**--------------------------------------------------------------
</pre>
 
=={{header|ooRexx}}==
Line 1,000 ⟶ 978:
Error 88 running D:\tinyint.rex line 27: Invalid argument
Error 88.907: Argument 1 must be in the range 1 to 10; found "11" </pre>
 
=={{header|Oz}}==
Normally new data types are implemented as classes or as abstract data types in modules. We cannot extend operators, though.
 
In this case we are lucky. As a feature of constraint programming we can easily constrain the domain of integers.
 
<lang oz>declare
I
in
I::1#10
I = {Pow 2 4}</lang>
 
Output:
<pre>
%***************************** failure **************************
%**
%** Tell: I{1#10} = 16
%**
%** Call Stack:
%** procedure 'IntPow' in file "/Users/raph/devel/mozdss-branch/mozart/share/lib/base/Number.oz", line 32, column 3, PC = 16461488
%**--------------------------------------------------------------
</pre>
 
=={{header|Pascal}}==
2,295

edits