14 people like it.
Like the snippet!
Sorted Map
Sorted Map
1: module SortedMap = 2: 3: (* 4: // let avl = 5: // ['a'..'z'] |> List.fold (fun avl char -> 6: // AvlTree.insert char char avl 7: // ) AvlTree.empty 8: // 9: // avl |> AvlTree.min // 'z' 10: // avl |> AvlTree.max // 'a' 11: // avl |> AvlTree.exists 'b' // true 12: // avl |> AvlTree.find 'd' // Some 'd' 13: // avl |> AvlTree.size // 26 14: // avl |> AvlTree.value // 'p' (root node) 15: // 16: // let avl2 = avl |> AvlTree.delete 'd' // 17: // avl2 |> AvlTree.exists 'd' // false 18: // avl2 |> AvlTree.size // 25 19: *) 20: 21: open System.Collections 22: open System.Collections.Generic 23: 24: type Node<'k, 'v> when 'k : comparison 25: = Empty 26: | Node of 'k * 'v * int * int * Node<'k, 'v> * Node<'k, 'v> 27: with 28: interface IEnumerable<'v> with 29: member x.GetEnumerator() = 30: let rec inOrder (tree:Node<'k, 'v>) = 31: seq { 32: match tree with 33: | Empty -> yield! Seq.empty 34: | Node(_, v, _, _, l, r) -> 35: yield! inOrder l; yield v; yield! inOrder r 36: } 37: 38: (inOrder x).GetEnumerator() 39: 40: member x.GetEnumerator() = 41: (x :> IEnumerable<'v>).GetEnumerator() :> IEnumerator 42: 43: let empty = Empty 44: 45: let rec min = function 46: | Empty -> failwith "Empty tree" 47: | Node(_, v, _, _, Empty, _) -> v 48: | Node(_, _, _, _, l, _) -> min l 49: 50: let rec max = function 51: | Empty -> failwith "Empty tree" 52: | Node(_, v, _, _, _, Empty) -> v 53: | Node(_, _, _, _, _, r) -> max r 54: 55: let left = function 56: | Node(_, _, _, _, l, _) -> l 57: | Empty -> failwith "Can't get left child of empty node" 58: 59: let right = function 60: | Node(_, _, _, _, _, r) -> r 61: | Empty -> failwith "Can't get right child of empty node" 62: 63: let value = function 64: | Node(_, v, _, _, _, _) -> v 65: | Empty -> failwith "Can't get value of empty node" 66: 67: let size = function 68: | Empty -> 0 69: | Node(_, _, s, _, _, _) -> s 70: 71: let private sizeOf l r = 72: (size l) + (size r) + 1 73: 74: let height = function 75: | Empty -> 0 76: | Node(_, _, _, h, _, _) -> h 77: 78: let private heightOf l r = 79: (Microsoft.FSharp.Core.Operators.max (height l) (height r)) + 1 80: 81: let private rotateLeft root = 82: match root with 83: | Node(rk, rv, _, rh, rl, Node(pk, pv, _, ph, pl, pr)) -> 84: let root = Node(rk, rv, sizeOf rl pl, heightOf rl pl, rl, pl) 85: Node(pk, pv, sizeOf root pr, heightOf root pr, root, pr) 86: 87: | _ -> failwith "Can't rotate tree left" 88: 89: let private rotateRight root = 90: match root with 91: | Node(rk, rv, _, rh, Node(pk, pv, _, ph, pl, pr), rr) -> 92: let root = Node(rk, rv, sizeOf pr rr, heightOf pr rr, pr, rr) 93: Node(pk, pv, sizeOf root pl, heightOf root pl, pl, root) 94: 95: | _ -> failwith "Can't rotate tree right" 96: 97: let private balanceOf l r = 98: (height l) - (height r) 99: 100: let balance = function 101: | Empty -> 0 102: | Node(_, _, _, _, l, r) -> balanceOf l r 103: 104: let private rebalance k v l r = 105: let h = heightOf l r 106: let s = sizeOf l r 107: 108: match balanceOf l r with 109: | -2 -> 110: rotateLeft 111: (match balance r with 112: | 1 -> Node(k, v, s, h, l, rotateRight r) 113: | _ -> Node(k, v, s, h, l, r)) 114: 115: | 2 -> 116: rotateRight 117: (match balance l with 118: | -1 -> Node(k, v, s, h, rotateLeft l, r) 119: | _ -> Node(k, v, s, h, l, r)) 120: 121: | _ -> Node(k, v, s, h, l, r) 122: 123: let inOrderPrev (tree:Node<'k, 'v>) = 124: let rec prev prevVal tree = 125: match tree with 126: | Empty -> Empty 127: | Node(k, v, _, _, l, Empty) -> prevVal := Some(k, v); l 128: | Node(k, v, s, h, l, r) -> 129: let r = prev prevVal r 130: Node(k, v, sizeOf l r, h, l, r) 131: 132: let prevVal = ref None 133: 134: match tree with 135: | Empty -> Empty, !prevVal 136: | Node(_, _, _, _, l, _) -> prev prevVal l, !prevVal 137: 138: let inOrderNext (tree:Node<'k, 'v>) = 139: let rec next nextVal tree = 140: match tree with 141: | Empty -> Empty 142: | Node(k, v, _, _, Empty, r) -> nextVal := Some(k, v); r 143: | Node(k, v, s, h, l, r) -> 144: let l = next nextVal l 145: Node(k, v, sizeOf l r, h, l, r) 146: 147: let nextVal = ref None 148: 149: match tree with 150: | Empty -> Empty, !nextVal 151: | Node(_, _, _, _, _, r) -> next nextVal r, !nextVal 152: 153: let rec find key (tree:Node<'k, 'v>) = 154: match tree with 155: | Empty -> None 156: | Node(k, v, _, _, l, r) -> 157: if key < k 158: then find key l 159: elif key > k 160: then find key r 161: else Some v 162: 163: let rec exists key (tree:Node<'k, 'v>) = 164: tree |> find key |> Option.isSome 165: 166: let rec insert key value (tree:Node<'k, 'v>) = 167: match tree with 168: | Empty -> Node(key, value, 1, 1, Empty, Empty) 169: | Node(k, v, s, h, l, r) -> 170: if key < k 171: then rebalance k v (insert key value l) r 172: elif key > k 173: then rebalance k v l (insert key value r) 174: else Node(key, value, s, h, l, r) 175: 176: let rec delete key (tree:Node<'k, 'v>) = 177: match tree with 178: | Empty -> Empty 179: | Node(k, v, _, _, l, r) -> 180: if key < k 181: then rebalance k v (delete key l) r 182: elif key > k 183: then rebalance k v l (delete key r) 184: else 185: match inOrderPrev tree with 186: | _, None -> 187: match inOrderNext tree with 188: | _, None -> Empty 189: | r, Some(k, v) -> rebalance k v l r 190: | l, Some(k, v) -> rebalance k v l r 191: 192: let rec preOrder (tree:Node<'k, 'v>) = 193: seq { 194: match tree with 195: | Empty -> yield! Seq.empty 196: | Node(_, v, _, _, l, r) -> 197: yield v; yield! preOrder l; yield! preOrder r 198: } 199: 200: let rec postOrder (tree:Node<'k, 'v>) = 201: seq { 202: match tree with 203: | Empty -> yield! Seq.empty 204: | Node(_, v, _, _, l, r) -> 205: yield! postOrder l; yield! postOrder r; yield v 206: } 207: 208: let levelOrder (tree:Node<'k, 'v>) = 209: let queue = new Queue<Node<'k, 'v>>() 210: tree |> queue.Enqueue 211: 212: seq { 213: while queue.Count > 0 do 214: let node = queue.Dequeue() 215: yield node |> value 216: node |> left |> queue.Enqueue 217: node |> right |> queue.Enqueue 218: }
namespace System
namespace System.Collections
namespace System.Collections.Generic
Multiple items
union case Node.Node: 'k * 'v * int * int * Node<'k,'v> * Node<'k,'v> -> Node<'k,'v>
--------------------
type Node<'k,'v (requires comparison)> =
| Empty
| Node of 'k * 'v * int * int * Node<'k,'v> * Node<'k,'v>
with
interface IEnumerable<'v>
end
Full name: Snippet.SortedMap.Node<_,_>
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
union case Node.Node: 'k * 'v * int * int * Node<'k,'v> * Node<'k,'v> -> Node<'k,'v>
--------------------
type Node<'k,'v (requires comparison)> =
| Empty
| Node of 'k * 'v * int * int * Node<'k,'v> * Node<'k,'v>
with
interface IEnumerable<'v>
end
Full name: Snippet.SortedMap.Node<_,_>
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
union case Node.Empty: Node<'k,'v>
Multiple items
val int : 'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
type: int<'Measure>
implements: System.IComparable
implements: System.IConvertible
implements: System.IFormattable
implements: System.IComparable<int<'Measure>>
implements: System.IEquatable<int<'Measure>>
inherits: System.ValueType
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
val int : 'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
type: int<'Measure>
implements: System.IComparable
implements: System.IConvertible
implements: System.IFormattable
implements: System.IComparable<int<'Measure>>
implements: System.IEquatable<int<'Measure>>
inherits: System.ValueType
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
Multiple items
type IEnumerable<'T> =
interface
member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'T>
end
Full name: System.Collections.Generic.IEnumerable<_>
type: IEnumerable<'T>
inherits: IEnumerable
--------------------
type IEnumerable =
interface
member GetEnumerator : unit -> System.Collections.IEnumerator
end
Full name: System.Collections.IEnumerable
--------------------
IEnumerable
--------------------
IEnumerable
type IEnumerable<'T> =
interface
member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'T>
end
Full name: System.Collections.Generic.IEnumerable<_>
type: IEnumerable<'T>
inherits: IEnumerable
--------------------
type IEnumerable =
interface
member GetEnumerator : unit -> System.Collections.IEnumerator
end
Full name: System.Collections.IEnumerable
--------------------
IEnumerable
--------------------
IEnumerable
val x : Node<'k,'v> (requires comparison)
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
override Node.GetEnumerator : unit -> IEnumerator<'v>
Full name: Snippet.SortedMap.Node`2.GetEnumerator
Full name: Snippet.SortedMap.Node`2.GetEnumerator
val inOrder : (Node<'k,'v> -> seq<'v>) (requires comparison)
val tree : Node<'k,'v> (requires comparison)
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
Multiple items
val seq : seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Core.Operators.seq
--------------------
type seq<'T> = IEnumerable<'T>
Full name: Microsoft.FSharp.Collections.seq<_>
type: seq<'T>
inherits: IEnumerable
val seq : seq<'T> -> seq<'T>
Full name: Microsoft.FSharp.Core.Operators.seq
--------------------
type seq<'T> = IEnumerable<'T>
Full name: Microsoft.FSharp.Collections.seq<_>
type: seq<'T>
inherits: IEnumerable
module Seq
from Microsoft.FSharp.Collections
from Microsoft.FSharp.Collections
val empty<'T> : seq<'T>
Full name: Microsoft.FSharp.Collections.Seq.empty
Full name: Microsoft.FSharp.Collections.Seq.empty
val v : 'v
val l : Node<'k,'v> (requires comparison)
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
val r : Node<'k,'v> (requires comparison)
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
override Node.GetEnumerator : unit -> IEnumerator
Full name: Snippet.SortedMap.Node`2.GetEnumerator
Full name: Snippet.SortedMap.Node`2.GetEnumerator
Multiple items
type IEnumerator<'T> =
interface
member Current : 'T
end
Full name: System.Collections.Generic.IEnumerator<_>
type: IEnumerator<'T>
inherits: System.IDisposable
inherits: IEnumerator
--------------------
type IEnumerator =
interface
member Current : obj
member MoveNext : unit -> bool
member Reset : unit -> unit
end
Full name: System.Collections.IEnumerator
--------------------
IEnumerator
--------------------
IEnumerator
type IEnumerator<'T> =
interface
member Current : 'T
end
Full name: System.Collections.Generic.IEnumerator<_>
type: IEnumerator<'T>
inherits: System.IDisposable
inherits: IEnumerator
--------------------
type IEnumerator =
interface
member Current : obj
member MoveNext : unit -> bool
member Reset : unit -> unit
end
Full name: System.Collections.IEnumerator
--------------------
IEnumerator
--------------------
IEnumerator
val empty : Node<'a,'b> (requires comparison)
Full name: Snippet.SortedMap.empty
Full name: Snippet.SortedMap.empty
val min : Node<'a,'b> -> 'b (requires comparison)
Full name: Snippet.SortedMap.min
Full name: Snippet.SortedMap.min
val failwith : string -> 'T
Full name: Microsoft.FSharp.Core.Operators.failwith
Full name: Microsoft.FSharp.Core.Operators.failwith
val v : 'b
val l : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val max : Node<'a,'b> -> 'b (requires comparison)
Full name: Snippet.SortedMap.max
Full name: Snippet.SortedMap.max
val r : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val left : Node<'a,'b> -> Node<'a,'b> (requires comparison)
Full name: Snippet.SortedMap.left
Full name: Snippet.SortedMap.left
val right : Node<'a,'b> -> Node<'a,'b> (requires comparison)
Full name: Snippet.SortedMap.right
Full name: Snippet.SortedMap.right
val value : Node<'a,'b> -> 'b (requires comparison)
Full name: Snippet.SortedMap.value
Full name: Snippet.SortedMap.value
val size : Node<'a,'b> -> int (requires comparison)
Full name: Snippet.SortedMap.size
Full name: Snippet.SortedMap.size
val s : int
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
val private sizeOf : Node<'a,'b> -> Node<'c,'d> -> int (requires comparison and comparison)
Full name: Snippet.SortedMap.sizeOf
Full name: Snippet.SortedMap.sizeOf
val r : Node<'c,'d> (requires comparison)
type: Node<'c,'d>
implements: System.IEquatable<Node<'c,'d>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'c,'d>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'d>
implements: IEnumerable
type: Node<'c,'d>
implements: System.IEquatable<Node<'c,'d>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'c,'d>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'d>
implements: IEnumerable
val height : Node<'a,'b> -> int (requires comparison)
Full name: Snippet.SortedMap.height
Full name: Snippet.SortedMap.height
val h : int
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
val private heightOf : Node<'a,'b> -> Node<'c,'d> -> int (requires comparison and comparison)
Full name: Snippet.SortedMap.heightOf
Full name: Snippet.SortedMap.heightOf
namespace Microsoft
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Core
module Operators
from Microsoft.FSharp.Core
from Microsoft.FSharp.Core
val max : 'T -> 'T -> 'T (requires comparison)
Full name: Microsoft.FSharp.Core.Operators.max
Full name: Microsoft.FSharp.Core.Operators.max
val private rotateLeft : Node<'a,'b> -> Node<'a,'b> (requires comparison)
Full name: Snippet.SortedMap.rotateLeft
Full name: Snippet.SortedMap.rotateLeft
val root : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val rk : 'a (requires comparison)
val rv : 'b
val rh : int
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
val rl : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val pk : 'a (requires comparison)
val pv : 'b
val ph : int
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType
val pl : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val pr : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val private rotateRight : Node<'a,'b> -> Node<'a,'b> (requires comparison)
Full name: Snippet.SortedMap.rotateRight
Full name: Snippet.SortedMap.rotateRight
val rr : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
val private balanceOf : Node<'a,'b> -> Node<'c,'d> -> int (requires comparison and comparison)
Full name: Snippet.SortedMap.balanceOf
Full name: Snippet.SortedMap.balanceOf
val balance : Node<'a,'b> -> int (requires comparison)
Full name: Snippet.SortedMap.balance
Full name: Snippet.SortedMap.balance
val private rebalance : 'a -> 'b -> Node<'a,'b> -> Node<'a,'b> -> Node<'a,'b> (requires comparison)
Full name: Snippet.SortedMap.rebalance
Full name: Snippet.SortedMap.rebalance
val k : 'a (requires comparison)
val inOrderPrev : Node<'k,'v> -> Node<'k,'v> * ('k * 'v) option (requires comparison)
Full name: Snippet.SortedMap.inOrderPrev
Full name: Snippet.SortedMap.inOrderPrev
val prev : (('a * 'b) option ref -> Node<'a,'b> -> Node<'a,'b>) (requires comparison)
val prevVal : ('a * 'b) option ref (requires comparison)
type: ('a * 'b) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('a * 'b) option>>
implements: System.IComparable
implements: IStructuralComparable
type: ('a * 'b) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('a * 'b) option>>
implements: System.IComparable
implements: IStructuralComparable
val tree : Node<'a,'b> (requires comparison)
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
type: Node<'a,'b>
implements: System.IEquatable<Node<'a,'b>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'a,'b>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'b>
implements: IEnumerable
union case Option.Some: 'T -> Option<'T>
val prevVal : ('k * 'v) option ref (requires comparison)
type: ('k * 'v) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('k * 'v) option>>
implements: System.IComparable
implements: IStructuralComparable
type: ('k * 'v) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('k * 'v) option>>
implements: System.IComparable
implements: IStructuralComparable
Multiple items
val ref : 'T -> 'T ref
Full name: Microsoft.FSharp.Core.Operators.ref
--------------------
type 'T ref = Ref<'T>
Full name: Microsoft.FSharp.Core.ref<_>
type: 'T ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<'T>>
implements: System.IComparable
implements: IStructuralComparable
val ref : 'T -> 'T ref
Full name: Microsoft.FSharp.Core.Operators.ref
--------------------
type 'T ref = Ref<'T>
Full name: Microsoft.FSharp.Core.ref<_>
type: 'T ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<'T>>
implements: System.IComparable
implements: IStructuralComparable
union case Option.None: Option<'T>
val inOrderNext : Node<'k,'v> -> Node<'k,'v> * ('k * 'v) option (requires comparison)
Full name: Snippet.SortedMap.inOrderNext
Full name: Snippet.SortedMap.inOrderNext
val next : (('a * 'b) option ref -> Node<'a,'b> -> Node<'a,'b>) (requires comparison)
val nextVal : ('a * 'b) option ref (requires comparison)
type: ('a * 'b) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('a * 'b) option>>
implements: System.IComparable
implements: IStructuralComparable
type: ('a * 'b) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('a * 'b) option>>
implements: System.IComparable
implements: IStructuralComparable
val nextVal : ('k * 'v) option ref (requires comparison)
type: ('k * 'v) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('k * 'v) option>>
implements: System.IComparable
implements: IStructuralComparable
type: ('k * 'v) option ref
implements: IStructuralEquatable
implements: System.IComparable<Ref<('k * 'v) option>>
implements: System.IComparable
implements: IStructuralComparable
val find : 'k -> Node<'k,'v> -> 'v option (requires comparison)
Full name: Snippet.SortedMap.find
Full name: Snippet.SortedMap.find
val key : 'k (requires comparison)
val k : 'k (requires comparison)
val exists : 'k -> Node<'k,'v> -> bool (requires comparison)
Full name: Snippet.SortedMap.exists
Full name: Snippet.SortedMap.exists
module Option
from Microsoft.FSharp.Core
from Microsoft.FSharp.Core
val isSome : 'T option -> bool
Full name: Microsoft.FSharp.Core.Option.isSome
Full name: Microsoft.FSharp.Core.Option.isSome
val insert : 'k -> 'v -> Node<'k,'v> -> Node<'k,'v> (requires comparison)
Full name: Snippet.SortedMap.insert
Full name: Snippet.SortedMap.insert
val value : 'v
val delete : 'k -> Node<'k,'v> -> Node<'k,'v> (requires comparison)
Full name: Snippet.SortedMap.delete
Full name: Snippet.SortedMap.delete
val preOrder : Node<'k,'v> -> seq<'v> (requires comparison)
Full name: Snippet.SortedMap.preOrder
Full name: Snippet.SortedMap.preOrder
val postOrder : Node<'k,'v> -> seq<'v> (requires comparison)
Full name: Snippet.SortedMap.postOrder
Full name: Snippet.SortedMap.postOrder
val levelOrder : Node<'k,'v> -> seq<'v> (requires comparison)
Full name: Snippet.SortedMap.levelOrder
Full name: Snippet.SortedMap.levelOrder
val queue : Queue<Node<'k,'v>> (requires comparison)
type: Queue<Node<'k,'v>>
implements: seq<Node<'k,'v>>
implements: ICollection
implements: IEnumerable
type: Queue<Node<'k,'v>>
implements: seq<Node<'k,'v>>
implements: ICollection
implements: IEnumerable
Multiple items
type Queue<'T> =
class
new : unit -> System.Collections.Generic.Queue<'T>
new : int -> System.Collections.Generic.Queue<'T>
new : System.Collections.Generic.IEnumerable<'T> -> System.Collections.Generic.Queue<'T>
member Clear : unit -> unit
member Contains : 'T -> bool
member CopyTo : 'T [] * int -> unit
member Count : int
member Dequeue : unit -> 'T
member Enqueue : 'T -> unit
member GetEnumerator : unit -> Enumerator<'T>
member Peek : unit -> 'T
member ToArray : unit -> 'T []
member TrimExcess : unit -> unit
type Enumerator =
struct
member Current : 'T
member Dispose : unit -> unit
member MoveNext : unit -> bool
end
end
Full name: System.Collections.Generic.Queue<_>
type: Queue<'T>
implements: seq<'T>
implements: ICollection
implements: IEnumerable
--------------------
type Queue =
class
new : unit -> System.Collections.Queue
new : int -> System.Collections.Queue
new : int * float32 -> System.Collections.Queue
new : System.Collections.ICollection -> System.Collections.Queue
member Clear : unit -> unit
member Clone : unit -> obj
member Contains : obj -> bool
member CopyTo : System.Array * int -> unit
member Count : int
member Dequeue : unit -> obj
member Enqueue : obj -> unit
member GetEnumerator : unit -> System.Collections.IEnumerator
member IsSynchronized : bool
member Peek : unit -> obj
member SyncRoot : obj
member ToArray : unit -> obj []
member TrimToSize : unit -> unit
static member Synchronized : System.Collections.Queue -> System.Collections.Queue
end
Full name: System.Collections.Queue
type: Queue
implements: ICollection
implements: IEnumerable
implements: System.ICloneable
type Queue<'T> =
class
new : unit -> System.Collections.Generic.Queue<'T>
new : int -> System.Collections.Generic.Queue<'T>
new : System.Collections.Generic.IEnumerable<'T> -> System.Collections.Generic.Queue<'T>
member Clear : unit -> unit
member Contains : 'T -> bool
member CopyTo : 'T [] * int -> unit
member Count : int
member Dequeue : unit -> 'T
member Enqueue : 'T -> unit
member GetEnumerator : unit -> Enumerator<'T>
member Peek : unit -> 'T
member ToArray : unit -> 'T []
member TrimExcess : unit -> unit
type Enumerator =
struct
member Current : 'T
member Dispose : unit -> unit
member MoveNext : unit -> bool
end
end
Full name: System.Collections.Generic.Queue<_>
type: Queue<'T>
implements: seq<'T>
implements: ICollection
implements: IEnumerable
--------------------
type Queue =
class
new : unit -> System.Collections.Queue
new : int -> System.Collections.Queue
new : int * float32 -> System.Collections.Queue
new : System.Collections.ICollection -> System.Collections.Queue
member Clear : unit -> unit
member Clone : unit -> obj
member Contains : obj -> bool
member CopyTo : System.Array * int -> unit
member Count : int
member Dequeue : unit -> obj
member Enqueue : obj -> unit
member GetEnumerator : unit -> System.Collections.IEnumerator
member IsSynchronized : bool
member Peek : unit -> obj
member SyncRoot : obj
member ToArray : unit -> obj []
member TrimToSize : unit -> unit
static member Synchronized : System.Collections.Queue -> System.Collections.Queue
end
Full name: System.Collections.Queue
type: Queue
implements: ICollection
implements: IEnumerable
implements: System.ICloneable
Queue.Enqueue(item: Node<'k,'v>) : unit
property Queue.Count: int
val node : Node<'k,'v> (requires comparison)
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
type: Node<'k,'v>
implements: System.IEquatable<Node<'k,'v>>
implements: IStructuralEquatable
implements: System.IComparable<Node<'k,'v>>
implements: System.IComparable
implements: IStructuralComparable
implements: IEnumerable<'v>
implements: IEnumerable
Queue.Dequeue() : Node<'k,'v>
More information
| Link: | http://fssnip.net/2i |
| Posted: | 2 years ago |
| Author: | fholm |
| Tags: | map, sorted |