Singly-linked list/Element definition: Difference between revisions

m
Line 1,371:
<lang stata>transmorphic scalar list_pop(struct list scalar a) {
transmorphic scalar x
if (a.head !== NULL) {
_error("empty list")
x = (*a.head).value
if (a.head == a.tail) {
a.head = a.tail = NULL
} else {
a.head = (*a.head).next
}
return(x)
}
x = (*a.head).value
if (a.head == a.tail) {
a.head = a.tail = NULL
} else {
a.head = (*a.head).next
}
return(x)
}</lang>
 
1,336

edits