dequeue_towards: always return active tasks;
join_work: imitate worker more closely, keep active if queue appears to be blocked for the moment -- it may become free again after some worker_finished event;
theory ToyList
imports Datatype
begin
datatype 'a list = Nil                          ("[]")
                 | Cons 'a "'a list"            (infixr "#" 65)
primrec app :: "'a list => 'a list => 'a list"  (infixr "@" 65)
where
"[] @ ys       = ys" |
"(x # xs) @ ys = x # (xs @ ys)"
primrec rev :: "'a list => 'a list" where
"rev []        = []" |
"rev (x # xs)  = (rev xs) @ (x # [])"