小编Cha*_*uuu的帖子

How to edit an Item in a mutable list in f# and allow the other items in the list retain their values?

I created a list in f# named tickets that contains 10 records called Ticket.The records are all initialized with their specific seat number and empty customer name.

type Ticket = {seat:int; customer:string}  
let mutable tickets = [for n in 1..10 -> {Ticket.seat = n; Ticket.customer = ""}]
Run Code Online (Sandbox Code Playgroud)

I want to write a function to book a specific seat in the list(add a customer name to the seat). How can i edit an item in the list and have other items …

f# list mutable

4
推荐指数
1
解决办法
2657
查看次数

标签 统计

f# ×1

list ×1

mutable ×1