fun remove(item, list) {
if list == [] then []
else if hd(list) == item then tl(list)
else [hd(list)] :: remove(item, tl(list))
}
fun todo(items) {
<html>
<body>
<h1>Items to do</h1>
<form l:action="{todo( [next] :: items)}" method="POST">
<input l:name="next" type="text" size="40"/>
<input type="submit" value="add new item"/>
</form>
<table>{
for item <- items xin
<tr><td>{item}</td>
<td><form l:action="{todo(remove(item, items))}" method="POST">
<input type="submit" value="done"/>
</form>
</td>
</tr>
}</table>
</body>
</html>
}
todo([])