Skip to content

Commit aa47313

Browse files
author
Hongbo Zhang
committed
update docs
1 parent 98bc626 commit aa47313

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/Curry-and-Uncurry-functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To apply a function, you can do this
1717

1818
```ocaml
1919
f 3 "x"
20-
f_uncurry #@ (3,"x")
20+
f_uncurry (3,"x") [@uncurry]
2121
```
2222
For uncurried function applicaton, BuckleScript is guaranteed to
2323
compile it in the same way as JS code
@@ -42,7 +42,7 @@ Both are correct code, but the second one is more efficient.
4242

4343
```ocaml
4444
let f = fun a b -> a + string_of_int b
45-
let f_uncurry = fun %uncurry a b -> a + string_of_int b
45+
let f_uncurry = fun [@uncurry] (a, b) -> a + string_of_int b
4646
```
4747

4848
- When is uncurried function recommended

docs/OCaml-call-JS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ On top of this we can write normal OCaml functions, for example:
220220
```OCaml
221221
let assert_equal = eq
222222
let from_suites name suite =
223-
describe name (fun%uncurry () ->
223+
describe name (fun [@uncurry] () ->
224224
List.iter (fun (name, code) -> it name code) suite)
225225
```
226226

@@ -271,8 +271,8 @@ val f : < hi : ('a * 'b -> 'c [@uncurry] ; .. > Js.t -> 'a -> 'b -> 'c
271271
This attribute helps create JavaScript object literal
272272

273273
```ocaml
274-
let a = f ({ hi = fun %uncurry (x,y) -> x + y}[@bs.obj]) 1 2
275-
let b = f ({ hi = fun %uncurry (x,y) -> x +. y}[@bs.obj]) 1. 2.
274+
let a = f ({ hi = fun [@uncurry] (x,y) -> x + y}[@bs.obj]) 1 2
275+
let b = f ({ hi = fun [@uncurry] (x,y) -> x +. y}[@bs.obj]) 1. 2.
276276
```
277277

278278
Generated code is like below

0 commit comments

Comments
 (0)