如何合并 Lucene 索引文件?

How to merge Lucene index files?

我正在尝试在 ocaml 中制作成对列表,但问题是当列表的长度不同时,当其中一个元素不存在时,我不热衷于制作成对 (a,b) .

很可能你必须创建一个类型来封装不同长度的情况,

 type ('a,'b) combined = Both of 'a * 'b | Left of 'a | Right of 'b

 let rec zipwith xs ys = match xs,ys with
   | x::xs,y::ys -> Both (x,y) :: (zipwith xs ys)
   | x::xs, []   -> Left x     :: (zipwith xs ys)
   | [], y::ys   -> Right y    :: (zipwith xs ys)
   | [], []      -> []

 # zipwith [1;2;3] [1;2];;
 - : (int, int) combined list = [Both (1, 1); Both (2, 2); Left 3]

您必须针对尾调用进行优化才能使其在长列表上起作用,但这是解决问题的开始。