Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confused with F# List.nth's argument order

Tags:

f#

List.nth is 'T list -> int -> 'T, rather than the standard int -> 'T list -> 'T like Seq.nth.

This makes pipeline somewhat awkward.

Is there something behind the scene?

I don't know why.

like image 702
kev Avatar asked Jun 03 '10 19:06

kev


People also ask

What is a fancy word for confused?

adj.disoriented mentally. adj.mixed up, disordered.

What is the word for angry and confused?

vexation. noun. formal the feeling of being annoyed, confused, or worried.

How do you describe someone who is confused?

You can have the character scratch their head. Give them a dazed look of bewilderment. Have them shrug their shoulders with their hands up. Have them put their hand on their chin like they are thinking.


2 Answers

Might be for ocaml compatibility (or just laziness), but without deeper reasons concerning the implementation itself.

like image 119
Dario Avatar answered Oct 05 '22 08:10

Dario


This signature allows you to curry the function with respect to a given list. This allows you to keep a List.nth someList stored, and use it to get the nth element of the list without having to specify the list variable every time.

I'm not sure why it's nonuniform with respect to other F# functions, though.

like image 23
Jordan Lewis Avatar answered Oct 05 '22 07:10

Jordan Lewis