Warning: session_start(): open(/var/lib/php/sessions/sess_k8e3g0c6fg06d2cvsvk0l2nvs1, 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
!752
answer {
if "how many elements are in the list *" {
L list = cast safeUnstructure(m.unq(0));
ret str(l(list));
}
if "what is the * element in the list *" {
S x = m.unq(0).toLowerCase();
L list = cast safeUnstructure(m.unq(1));
if (eq(x, "first"))
ret structure(first(list));
if (eq(x, "last"))
ret structure(last(list));
// "1st", "2nd" etc
int i = 0;
while (i < l(x) && isDigit(x.charAt(i)))
++i;
if (i > 0)
ret structure(get(list, parseInt(x.substring(0, i))-1));
}
// It should match if you write: "what is the 1st element..."
// cause the tokenizer works like that...
if (match("what is the * st element in the list *", s, m)
|| match("what is the * nd element in the list *", s, m)
|| match("what is the * rd element in the list *", s, m)
|| match("what is the * th element in the list *", s, m)) {
L list = cast safeUnstructure(m.unq(1));
ret structure(get(list, parseInt(m.unq(0))-1));
}
}