langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View 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

View 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))

View file

@ -0,0 +1 @@
type point = { x : int; y : int }

View file

@ -0,0 +1 @@
let p = { x = 4; y = 5 }

View file

@ -0,0 +1 @@
p.x (* evaluates to 4 *)

View file

@ -0,0 +1 @@
type mutable_point = { mutable x2 : int; mutable y2 : int }

View file

@ -0,0 +1,3 @@
let p2 = { x2 = 4; y2 = 5 } in
p2.x2 <- 6;
p2 (* evaluates to { x2 = 6; y2 = 5 } *)

View file

@ -0,0 +1 @@
let p = (2,3)

View 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;
}
}

View file

@ -0,0 +1,4 @@
def temp-table point
field x as int
field y as int
.

View file

@ -0,0 +1,8 @@
'SHORT FORM
type point float x,y
'FULL FORM
type point
float x
float y
end type

View file

@ -0,0 +1 @@
P = point(x:1 y:2)

View file

@ -0,0 +1,4 @@
case P of point(x:X y:Y) then
{Show X}
{Show Y}
end

View file

@ -0,0 +1,2 @@
point.x=1;
point.y=2;

View file

@ -0,0 +1,4 @@
define structure
1 point,
2 x float,
2 y float;

View file

@ -0,0 +1,3 @@
type point = record
x, y: integer;
end;

View file

@ -0,0 +1 @@
my @point = 3, 8;

View file

@ -0,0 +1 @@
my %point = x => 3, y => 8;

View file

@ -0,0 +1,2 @@
class Point { has $.x is rw; has $.y is rw; }
my Point $point .= new(x => 3, y => 8);

View file

@ -0,0 +1,5 @@
uses objectclass;
define :class Point;
slot x = 0;
slot y = 0;
enddefine;

View file

@ -0,0 +1,4 @@
Structure MyPoint
X.i
Y.i
EndStructure

View file

@ -0,0 +1,7 @@
Structure MyFileDate
name.s
StructureUnion
Date_as_txt.s
Date_in_Ticks.l
EndStructureUnion
EndStructure

View file

@ -0,0 +1,5 @@
type mypoint
embed
integer x
integer y
end type

View 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

View 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

View file

@ -0,0 +1,4 @@
const type: Point is new struct
var integer: x is 0;
var integer: y is 0;
end struct;

View file

@ -0,0 +1,5 @@
datatype tree = Empty
| Leaf of int
| Node of tree * tree
val t1 = Node (Leaf 1, Node (Leaf 2, Leaf 3))

View file

@ -0,0 +1 @@
val p = (2,3)

View file

@ -0,0 +1 @@
val p = { x = 4, y = 5 }

View file

@ -0,0 +1 @@
point :: x y

View file

@ -0,0 +1 @@
p = point[x: 'foo',y: 'bar']

View file

@ -0,0 +1 @@
f = point$[x: g,y: h]

View file

@ -0,0 +1,2 @@
t = ~x p
u = ~y p

View file

@ -0,0 +1,3 @@
Structure Simple_Point
Public X, Y As Integer
End Structure

View file

@ -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

View 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>

View 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"). -->