"Be more lazy in get_siblings"

Reviewed By: jvillard

Differential Revision: D8732963

fbshipit-source-id: 0899a6d
master
Ezgi Çiçek 7 years ago committed by Facebook Github Bot
parent 36f8d8f869
commit 129cadb9b6

@ -101,9 +101,10 @@ module Node = struct
(** Get siblings *) (** Get siblings *)
let get_siblings node = let get_siblings node =
get_preds node get_preds node
|> List.fold_left ~init:Sequence.empty ~f:(fun acc parent -> |> ISequence.gen_sequence_list ~f:(fun parent ->
let siblings = get_succs parent |> List.filter ~f:(fun n -> not (equal node n)) in get_succs parent |> Sequence.of_list |> Sequence.filter ~f:(fun n -> not (equal node n))
Sequence.append (Sequence.of_list siblings) acc ) |> Sequence.Generator.of_sequence )
|> Sequence.Generator.run
(** Get the node kind *) (** Get the node kind *)

Loading…
Cancel
Save