0
我真的不明白是怎麼回事。我有以下代碼:在corebuild下編譯時出現奇怪的錯誤
The expression has type 'a list -> `a list list but an expression was expected of type 'b list
是否有事可做:
let rec interleave n l =
match l with
[] -> [[n]]
| head::tail -> (n::l)::(List.map (~f:fun y -> head::y) (interleave n tail))
in let rec aux l =
match l with
[] -> [l]
| head::tail -> List.concat (List.map (interleave head) (aux tail))
當ocaml的它編譯和預期,但下corebuild它給了我下面的錯誤工作編譯再次標籤(正如你從~f:fun y -> ...
看到的那樣,它已經讓我感到厭煩了)?如果有,我應該使用哪種標籤以及在哪裏?
我認爲函數'〜f'只添加到「lambda」函數,但現在它是有道理的 – Gasim