[過去ログ]
Rust part21 (1002レス)
Rust part21 http://mevius.5ch.net/test/read.cgi/tech/1692105879/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
438: デフォルトの名無しさん [sage] 2023/10/07(土) 16:42:12.14 ID:2ow1Jojj ocamlだとこんな感じかな? let rec qsort = function | [] -> [] | pivot :: tail -> let smaller, rest = List.partition ((>) pivot) tail in qsort smaller @ pivot :: qsort rest >>424 scala比較のためそのままコピペ def qsort(list: List[Int]): List[Int] = list match case Nil => Nil case pivot :: tail => val (smaller, rest) = tail.partition(_ < pivot) qsort(smaller) ::: pivot :: qsort(rest) scalaすごい頑張ってると思うわ http://mevius.5ch.net/test/read.cgi/tech/1692105879/438
442: デフォルトの名無しさん [sage] 2023/10/08(日) 09:57:45.64 ID:ShBUnVvx 同等というより>>438と>>430は全く同じだな 空でなければpartitionでsmallerとrestに分けて それぞれを再帰でqsortしてconcatenate http://mevius.5ch.net/test/read.cgi/tech/1692105879/442
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
1.522s*