langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
22
Task/Compound-data-type/NetRexx/compound-data-type.netrexx
Normal file
22
Task/Compound-data-type/NetRexx/compound-data-type.netrexx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
|
||||
class RCompoundDataType
|
||||
method main(args = String[]) public static
|
||||
pp = Point(2, 4)
|
||||
say pp
|
||||
return
|
||||
|
||||
class RCompoundDataType.Point -- inner class "Point"
|
||||
properties indirect -- have NetRexx create getters & setters
|
||||
x = Integer
|
||||
y = Integer
|
||||
|
||||
method Point(x_ = 0, y_ = 0) public -- providing default values for x_ & y_ lets NetRexx generate intermediate constructors Point() & Point(x_)
|
||||
this.x = Integer(x_)
|
||||
this.y = Integer(y_)
|
||||
return
|
||||
|
||||
method toString() public returns String
|
||||
res = 'X='getX()',Y='getY()
|
||||
return res
|
||||
5
Task/Compound-data-type/OCaml/compound-data-type-1.ocaml
Normal file
5
Task/Compound-data-type/OCaml/compound-data-type-1.ocaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type tree = Empty
|
||||
| Leaf of int
|
||||
| Node of tree * tree
|
||||
|
||||
let t1 = Node (Leaf 1, Node (Leaf 2, Leaf 3))
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-2.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-2.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
type point = { x : int; y : int }
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-3.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-3.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
let p = { x = 4; y = 5 }
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-4.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-4.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
p.x (* evaluates to 4 *)
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-5.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-5.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
type mutable_point = { mutable x2 : int; mutable y2 : int }
|
||||
3
Task/Compound-data-type/OCaml/compound-data-type-6.ocaml
Normal file
3
Task/Compound-data-type/OCaml/compound-data-type-6.ocaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
let p2 = { x2 = 4; y2 = 5 } in
|
||||
p2.x2 <- 6;
|
||||
p2 (* evaluates to { x2 = 6; y2 = 5 } *)
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-7.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-7.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
let p = (2,3)
|
||||
35
Task/Compound-data-type/Objeck/compound-data-type.objeck
Normal file
35
Task/Compound-data-type/Objeck/compound-data-type.objeck
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
class Point {
|
||||
@x : Int;
|
||||
@y : Int;
|
||||
|
||||
New() {
|
||||
@x := 0;
|
||||
@y := 0;
|
||||
}
|
||||
|
||||
New(x : Int, y : Int) {
|
||||
@x := x;
|
||||
@y := y;
|
||||
}
|
||||
|
||||
New(p : Point) {
|
||||
@x := p->GetX();
|
||||
@y := p->GetY();
|
||||
}
|
||||
|
||||
method : public : GetX() ~ Int {
|
||||
return @x;
|
||||
}
|
||||
|
||||
method : public : GetY() ~ Int {
|
||||
return @y;
|
||||
}
|
||||
|
||||
method : public : SetX(x : Int) ~ Nil {
|
||||
@x := x;
|
||||
}
|
||||
|
||||
method : public : SetY(y : Int) ~ Nil {
|
||||
@y := y;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
def temp-table point
|
||||
field x as int
|
||||
field y as int
|
||||
.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
'SHORT FORM
|
||||
type point float x,y
|
||||
|
||||
'FULL FORM
|
||||
type point
|
||||
float x
|
||||
float y
|
||||
end type
|
||||
1
Task/Compound-data-type/Oz/compound-data-type-1.oz
Normal file
1
Task/Compound-data-type/Oz/compound-data-type-1.oz
Normal file
|
|
@ -0,0 +1 @@
|
|||
P = point(x:1 y:2)
|
||||
4
Task/Compound-data-type/Oz/compound-data-type-2.oz
Normal file
4
Task/Compound-data-type/Oz/compound-data-type-2.oz
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
case P of point(x:X y:Y) then
|
||||
{Show X}
|
||||
{Show Y}
|
||||
end
|
||||
2
Task/Compound-data-type/PARI-GP/compound-data-type.pari
Normal file
2
Task/Compound-data-type/PARI-GP/compound-data-type.pari
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
point.x=1;
|
||||
point.y=2;
|
||||
4
Task/Compound-data-type/PL-I/compound-data-type.pli
Normal file
4
Task/Compound-data-type/PL-I/compound-data-type.pli
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define structure
|
||||
1 point,
|
||||
2 x float,
|
||||
2 y float;
|
||||
3
Task/Compound-data-type/Pascal/compound-data-type.pascal
Normal file
3
Task/Compound-data-type/Pascal/compound-data-type.pascal
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
type point = record
|
||||
x, y: integer;
|
||||
end;
|
||||
1
Task/Compound-data-type/Perl-6/compound-data-type-1.pl6
Normal file
1
Task/Compound-data-type/Perl-6/compound-data-type-1.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
my @point = 3, 8;
|
||||
1
Task/Compound-data-type/Perl-6/compound-data-type-2.pl6
Normal file
1
Task/Compound-data-type/Perl-6/compound-data-type-2.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
my %point = x => 3, y => 8;
|
||||
2
Task/Compound-data-type/Perl-6/compound-data-type-3.pl6
Normal file
2
Task/Compound-data-type/Perl-6/compound-data-type-3.pl6
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class Point { has $.x is rw; has $.y is rw; }
|
||||
my Point $point .= new(x => 3, y => 8);
|
||||
5
Task/Compound-data-type/Pop11/compound-data-type.pop11
Normal file
5
Task/Compound-data-type/Pop11/compound-data-type.pop11
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
uses objectclass;
|
||||
define :class Point;
|
||||
slot x = 0;
|
||||
slot y = 0;
|
||||
enddefine;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Structure MyPoint
|
||||
X.i
|
||||
Y.i
|
||||
EndStructure
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Structure MyFileDate
|
||||
name.s
|
||||
StructureUnion
|
||||
Date_as_txt.s
|
||||
Date_in_Ticks.l
|
||||
EndStructureUnion
|
||||
EndStructure
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
type mypoint
|
||||
embed
|
||||
integer x
|
||||
integer y
|
||||
end type
|
||||
10
Task/Compound-data-type/SIMPOL/compound-data-type-2.simpol
Normal file
10
Task/Compound-data-type/SIMPOL/compound-data-type-2.simpol
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
type mypoint
|
||||
embed
|
||||
integer x
|
||||
integer y
|
||||
end type
|
||||
|
||||
function mypoint.new(mypoint me, integer x, integer y)
|
||||
me.x = x
|
||||
me.y = y
|
||||
end function me
|
||||
6
Task/Compound-data-type/SNOBOL4/compound-data-type.sno
Normal file
6
Task/Compound-data-type/SNOBOL4/compound-data-type.sno
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
data('point(x,y)')
|
||||
p1 = point(10,20)
|
||||
p2 = point(10,40)
|
||||
output = "Point 1 (" x(p1) "," y(p1) ")"
|
||||
output = "Point 2 (" x(p2) "," y(p2) ")"
|
||||
end
|
||||
4
Task/Compound-data-type/Seed7/compound-data-type.seed7
Normal file
4
Task/Compound-data-type/Seed7/compound-data-type.seed7
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const type: Point is new struct
|
||||
var integer: x is 0;
|
||||
var integer: y is 0;
|
||||
end struct;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
datatype tree = Empty
|
||||
| Leaf of int
|
||||
| Node of tree * tree
|
||||
|
||||
val t1 = Node (Leaf 1, Node (Leaf 2, Leaf 3))
|
||||
|
|
@ -0,0 +1 @@
|
|||
val p = (2,3)
|
||||
|
|
@ -0,0 +1 @@
|
|||
val p = { x = 4, y = 5 }
|
||||
|
|
@ -0,0 +1 @@
|
|||
point :: x y
|
||||
|
|
@ -0,0 +1 @@
|
|||
p = point[x: 'foo',y: 'bar']
|
||||
|
|
@ -0,0 +1 @@
|
|||
f = point$[x: g,y: h]
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
t = ~x p
|
||||
u = ~y p
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Structure Simple_Point
|
||||
Public X, Y As Integer
|
||||
End Structure
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
Structure Immutable_Point
|
||||
Private m_X As Integer
|
||||
Private m_Y As Integer
|
||||
|
||||
Public Sub New(ByVal x As Integer, ByVal y As Integer)
|
||||
m_X = x
|
||||
m_Y = y
|
||||
End Sub
|
||||
|
||||
Public ReadOnly Property X() As Integer
|
||||
Get
|
||||
Return m_X
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Y() As Integer
|
||||
Get
|
||||
Return m_Y
|
||||
End Get
|
||||
End Property
|
||||
|
||||
End Structure
|
||||
4
Task/Compound-data-type/XSLT/compound-data-type-1.xslt
Normal file
4
Task/Compound-data-type/XSLT/compound-data-type-1.xslt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<point x="20" y="30"/>
|
||||
|
||||
<!-- context is a point node. The '@' prefix selects named attributes of the current node. -->
|
||||
<fo:block>Point = <xsl:value-of select="@x"/>, <xsl:value-of select="@y"/></fo:block>
|
||||
9
Task/Compound-data-type/XSLT/compound-data-type-2.xslt
Normal file
9
Task/Compound-data-type/XSLT/compound-data-type-2.xslt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<circle>
|
||||
<point>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
</point>
|
||||
<radius>10</radius>
|
||||
</circle>
|
||||
|
||||
<!-- context is a circle node. Children are accessed using a path-like notation (hence the name "XPath"). -->
|
||||
Loading…
Add table
Add a link
Reference in a new issue