"Be more lazy in get_siblings"

Reviewed By: jvillard

Differential Revision: D8732963

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

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

Loading…
Cancel
Save