def take
import bend-kit-runner@0.13.0.1/runner.bend as Runnerimport Base
import bend-kit-scheduler@0.4.1.0/queue.bend as Q
1333# The flight of ticket id, and the other flights.
1334def take(-A: Data, fs: List<&1, Flight<A>>, +id: Nat) -> Maybe<&1, Flight<A>> & List<&1, Flight<A>>:
1335 match fs:
1336 case Nil{}:
1337 (None{}, Nil{})
1338 case Con{Flight{Q.Ticket{+i, d, x}, g, b, k}, rest}:
1339 take.at(A, Nat.is_eq(i, id), Flight{Q.Ticket{i, d, x}, g, b, k}, take(A, rest, id))