learning F#, it seems pretty cool, favourite functional language so far.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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