spacepaste

code.ml

  1.  
  2. let foldf1 =
  3. let foldf data accum = accum + data in
  4. 0, foldf
  5. let foldf2 =
  6. let foldf data accum = data :: accum in
  7. [], foldf
  8. let () =
  9. let foldpairs = [foldf1; foldf2] in
  10. let values, foldfs = List.split foldpairs in
  11. let results = List.fold_left
  12. (fun accum data ->
  13. List.map2
  14. (fun f a -> f data a)
  15. foldfs
  16. accum)
  17. values
  18. [1; 2; 3; 4]
  19. in ()
  20.  

error.txt

  1.  
  2. File "pplacer_src/polymorphism_test.ml", line 10, characters 27-33:
  3. Error: This expression has type 'a list * ('b -> 'b list -> 'b list)
  4. but an expression was expected of type int * (int -> int -> int)
  5.