What is 'Currying'?

前端 未结 18 1586
遥遥无期
遥遥无期 2020-11-21 05:26

I\'ve seen references to curried functions in several articles and blogs but I can\'t find a good explanation (or at least one that makes sense!)

18条回答
  •  不要未来只要你来
    2020-11-21 06:28

    There is an example of "Currying in ReasonML".

    let run = () => {
        Js.log("Curryed function: ");
        let sum = (x, y) => x + y;
        Printf.printf("sum(2, 3) : %d\n", sum(2, 3));
        let per2 = sum(2);
        Printf.printf("per2(3) : %d\n", per2(3));
      };
    

提交回复
热议问题