1 people like it.
Like the snippet!
hof.fsx
Higher order function
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
|
let myUser func =
func "domain\\myUser"
let upload user file =
printf "%s uploaded the file %s" user file
let files = ["lorem.docx"; "ipsum.pdf"; "dolor.xls"; "amet.pptx"]
let bulkupload user (fileCollection : List<string>) =
for file in fileCollection do
upload user file
let firstFileIn (list:List<string>) =
list.Head
myUser upload (firstFileIn files)
myUser bulkupload files
|
val myUser : func:(string -> 'a) -> 'a
Full name: Script.myUser
val func : (string -> 'a)
val upload : user:string -> file:string -> unit
Full name: Script.upload
val user : string
val file : string
val printf : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printf
val files : string list
Full name: Script.files
val bulkupload : user:string -> fileCollection:List<string> -> unit
Full name: Script.bulkupload
val fileCollection : List<string>
Multiple items
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<_>
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = System.String
Full name: Microsoft.FSharp.Core.string
val firstFileIn : list:List<string> -> string
Full name: Script.firstFileIn
Multiple items
val list : List<string>
--------------------
type 'T list = List<'T>
Full name: Microsoft.FSharp.Collections.list<_>
property List.Head: string
More information