F Sharp (programming language): Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit
Tags: Mobile edit Mobile web edit
Line 400:
forms a sequence of squares of numbers from 0 to 14 by filtering out numbers from the range of numbers from 0 to 25. Sequences are [[Generator (computer programming)|generators]] – values are generated on-demand (i.e., are [[lazy evaluation|lazily evaluated]]) – while lists and arrays are evaluated eagerly.
 
F# uses [[pattern matching]] to bind values to names. Pattern matching is also used when accessing discriminated unions – the union is value matched against pattern rules and a rule is selected when a match succeeds. F# also supports ''Activeactive Patternspatterns'' as a form of extensible pattern matching.<ref name="activePatterns"/> It is used, for example, when multiple ways of matching on a type exist.<ref name="overview"/>
 
F# supports a general syntax for defining compositional computations called ''{{visible anchor|computation expressions}}''. Sequence expressions, asynchronous computations and queries are particular kinds of computation expressions. Computation expressions are an implementation of the [[monad (functional programming)|monad]] pattern.<ref name="seq">{{cite web |url=http://blogs.msdn.com/dsyme/archive/2007/09/22/some-details-on-f-computation-expressions-aka-monadic-or-workflow-syntax.aspx |title=Some Details on F# Computation Expressions |access-date=2007-12-14}}</ref>