List.permute<'T> 関数 (F#)

指定された置換に従ってすべての要素を置換したリストを返します。

名前空間/モジュール パス: Microsoft.FSharp.Collections.List

アセンブリ: FSharp.Core (FSharp.Core.dll 内)

// Signature:
List.permute : (int -> int) -> 'T list -> 'T list

// Usage:
List.permute indexMap list

パラメーター

  • indexMap
    型: int ->int

    入力インデックスを出力インデックスにマップする関数。

  • list
    型: 'Tlist

    入力リスト。

戻り値

置換されたリスト。

解説

この関数は、コンパイルされたアセンブリでは Permute という名前です。F# 以外の言語から、またはリフレクションを使用してこの関数にアクセスする場合は、この名前を使用します。

使用例

List.permute の使用方法を次のコード例に示します。

let printPermutation n list1 =
    let length = List.length list1
    if (n > 0 && n < length) then
        List.permute (fun index -> (index + n) % length) list1
    else
        list1
    |> printfn "%A"
let list1 = [ 1 .. 5 ]
// There are 5 valid permutations of list1, with n from 0 to 4.
for n in 0 .. 4 do
    printPermutation n list1

出力

  

プラットフォーム

Windows 8、Windows 7、Windows Server 2012 で Windows Server 2008 R2

バージョン情報

F# コア ライブラリのバージョン

サポート: ポータブル 2.0、4.0

参照

関連項目

Collections.List モジュール (F#)

Microsoft.FSharp.Collections 名前空間 (F#)