learning F#, it seems pretty cool, favourite functional language so far.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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 []