Warning: session_start(): open(/var/lib/php/sessions/sess_adl0gu2u8jmj4tu55sq4fhmua7, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
sclass Expectation {
}
sclass Word {
S text; // or null if unknown
Word prev, next;
new Set expectations;
}
p-exp {
S sentence = "In the movies Dracula always wears a cape";
L rawWords = printStruct(words(sentence));
new L words;
for (S w : rawWords)
words.add(nu(eqic(w, "the") ? The : Word, text := w));
for (int i = 0; i < l(words)-1; i++)
linkWords(words.get(i), words.get(i+1));
printStruct(first(words));
}
svoid linkWords(Word a, Word b) {
a.next = b;
b.prev = a;
}