Deciphering Type Explanations in F# -


i see notation following in book reading:

int -> int -> int * int

apparently type of something.

is there guide anywhere explain how read that? it's ints , arrows me.

a function definition in f# has following grammar

[parameter] -> [return type] 

lets use grammar break down definition pieces

int -> int -> int * int 

in case parameter type int , return type int -> int * int. still strange type lets analyze it

int -> int * int 

this function takes int , returns int * int. * notation used indicate tuple. in case tuple 2 members, both types being int.

so in summary function takes int parameter , returns function takes int parameter , returns 2 member tuple of int values


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -