0
以下のF#コードで、firstElemが値を取得する方法は?私はこのlinkの下のコードを得ました。このF#コードで、firstElemはどのように値を取得していますか?
let rec quicksort list =
match list with
| [] -> // If the list is empty
[] // return an empty list
| firstElem::otherElements -> // If the list is not empty
let smallerElements = // extract the smaller ones
otherElements
|> List.filter (fun e -> e < firstElem)
|> quicksort // and sort them
let largerElements = // extract the large ones
otherElements
|> List.filter (fun e -> e >= firstElem)
|> quicksort // and sort them
// Combine the 3 parts into a new list and return it
List.concat [smallerElements; [firstElem]; largerElements]
答えに感謝します!私は機能的でf#プログラミングに新しいです。あなたが話している "パラメータの頭"とは何ですか?あなたは私にそれのためのドキュメンテーションのリンクを与えることができますか? – user3587180
私はここではっきりしていませんでした。時々あなたはリストが頭と尾であると言います。ヘッドは最初の要素で、テールは残りの要素のすべてです。私は答えに数行を追加します。 –