typeNestedType<'a>=ListofNestedType<'a>list | Eof'aletflattenls=letrecstarttempinput=matchinputwith
| Ee->e::temp
| Listes->List.foldBack(funxacc->startaccx) estempstart [] ls// test (a (b (c d) e)))
(List [E"a"; List [E"b" ; List [E"c"; E"d"]; E"e"]]) |>flatten= ["a";"b";"c";"d";"e";]
Multiple items union case NestedType.List: NestedType<'a> list -> NestedType<'a>
-------------------- module List
from Microsoft.FSharp.Collections
-------------------- type List<'T> = | ( [] ) | ( :: ) of Head: 'T * Tail: 'T list interface IEnumerable interface IEnumerable<'T> member Head : 'T member IsEmpty : bool member Item : index:int -> 'T with get member Length : int member Tail : 'T list static member Cons : head:'T * tail:'T list -> 'T list static member Empty : 'T list
Full name: Microsoft.FSharp.Collections.List<_>
type NestedType<'a> = | List of NestedType<'a> list | E of 'a
Full name: Script.NestedType<_>
type 'T list = List<'T>
Full name: Microsoft.FSharp.Collections.list<_>
union case NestedType.E: 'a -> NestedType<'a>
val flatten : ls:NestedType<'a> -> 'a list
Full name: Script.flatten
val ls : NestedType<'a>
val start : ('b list -> NestedType<'b> -> 'b list)
val temp : 'b list
val input : NestedType<'b>
val e : 'b
val es : NestedType<'b> list
val foldBack : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State
Full name: Microsoft.FSharp.Collections.List.foldBack