A list is a kind of thing.
A node is a kind of thing.
Data is a kind of thing.
Every node has some data called the information.
Every node has a node called the next node.
A list has a node called the start.
Oder bildhafter:
A caravan is a kind of thing.
A camel is a kind of thing.
A piece of baggage is a kind of thing.
Every camel has some piece of baggage called the load.
Every camel has a camel called the next camel.
Every caravan has a camel called the first camel.
Vermutlich muss man das gleich nach dem Kompositum-Muster aufbauen, denn ein Attributwert darf beim Initialisieren eines Objekts nie null/nothing sein. Also gleich richtig:
A piece of baggage is a kind of thing. [Oberklasse/Interface Datenelement] A caravan member is a kind of animal. [Interface/Oberklasse Listenelement] A caravan member has a caravan member called the successor. [Nachfolger-Attribut] A camel is a kind of caravan member. [Klasse Knoten] A camel has a piece of baggage called the load. [Attribut Datenelement] A donkey is a kind of caravan member. [Klasse Abschluss] A caravan organizer is a kind of man. [Klasse Liste] A caravan organizer has a caravan member called the leader. [Anfangs-Attribut] [Jetzt die Objekte anlegen:] Sinbad is a caravan organizer. The leader of Sinbad is Camel 1. Camel 1 is a camel. The ruby is a kind of baggage. The load of Camel 1 is the ruby. The successor of Camel 1 is Camel 2. Camel 2 is a camel. The emerald is a kind of baggage. The load of Camel 2 is the emerald. The successor of Camel 2 is Eyeore. Eyeore is a donkey.
Ich schlage übrigens überhaupt nicht vor, dass man Listen tatsächlich mit Inform 7 programmieren sollte. Auf diesem Niveau sind herkömmliche Programmiersprachen sinnvoller. Aber wenn andere Leute Pacman oder Tischfußball mit Inform schreiben, dann darf ich das doch auch mit Listen machen.
Es fehlen bei der Liste aber noch die entsprechenden Methoden: suchen, einfügen, löschen, sortieren, ausgeben. Die kann man tatsächlich alle programmieren – aber nur umständlich.
Zum einen kann Inform erst einmal keine Objekte zur Laufzeit erzeugen. Alle irgendwann benötigten Objekte müssen vor Beginn des Spiels vorliegen – natürlich kann das außerhalb des Spielfelds sein. Mit der Erweiterung Dynamic Objects lässt sich allerdings auch das umgehen. Die Konstruktoren muss man sich allerdings selber und auf etwas umständliche Weise schreiben.
Zweitens geht Inform mit null/nil/nothing etwas anders um als andere Sprachen, das erfordert mehr Vorsicht, als man Schülern zumuten muss.
[Vorne einfuegen] To put (stuff - a piece of baggage) in the front of (the boss - a caravan organizer): let the newcomer be a new camel; now the load of the newcomer is the stuff; now the successor of the newcomer is the leader of the boss; now the leader of the boss is the newcomer. [Laenge geben] To decide what number is the (boss - a caravan organizer) length: decide on the remaining length from the leader of the boss. To decide what number is the remaining length from (the carrier - a camel): let x be the remaining length from the successor of the carrier ; decide on x plus one. To decide what number is the remaining length from (the end - a donkey): decide on 0.