Collapse the table of content
Expand the table of content
Expand Minimize

List.append<'T> Function (F#)

Returns a new list that contains the elements of the first list followed by elements of the second.

Namespace/Module Path: Microsoft.FSharp.Collections.List

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
List.append : 'T list -> 'T list -> 'T list

// Usage:
List.append list1 list2

list1

Type: 'T list

The first input list.

list2

Type: 'T list

The second input list.

The resulting list.

This function is named Append in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.

The following code example illustrates the use of List.append to join two lists together. Use List.concat to join more than two lists.


let list1to10 = List.append [1; 2; 3] [4; 5; 6; 7; 8; 9; 10]
let listResult = List.concat [ [1; 2; 3]; [4; 5; 6]; [7; 8; 9] ]
List.iter (fun elem -> printf "%d " elem) list1to10
printfn ""
List.iter (fun elem -> printf "%d " elem) listResult


Output

1 2 3 4 5 6 7 8 9 10 
1 2 3 4 5 6 7 8 9

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft