functional persistant data structure?
type StackType =
| Root
| Stack of string * StackType
let push stack item =
Stack(item, stack)
let peek stack =
match stack with
| Root -> None
| Stack (data, stack) -> Some data
let pop stack =
match stack with
| Root -> None
| Stack (data, stack) -> Some (data, stack)
Только не persistent.
Обсуждают сегодня