toosweettobereal

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
std.list.node(data, next) type;
std.list.list(count, head, tail) type;
std.list()
{
init()
return new std.list.list(0, null, null);
add(list, data)
{
node = new std.list.node(data, null);
if ( list.head == null )
list.head = node;
else
list.tail.next = node;
list.tail = node;
list.count++;
return node;
}
dump(list)
{
current = list.head;
while ( current )
{
testsuite.say ( current.data );
current = current.next;
}
}
}
main(arg) agent
{
list = std.list.init();
std.list.add(list, "hello");
std.list.add(list, "world");
std.list.add(list, " 2 ");
std.list.add(list, "you");
std.list.dump(list);
}