-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
featurea feature to be implementeda feature to be implemented
Description
Similar to List.partition, adaptively.
A quick and dirt would be :
module AList =
let partition<'a> (p: 'a -> bool) (l : clist<'a>) =
let (left,right) = (clist<'a>[],clist<'a>[])
let addRow (row: 'a) =
match p row with
| true -> transact (fun () -> left.Add row)
| false -> transact (fun () -> right.Add row)
|> ignore
let removeRow (o: IndexList<'a>) (i : Index) =
match p o.[i] with
| true -> transact (fun () -> left.Remove i)
| false -> transact (fun () -> right.Remove i)
|> ignore
let processDelta o (i : Index, e : ElementOperation<'a>) =
match e with
| Remove -> removeRow o i
| Set(s) -> addRow s
|> ignore
l.AddCallback (fun o c -> c.ToList()
|> List.iter (processDelta o))
|> ignore
(left,right)Metadata
Metadata
Assignees
Labels
featurea feature to be implementeda feature to be implemented