Fable: List.nth

Created on 18 Aug 2017  路  6Comments  路  Source: fable-compiler/Fable

Description

List.nth cannot be parsed.

Repro code

["a";"b";"c"] |> List.nth 1

Expected and actual results

nth element, "b"

Related information

  • Fable version (dotnet fable --version): 1.1.7
  • Operating system: Windows 10
bug

Most helpful comment

Apologies, I must have misted that.

All 6 comments

According to MSDN doc you should use:

List.nth ["a";"b";"c"] 1

But indeed it's return null instead of b

Also, this construction is deprecated according to compiler warning.

This construct is deprecated. please use List.item

So you should used something like:

["a";"b";"c"] 
|> List.item 1

@alfonsogarciacaro Should Fable support List.nth even if deprecated ?

The method is deprecated, it doesn't appear in the autocompletion and the signature is confusing (the list is the first argument unlike most of the other List functions) so I too recommend using List.item instead as @MangelMaxime suggests :+1:

Ok, could something be added to the fable output to tell users that List.item should be used?

There should be already the warning from the F# compiler.

screen shot 2017-08-21 at 8 19 34 am

Apologies, I must have misted that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dbrattli picture dbrattli  路  54Comments

alfonsogarciacaro picture alfonsogarciacaro  路  30Comments

sandeepc24 picture sandeepc24  路  46Comments

ncave picture ncave  路  35Comments

alfonsogarciacaro picture alfonsogarciacaro  路  37Comments