Skip to content

Commit

Permalink
Document length functions - references #2
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Dec 10, 2013
1 parent d43dc31 commit 65f1c30
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion help/PersistentHashMap.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A Map is a collection that maps keys to values. Hash maps require keys that corr

open FSharpx.Collections.PersistentHashMap

// Create a new map and add some items to it
// Create a new HashMap and add some items to it
let m =
empty
|> add 42 "hello"
Expand All @@ -27,6 +27,11 @@ find 99 m
m.[99]
// [fsi:val it : string = "world"]

// Check no. of elements in the HashMap
length m
// [fsi:val it : int = 2]


(**
PersistentHashMaps are immutable and therefor allow to create new version without destruction of the old ones.
*)
Expand All @@ -43,6 +48,11 @@ find 104 m'

find 42 m
// [fsi:val it : string = "hello"]
length m
// [fsi:val it : int = 2]
length m'
// [fsi:val it : int = 3]


(** There a couple of interesting operations on HashMaps:
*)
Expand Down
12 changes: 11 additions & 1 deletion help/PersistentVector.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A Vector is a collection of values indexed by contiguous integers. Vectors suppo

open FSharpx.Collections.PersistentVector

// Create a new vector and add some items to it
// Create a new PersistentVector and add some items to it
let v =
empty
|> conj "hello"
Expand All @@ -29,6 +29,11 @@ nth 1 v
v.[2]
// [fsi:val it : string = "!"]

// Check no. of elements in the PersistentVector
length v
// [fsi:val it : int = 3]


(**
PersistentVectorss are immutable and therefor allow to create new version without destruction of the old ones.
*)
Expand All @@ -45,6 +50,11 @@ nth 3 v'

nth 0 v
// [fsi:val it : string = "hello"]
length v
// [fsi:val it : int = 3]
length v'
// [fsi:val it : int = 4]


(** There a couple of interesting operations on PersistentVectors:
*)
Expand Down

0 comments on commit 65f1c30

Please sign in to comment.