Ocaml:乘法表达式(*)int int-> int

时间:2018-11-10 16:20:13

标签: expression ocaml

为什么Ocaml不支持development: some_username: XXXXXXXXX some_password: YYYYYYYYY test: some_username: XXXXXXXXX some_password: YYYYYYYYY production: some_username: XXXXXXXXX some_password: YYYYYYYYY secret_key_base: ZZZZZZZZZ # `secret_key_base:` must NOT be indented ! # It must be put at the very start of a new line. # There is also no need for it in development or test environment, # since there are no attacks to be expected. 的{​​{1}}表达式操作?

(即//Define line chart with and height const width = fullWidth - margin.left - margin.right; const height = fullHeight - margin.top - margin.bottom; //Define x and y scale range let xScale = d3.scaleLinear() .range([0, width]) let yScale = d3.scaleLinear() .range([0, height]) //Define x and y axis let xAxis = d3.axisBottom(xScale) .ticks(15) let yAxis = d3.axisLeft(yScale) .ticks(10) //Draw svg let svg = d3.select("body") .append("svg") .attr("width", fullWidth) .attr("height", fullHeight) .append("g") .attr("transform", "translate(" + 53 + "," + 0 +")"); d3.json("https://api.myjson.com/bins/izmg6").then(data => { console.log(data); //Structure data so should be an array of arrays etc [[x,y], [x,y], [x,y]] let years = d3.keys(data[0]).slice(0, 50); console.log(years); let dataset = []; data.forEach((d, i) => { let myEmissions = []; years.forEach(y => { if (d[y]) { myEmissions.push({ country: d.countryName, year: y, amount: d[y] }) } }) dataset.push({ country: d.countryName, emissions: myEmissions }); }) console.log(dataset); //Define x and y domain xScale .domain(d3.extent(years, d =>d)) yScale .domain([d3.max(dataset, d => d3.max(d.emissions, d => +d.amount)), 0]) //Generate line let line = d3.line() .curve(d3.curveBasis) .x(d => xScale(d.year)) .y(d => yScale(d.amount)); let groups = svg.selectAll("g") .data(dataset) .enter() .append("g") groups.append("title") .text(d => d.country) groups.selectAll("path") .data(d => [d.emissions]) .enter() .append("path").classed("line", true) .attr("d", line) .style("stroke-width", d => d.country === "China" ? 10 : 0.5 ) }).catch(error => console.log(error)) # (*) int int -> int

2 个答案:

答案 0 :(得分:0)

因为(*是OCaml语法中注释的开始:

(* hello, I'm a comment *)

解决方法是添加空格:

( * ) 9 9

*运算符。

答案 1 :(得分:0)

它支持,您只需要在字符之间添加一个空格即可使解析器将其与注释区分开:( * )