learning F#, it seems pretty cool, favourite functional language so far.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Proverb.fs 647B

123456789101112131415161718
  1. module Proverb
  2. let finalLine (input: string list) = "And all for the want of a " + (List.head input) + "."
  3. let getLists (input: string list) = (List.take ((List.length input) - 1) input, List.tail input)
  4. let getItemPairs (input: string list) =
  5. let lists = getLists input
  6. let a = lists |> fst
  7. let b = lists |> snd
  8. List.zip a b
  9. let getLines (input: string list) = List.map (fun i ->
  10. let a = i |> fst
  11. let b = i |> snd
  12. "For want of a " + a + " the " + b + " was lost.") (getItemPairs input)
  13. let recite (input: string list): string list = if not (List.isEmpty input) then getLines input @ [finalLine input] else []