Beginning F# 4.0 by Robert Pickering, Kit Eason

By Robert Pickering, Kit Eason

This publication is a smart starting place for exploring functional-first programming and its position in the way forward for program improvement. The best-selling advent to F#, now completely up-to-date to model 4.0, may also help you examine the language and discover its new features.

F# 4.0 is a mature, open resource, cross-platform, functional-first programming language which empowers clients and businesses to take on complicated computing issues of easy, maintainable and strong code. F# is additionally a completely supported language in visible Studio and Xamarin Studio. different instruments assisting F# improvement contain Emacs, MonoDevelop, Atom, visible Studio Code, elegant textual content, and Vim.

Beginning F#4.0 has been completely up-to-date that will help you discover the recent good points of the language including:

    Type Providers

  • Constructors as firstclass functions
  • Simplified use of mutable values
  • Support for high-dimensional arrays
  • Slicing syntax help for F# lists

Reviewed through Don Syme, the manager architect of F# at Microsoft examine, Beginning F#4.0 is a smart origin for exploring practical programming and its position sooner or later of program development.

Show description

Read or Download Beginning F# 4.0 PDF

Similar c & c++ windows programming books

The standard C library

Prentice Hall's most crucial C programming identify in years. A better half quantity to Kernighan & Ritchie's c language. a set of reusable services (code for construction info constructions, code for appearing math capabilities and medical calculations, and so on. ) so as to keep C programmers money and time specifically while engaged on huge programming initiatives.

C++ in a Nutshell

To-the-point, authoritative, no-nonsense recommendations have continuously been a hallmark of O'Reilly books. The In a Nutshell books have earned a pretty good recognition within the box because the well-thumbed references that take a seat beside the an expert developer's keyboard. C++ in a Nutshell lives as much as the In a Nutshell promise.

ASP.NET 2.0 Revealed

* in addition to those that obtain the preview at PDC, it really is expected that every one different ASP. web builders should be hungry for info at the re-creation. * might be one of many first actual books on ASP. internet 2. zero, on hand once the know-how itself turns into to be had to a much wider viewers. * Very fast-paced, since it assumes previous wisdom of ASP.

Pro SharePoint 2013 Branding and Responsive Web Development

Professional SharePoint 2013 Branding and Responsive net improvement is the definitive reference at the applied sciences, instruments, and methods wanted for construction responsive web pages and functions with SharePoint 2013. The e-book specializes in strategies that supply the simplest browser event for the myriad of units, browsers, and display orientations and resolutions.

Extra resources for Beginning F# 4.0

Example text

The fourth case will match any value of x greater than 2, and this will cause two further calls to the luc function. The rules are matched in the order in which they are defined, and the compiler will issue a warning if pattern matching is incomplete; that is, if there is some possible input value that will not match any rule. This would be the case in the luc function if you had omitted the final rule, because any values of x greater than 2 would not match any rule. The compiler will also issue a warning if there are any rules that will never be matched, typically because there is another rule in front of them that is more general.

The pattern-matching syntax for pulling the head item off a list is the same as the syntax for concatenating an item to a list. The pattern is formed by the identifier representing the head, followed by :: and then the identifier for the rest of the list. You can see this in the first rule of concatList in the next example. You can also pattern match against list constants; you can see this in the second rule of concatList, where there is an empty list. // list to be concatenated let listOfList = [[2; 3; 5]; [7; 11; 13]; [17; 19; 23; 29]] // definition of a concatenation function let rec concatList l = match l with | head :: tail -> head @ (concatList tail) | [] -> [] // call the function let primes = concatList listOfList // print the results printfn "%A" primes This example, when executed, returns the following: [2; 3; 5; 7; 11; 13; 17; 19; 23; 29] Taking the head from a list, processing it, and then recursively processing the tail of the list is the most common way of dealing with lists via pattern matching, but it certainly isn’t the only thing you can do with pattern matching and lists.

Let myOr b1 b2 = match b1, b2 with | true, _ -> true | _, true -> true | _ -> false 35 CHAPTER 3 ■ FUNCTIONAL PROGRAMMING let myAnd p = match p with | true, true -> true | _ -> false printfn printfn printfn printfn "(myOr true false) = %b" (myOr true false) "(myOr false false) = %b" (myOr false false) "(myAnd (true, false)) = %b" (myAnd (true, false)) "(myAnd (true, true)) = %b" (myAnd (true, true)) This example, when executed, returns the following: (myOr true false) = true (myOr false false) = false (myAnd (true, false)) = false (myAnd (true, true)) = true The myOr function has two Boolean parameters, which are placed between the match and with keywords and are separated by commas to form a tuple.

Download PDF sample

Rated 4.81 of 5 – based on 45 votes