Advertisement
biswasrohit20

f3738

Jun 9th, 2021
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // 2a
  2.  
  3. let rec takeSomeDrinks n ls =
  4. match n with
  5. | 0 -> []
  6. | _ -> List.head ls :: takeSomeDrinks (n - 1) (List.tail ls)
  7.  
  8. printfn "%A" (takeSomeDrinks 3 ["Apple Juice"; "Americano"; "Cola"; "Orange juice"; "Cappucino"])
  9.  
  10.  
  11. // 2b
  12.  
  13. let a = [("Americano", 212.25); ("Cafe Latte", 213.00); ("Espresso", 211.75); ("Cappucino", 315.75)]
  14.  
  15.  
  16. for i = 0 to (a.Length-1) do
  17. printfn "%s" (fst(a.[i]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement