Given an acyclic graph of nodes, where a node has a method C<kids>,
returning a list of all the nodes it points to, is it the case that
the following code:
sub descent($src, $dst) {
when $src == $dst { return $dst }
when !$src.kids { die }
otherwise {
return ( $src, descent(any($src.kids), $dst))
}
}
will return a list of nodes making up a path between the nodes $src
and $dest? Or do I need to replace C<any> and C<die> with an
appropriate implementation of C<choose> and C<fail>?
It'd be really cool if superpositions had this kind of backtracking
behaviour, but I'm *so* not going to be surprised if it doesn't...
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?