JCLL
JCLL

Reputation: 5545

What is the meaning of parameters starting with tilde ~ in functions?

What is the meaning of parameters starting with tilde ~ in functions, like in the this example:

let draw_line ~img ~color ~p0:(x0,y0) ~p1:(x1,y1) = ...

Upvotes: 1

Views: 72

Answers (1)

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66818

They are named parameters where the label is the same as the formal parameter name:

# let divide ~num ~den = num /. den;;
val divide : num:float -> den:float -> float = <fun>
# divide ~den:10.0 ~num:30.0;;
- : float = 3.

This is described under function definition here.

Upvotes: 1

Related Questions