forked from tsai/mathnet-numerics
1063 changed files with 0 additions and 268932 deletions
@ -1,132 +0,0 @@ |
|||
Microsoft Research Shared Source License Agreement |
|||
(NON-STANDARD FOR F# Compiler) |
|||
<<F# Software (Version 1: |
|||
Binary Format: Includes the F# command-line compiler, the F# Visual Studio |
|||
plug-in and the F# runtime library components |
|||
Source Format: Only minor F# library source code files: 1) certain library |
|||
interface file definitions, and 2) certain basic functional programming modules |
|||
needed for assistance when debugging programs |
|||
Other: Includes the F# manual>> |
|||
|
|||
_________________________________________________________ |
|||
|
|||
This Microsoft Research Shared Source license agreement ("MSR-SSLA") is a legal |
|||
agreement between you and Microsoft Corporation ("Microsoft" or "we") for the software |
|||
or data identified above, which may include source code, and any associated materials, |
|||
text or speech files, associated media and "online" or electronic documentation and any |
|||
updates or modifications Microsoft may choose to provide in its discretion (together, the |
|||
"Software"). |
|||
|
|||
By installing, copying, or otherwise using this Software, found at |
|||
http://www.microsoft.com/downloads, you agree to be bound by the terms of this |
|||
MSR-SSLA. If you do not agree, do not install copy or use the Software. The Software is |
|||
protected by copyright and other intellectual property laws and is licensed, not sold. |
|||
|
|||
SCOPE OF RIGHTS: |
|||
You may use, copy, reproduce, and distribute this Software for any non-commercial |
|||
purpose, subject to the restrictions in this MSR-SSLA. Some purposes which can be |
|||
non-commercial are teaching, academic research, public demonstrations and personal |
|||
experimentation. You may also distribute this Software with books or other teaching |
|||
materials, or publish the Software on websites, that are intended to teach the use of the |
|||
Software for academic or other non-commercial purposes. |
|||
You may not use or distribute this Software or any derivative works in any form for |
|||
commercial purposes, except as follows: |
|||
(i) you may use the unmodified binary form of the Software to compile your |
|||
commercial applications as long as you do not redistribute the Software in any |
|||
form for commercial purposes, and |
|||
(ii) notwithstanding (i) above, you may redistribute, including for commercial |
|||
purposes, copies of some or all of the Software runtime libraries called |
|||
FSHARP.CORE.DLL, FSHARP.POWERPACK.dll, FSHARP.POWERPACK.METADATA.dll and FSHARP.POWERPACK.LINQ.dll only, provided |
|||
that: (a) these runtime libraries are redistributed only in binary format as part of |
|||
your software application, (b) your software application adds significant |
|||
and primary functionality to the runtime libraries, (c) you do not use Microsoft's |
|||
name, logo, or trademarks to market your software application, except as |
|||
expressly authorized by Microsoft in a written agreement, (d) these portions of |
|||
your generated binaries are redistributed under the terms of this MSR-SSLA, |
|||
including without limitation, a conspicuous notice to all recipients of the |
|||
Disclaimers, Warnings and Limits on Liability and lack of support described in |
|||
Sections 7, 8 and 9 herein, and (e) you agree (as evidenced by your |
|||
redistribution) to indemnify, hold harmless, and defend Microsoft from and |
|||
against any claims or lawsuits, including attorneys' fees, that arise or result |
|||
from the use or distribution of your software application. |
|||
Examples of commercial purposes would be running business operations, licensing, |
|||
leasing, or selling the Software, distributing the Software for use with commercial |
|||
products, using the Software in the creation or use of commercial products or any other |
|||
activity which purpose is to procure a commercial gain to you or others. |
|||
If the Software includes source code or data, you may create derivative works of such |
|||
portions of the Software and distribute the modified Software for non-commercial |
|||
purposes only, as provided herein. |
|||
|
|||
In return, we simply require that you agree: |
|||
1. That you will not remove any copyright or other notices from the Software. |
|||
2. That if any of the Software is in binary format, you will not attempt to modify such |
|||
portions of the Software, or to reverse engineer or decompile them, except and |
|||
only to the extent authorized by applicable law. |
|||
3. That if you distribute the Software or any derivative works of the Software in |
|||
accordance with this Agreement, you will distribute them under a verbatim copy of |
|||
this license, and you will not grant other rights to the Software or derivative works |
|||
that are different from those provided by this MSR-SSLA. |
|||
4. That if you have created derivative works of the Software, and distribute such |
|||
derivative works, you will cause the modified files to carry prominent notices so |
|||
that recipients know that they are not receiving the original Software. Such notices |
|||
must state: (i) that you have changed the Software; and (ii) the date of any |
|||
changes. |
|||
5. That Microsoft is granted back, without any restrictions or limitations, a non- |
|||
exclusive, perpetual, irrevocable, royalty-free, assignable and sub-licensable |
|||
license, to reproduce, publicly perform or display, install, use, modify, distribute, |
|||
make and have made, sell and transfer your modifications to and/or derivative |
|||
works of the Software source code or data, for any purpose. . |
|||
6. That any feedback about the Software provided by you to us is voluntarily given, |
|||
and Microsoft shall be free to use the feedback as it sees fit without obligation or |
|||
restriction of any kind, even if the feedback is designated by you as confidential. |
|||
7. THAT THE SOFTWARE COMES "AS IS", WITH NO WARRANTIES. THIS |
|||
MEANS NO EXPRESS, IMPLIED OR STATUTORY WARRANTY, INCLUDING |
|||
WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY OR FITNESS |
|||
FOR A PARTICULAR PURPOSE, ANY WARRANTY AGAINST INTERFERENCE |
|||
WITH YOUR ENJOYMENT OF THE SOFTWARE OR ANY WARRANTY OF |
|||
TITLE OR NON-INFRINGEMENT. THERE IS NO WARRANTY THAT THIS |
|||
SOFTWARE WILL FULFILL ANY OF YOUR PARTICULAR PURPOSES OR |
|||
NEEDS. THIS SOFTWARE SHOULD NOT BE USED IN ANY PRODUCT OR |
|||
SERVICE THAT MAY INVOLVE OR BE RELIED UPON FOR PUBLIC OR |
|||
INDIVIDUAL SAFETY, SECURITY, PRIVACY OR HEALTH. ALSO, YOU MUST |
|||
PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE SOFTWARE |
|||
OR DERIVATIVE WORKS. |
|||
8. THAT NEITHER MICROSOFT NOR ANY CONTRIBUTOR TO THE SOFTWARE |
|||
WILL BE LIABLE FOR ANY DAMAGES RELATED TO THE SOFTWARE OR |
|||
THIS MSR-SSLA, INCLUDING DIRECT, INDIRECT, SPECIAL, |
|||
CONSEQUENTIAL OR INCIDENTAL DAMAGES, TO THE MAXIMUM EXTENT |
|||
THE LAW PERMITS, NO MATTER WHAT LEGAL THEORY IT IS BASED ON. |
|||
ALSO, YOU MUST PASS THIS LIMITATION OF LIABILITY ON WHENEVER YOU |
|||
DISTRIBUTE THE SOFTWARE OR DERIVATIVE WORKS. |
|||
9. That we have no duty of reasonable care or lack of negligence, and we are not |
|||
obligated to provide any technical support, updates or any other form of support |
|||
for the Software, but if any support or updates are provided (which shall be solely |
|||
in our discretion), they shall be deemed part of the Software and governed by this |
|||
Agreement. The provision of any Software technical support, updates or other |
|||
support shall in no way be deemed to create any further obligation of Microsoft to |
|||
provide additional support or updates in the future. |
|||
10. That if you breach this MSR-SSLA or if you sue anyone over patents that you think |
|||
may apply to or read on the Software or anyone's use of the Software, this MSR- |
|||
SSLA (and your license and rights obtained herein) terminate automatically. Upon |
|||
any such termination, you shall destroy all of your copies of the Software |
|||
immediately. Sections 5, 6, 7, 8, 9, 10, 13 and 14 of this MSR-SSLA shall survive |
|||
any termination of this MSR-SSLA. |
|||
11. That the patent rights, if any, granted to you in this MSR-SSLA only apply to the |
|||
Software, not to any derivative works you make. |
|||
12. That the Software may be subject to U.S. export jurisdiction at the time it is |
|||
licensed to you, and it may be subject to additional export or import laws in other |
|||
places. You agree to comply with all such laws and regulations that may apply to |
|||
the Software after delivery of the software to you. |
|||
13. That all rights not expressly granted to you in this MSR-SSLA are reserved. |
|||
14. That this MSR-SSLA shall be construed and controlled by the laws of the State of |
|||
Washington, USA, without regard to conflicts of law. If any provision of this MSR- |
|||
SSLA shall be deemed unenforceable or contrary to law, the rest of this MSR- |
|||
SSLA shall remain in full effect and interpreted in an enforceable manner that |
|||
most nearly captures the intent of the original language. |
|||
|
|||
Copyright (c) Microsoft Corporation. All rights reserved. |
|||
|
|||
|
|||
|
|||
Revised May 17, 2009 |
|||
|
|||
@ -1,516 +0,0 @@ |
|||
<html> |
|||
|
|||
<head> |
|||
<Attribute> |
|||
<title>The F# May 2009 Community Technology Preview, 1.9.6.16</title> |
|||
|
|||
<link type="text/css" rel="Stylesheet" href="/rmcstyle.css"><link type="text/css" rel="Stylesheet" href="doc/rmcstyle-copy.css"> |
|||
<link type="text/css" rel="Stylesheet" href="/groupStyle.css"><link type="text/css" rel="Stylesheet" href="doc/groupStyle-copy.css"> |
|||
|
|||
<style type="text/css"> |
|||
TT { font-weight: bold; color: blue; font-size: 10pt; } |
|||
PRE { font-weight: bold; color: blue; font-size: 10pt; } |
|||
.style1 |
|||
{ |
|||
text-indent: -18.0pt; |
|||
line-height: 130%; |
|||
font-size: 10.0pt; |
|||
font-family: "Calisto MT", serif; |
|||
margin-left: 71.85pt; |
|||
margin-right: 0cm; |
|||
margin-top: 0cm; |
|||
margin-bottom: 6.0pt; |
|||
} |
|||
.style2 |
|||
{ |
|||
font-size: 10.0pt; |
|||
font-family: Consolas; |
|||
color: #4F81BD; |
|||
margin-left: 14.2pt; |
|||
margin-right: 0cm; |
|||
margin-top: 0cm; |
|||
margin-bottom: .0001pt; |
|||
} |
|||
.style3 |
|||
{ |
|||
font-family: Consolas; |
|||
color: #4F81BD; |
|||
} |
|||
.style4 |
|||
{ |
|||
font-size: 10.0pt; |
|||
font-family: Consolas; |
|||
color: #4F81BD; |
|||
margin-left: 14.2pt; |
|||
margin-right: 0cm; |
|||
margin-top: 0cm; |
|||
margin-bottom: 6.0pt; |
|||
} |
|||
.style5 |
|||
{ |
|||
font-family: Verdana; |
|||
font-size: 80%; |
|||
} |
|||
.style6 |
|||
{ |
|||
font-family: Verdana; |
|||
} |
|||
.style7 |
|||
{ |
|||
text-indent: -18.0pt; |
|||
line-height: 130%; |
|||
font-size: 80%; |
|||
font-family: Verdana; |
|||
margin-left: 71.85pt; |
|||
margin-right: 0cm; |
|||
margin-top: 0cm; |
|||
margin-bottom: 6.0pt; |
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
|
|||
|
|||
<body> |
|||
|
|||
<h1> The F# May 2009 Community Technology Preview, 1.9.6.16</h1> |
|||
|
|||
<p>Welcome to the F# May 2009 |
|||
Community Technology Preview (CTP). F# is a typesafe, scalable, succinct, typed, efficient |
|||
programming language for the .NET platform. This release represents an important step in |
|||
the evolution of the F# language as we progress it towards product quality. |
|||
The release contains:</p> |
|||
|
|||
<ul> <li>The F# command-line compiler</li> |
|||
<li>F# Interactive, for dynamic execution and interactive evaluation</li> |
|||
<li>The F# library components</li> |
|||
<li>The F# Visual Studio 2008 components</li> |
|||
<li>Tools such as the F# lexer and parser generators and the value-add "F# |
|||
PowerPack"</li> |
|||
</ul> |
|||
<p>Full details can be found |
|||
at the <a href="http://msdn.microsoft.com/fsharp">F# Developer Center</a> or the <a href="http://research.microsoft.com/fsharp">F# website</a> . |
|||
There you can find additional F# learning resources, links to the F# community and |
|||
more. |
|||
You may be interested in |
|||
tracking <a href="http://blogs.msdn.com/dsyme">Don Syme's F# blog</a> |
|||
and/or blogging about your experiences with using F#. If you are getting started with F#, try the following sites:</p> |
|||
<ul> <li> The <a href="http://msdn.microsoft.com/fsharp">F# developer center</a></li> |
|||
<li> The F# community site at <a href="http://cs.hubfs.net/">hubFS</a></li> |
|||
<li> The <a href="http://code.msdn.com/fsharpsamples">F# samples</a></li> |
|||
</ul> |
|||
|
|||
|
|||
<h3><b>Table of Contents</b></h3> |
|||
<ul> <li> <a href="#Requirements">Requirements</a></li> |
|||
<li> <a href="#ProvidingFeedback>Providing Feedback</a></li> |
|||
<li> <a href="#Support>Support</a></li> |
|||
<li> <a href="#UsingMono">Using F# with Mono</a></li> |
|||
<li> <a href="#Changes">Changes</a></li> |
|||
</ul> |
|||
|
|||
<h3><a name="Requirements"></a>Requirements</h3> |
|||
|
|||
<ul> |
|||
<li>To compile F# programs you need one of: |
|||
|
|||
<ul> |
|||
<li>The .NET Framework SDK or .NET Framework Redistributable Components. |
|||
Versions 2.0, 3.0 and 3.5 are supported.</li> |
|||
<li>Visual Studio 2008 Standard Edition or above. </li> |
|||
<li>The freely available Visual Studio 2008 Shell. </li> |
|||
<li>The Microsoft SSCLI Shared-Source implementation of the CLR.</li> |
|||
<li>Another CLI implementation (e.g. Mono). See the notes on <a href="#UsingMono">using Mono</a> below. Always ensure you have the |
|||
latest stable Mono release installed (e.g. the Mono 2.0 preview release or later as of the time of writing) - |
|||
some versions of Linux come with very old Mono releases. |
|||
</ul> |
|||
</li> |
|||
<li>If you are not using Visual Studio, you will need an alternate editor. If you use Emacs you will probably want to use the |
|||
<a href="http://cs.hubfs.net/forums/thread/5922.aspx">Emacs F# mode.</a>. |
|||
You will also need a command line prompt to run F# Interactive and the command line compiler.</li> |
|||
|
|||
<li>A sense of adventure and discovery!</li> |
|||
|
|||
</ul> |
|||
|
|||
|
|||
|
|||
|
|||
<h3><a name="ProvidingFeedback"></a> Providing Feedback</h3> |
|||
|
|||
<p> |
|||
Your feedback is highly valuable to the F# team. Please send any comments |
|||
to <a href="mailto:fsbugs@microsoft.com">fsbugs@microsoft.com</a>. Your positive |
|||
and negative feedback, as well as suggestions, comments, feature requests, and |
|||
bug reports are warmly welcomed.</p> |
|||
<p> |
|||
If you have questions for the F# user community, post them to one of the sites |
|||
listed in the Support section below.</p> |
|||
|
|||
|
|||
|
|||
<h3><a name="Support"></a>Support</h3> |
|||
|
|||
<p> |
|||
This F# CTP is pre-release software and is not officially supported by Microsoft |
|||
product support. If you have issues or questions that require support, you |
|||
can use one of the following resources:</p> |
|||
<ul> |
|||
<li>The <a href="http://cs.hubfs.net/forums/default.aspx">F# Forums</a> at hubFS</li> |
|||
<li>Send mail to <a href="mailto:fsbugs@microsoft.com">fsbugs@microsoft.com</a>.</li> |
|||
<li>Find other F# community resources at <a href="http://msdn.microsoft.com/fsharp">http://msdn.microsoft.com/fsharp</a></li> |
|||
</ul> |
|||
|
|||
<h3><a name="UsingMono"> </a>Using F# with Mono</h3> |
|||
|
|||
<p> |
|||
You may run F# programs <a href="manual/compiler.html#OtherCLIs">in conjunction |
|||
with other CLI implementations</a> such as <a href="http://www.go-mono.com">Mono</a>. |
|||
Please read the notes below. Some more information is |
|||
available at the <a href="http://strangelights.com/fsharp/Wiki/default.aspx/FSharpWiki.MonoLinux">F# Wiki</a>. |
|||
|
|||
</p> |
|||
<ul> |
|||
<li> Mono version 2.0 or later is required. |
|||
<li> Install the F# libraries to the GAC using <tt>install-mono.sh</tt>. This script also contains the commands to trigger |
|||
pre-compilation, but since some versions of Mono have had problems with pre-compilation the code is commented out. |
|||
|
|||
<li> Run the compiler using <tt>mono bin/fsc.exe</tt>. You will want to make an alias for this. |
|||
|
|||
<li> Run F# Interactive compiler using <tt>mono bin/fsi.exe</tt>. You may wish to make an alias for this. |
|||
|
|||
<li> Ahead-of-time compilation can be useful for F# assemblies, but there have been reports of issues with using this on Mono. |
|||
If you find out that it works on your version of Mono, go ahead and run it on <tt>fsc.exe</tt>, <tt>fsi.exe</tt>, |
|||
<tt>FSharp.Compiler.dll</tt>, and <tt>FSharp.Core.dll</tt> to improve startup times for <tt>mono bin/fsc.exe</tt>. |
|||
|
|||
<li> Debugging symbols are not generated. Using the <tt>-g</tt> flag will generate a warning. |
|||
|
|||
<li> Strong name signing is now available in the F# compiler via the <tt>--keyfile</tt> command line option. |
|||
|
|||
<li> F# has in the past exposed Mono bugs in corner cases. If you see a problem, this is likely |
|||
to be the result of a bug in Mono. Please |
|||
be sure to investigate and report these to both the F# team and through the Mono bug reporting process. |
|||
</ul> |
|||
|
|||
|
|||
|
|||
<h3><a name="Changes"></a>Changes: F# CTP 2009 Release</h3> |
|||
|
|||
<p>This release makes many improvements to the core experience provided with the last F# CTP, |
|||
with improved debugging support, performance and scalability improvements in the language, |
|||
libraries and Visual Studio, many minor language extensions, and a release of Visual Studio 2010 Beta1 with F# integrated. |
|||
</p> |
|||
|
|||
<p>The changes in this release are documented briefly below. More details are contained |
|||
in the <a href="http://msdn.microsoft.com/fsharp">blog announcements</a> coinciding with this release.</p> |
|||
<p> |
|||
<h4>Summary</h4> |
|||
<ul type="disc"> |
|||
<li > |
|||
<b>Release</b> |
|||
<ul type="circle"> |
|||
<li>F# is integrated into Visual Studio 2010 Beta1</li> |
|||
<li>F# in Visual Studio2010 can build applications for .NET 4.0 Beta1</li> |
|||
<li>Updated F# CTP for Visual Studio 2008 and .NET 2.0/3.0/3.5</li> |
|||
<li>F# PowerPack to be available on CodePlex and also in the CTP Update for this release</li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>F# Language</b> |
|||
<ul type="circle"> |
|||
<li><tt>#light</tt> is the default</li> |
|||
<li>Support for calling and exposing .NET ParamArray parameters (‘params’ in C#)</li> |
|||
<li>Performance improvement for Sequence Expressions</li> |
|||
<li>Units of measure support for signed integral types</li> |
|||
<li>Support for custom numeric types (<tt>123X</tt>, <tt>1.0R</tt>, etc.)</li> |
|||
<li>Overloading tie-breaker rules result in fewer ambiguity errors when calling overloaded members</li> |
|||
<li><tt>?</tt> operator enables definition of dynamic member lookup</li> |
|||
<li>Attributes can be placed on implicit class constructors</li> |
|||
<li>Let bindings and implicit constructor parameters in type definitions only generate fields when necessary</li> |
|||
<li>Curried members are generated as un-curried .NET members</li> |
|||
<li>Support for <tt>InternalsVisibleTo</tt></li> |
|||
<li>Support for all <tt>Assembly*Attributes</tt></li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>F# Compiler</b> |
|||
<ul type="circle"> |
|||
<li><tt>Fsc.exe</tt> command line compiler options cleanup and standardization</li> |
|||
<li>Passing <tt>mscorlib</tt> and <tt>FSharp.Core.dll</tt> explicitly is supported, and defines the targeted runtime</li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>F# Core Libraries</b> |
|||
<ul type="circle"> |
|||
<li><tt>FSharp.Core.dll</tt> API naming standardization resulting in a handful of API changes </li> |
|||
<li>Silverlight2 version of <tt>FSharp.Core.dll</tt> available in the CTP Update</li> |
|||
<li>RequiresQualifiedAccess applied to many of the modules in <tt>FSharp.Core.dll</tt> to prevent opening the module in client code</li> |
|||
<li><tt>BigInteger</tt>/<tt>BigRational</tt> changes</li> |
|||
<li><tt>ResizeArray</tt> module moved to F# Power Pack</li> |
|||
<li><tt>IStructuralHash</tt> removed, <tt>IStructuralEquatable</tt> and <tt>IStructuralComparable added</tt></li> |
|||
<li>[.Net 4.0] <tt>FSharp.Core.dll</tt> is SecurityTransparent and can be used in partial trust</li> |
|||
<li>[.Net 4.0] F# uses new .NET4.0 <tt>Lazy</tt> and <tt>Tuple</tt> types</li> |
|||
<li>[.Net 4.0] <tt>Async.StartAsTask</tt> and <tt>Task<>.AwaitValue</tt> convert between F# <tt>Async</tt> and .NET4.0 <tt>Task</tt></li> |
|||
<li>[.Net 4.0] <tt>Array.Parallel.*</tt> functions provide data parallel versions of common array operations</li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>Visual Studio</b> |
|||
<ul type="circle"> |
|||
<li>Error List populated by results of Build as well as background errors</li> |
|||
<li>Performance improvements in F# Visual Studio language service</li> |
|||
<li>Many improvements to debugging in Visual Studio, including breakpoint setting and data visualization. </li> |
|||
<li>More reliable F# Intellisense in the face of incomplete or incorrect code</li> |
|||
<li>Improved project build and rebuild performance and reliability</li> |
|||
<li>QuickInfo on <tt>#r</tt> shows details of the referenced assembly</li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>F# Interactive</b> |
|||
<ul type="circle"> |
|||
<li>F# Interactive displays all bound values </li> |
|||
<li>Simplified command line format for <tt>fsi.exe</tt> makes it easy to execute simple F# scripts with <tt>fsi.exe script.fsx a1 a2</tt></li> |
|||
<li><tt>Fsi.exe</tt> emits debug symbols, so can be attached to, to debug a running script</li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>F# PowerPack</b> |
|||
<ul type="circle"> |
|||
<li>Additional <tt>Async</tt> utility functions</li> |
|||
<li>An API for accessing F#-specific metadata from F# assemblies - <tt>FSharp.PowerPack.Metadata.dll</tt> </li> |
|||
</ul> |
|||
</li> |
|||
<li> |
|||
<b>Miscellaneous</b> |
|||
<ul type="circle"> |
|||
<li>Beta F# Language and Compiler documentation on MSDN</li> |
|||
<li>Deletion of features deprecated in previous F# releases</li> |
|||
<li>Plus many, many more minor fixes and improvements</li> |
|||
</ul> |
|||
</li> |
|||
</ul> |
|||
<p> |
|||
<h4>F# Language</h4> |
|||
<h5>#light is the default </h5> |
|||
</p> |
|||
<p> |
|||
All F# source files now use the whitespace-aware <tt>#light</tt> |
|||
syntax by default. This may be |
|||
turned off with <tt>#light off</tt> at the top of a source file.</p> |
|||
<p> |
|||
<h5>.NET ParamArray parameters (‘params’ in C#)</h5></p> |
|||
<p> |
|||
F# can call methods with ParamArray parameters defined in |
|||
other .NET languages such as:</p> |
|||
<pre> |
|||
System.Console.WriteLine("a","b","c","d","e","f") |
|||
// Results in the following call: |
|||
// System.Console.WriteLine("a", [|"b";"c";"d";"e";"f"|]) |
|||
</pre> |
|||
<p> |
|||
F# types can also expose ParamArray parameters themselves |
|||
using <tt>System.ParamArrayAttribute</tt>:</p> |
|||
<pre> |
|||
open System |
|||
type MyType() = |
|||
member this.M([<ParamArray>] args : string[]) = |
|||
args |> Array.iter (printfn "%A") |
|||
</pre> |
|||
|
|||
<h5>Performance of Sequence Expressions</h5> |
|||
<p> |
|||
Sequence expressions are now compiled to state machines, |
|||
instead of as a collection of API calls. This results in improved performance of F# code which works with seq. Many of the Seq.* library functions |
|||
also have improved performance as a result of this change.</p> |
|||
<h5>Units of measure support for signed integral types</h5> |
|||
<p> |
|||
Units of measure may now be applied to integral types such as <tt>int</tt> and <tt>int64</tt>, as |
|||
well as existing floating point types such as <tt>float</tt> and <tt>decimal</tt>.</p> |
|||
<pre> |
|||
[<Measure>] |
|||
type clicks |
|||
|
|||
let x = 64<clicks> </pre> |
|||
<p>Also, a few bugs fixes to enable definitions of OO types annotated with measures to have the full |
|||
range of overloaded operators (e.g. Vector, Matrix etc.).</p> |
|||
<h5>Support for custom numeric types (123X, 1.0R, etc.)</h5> |
|||
<p> |
|||
It is now possible to bind numeric literals to custom numeric |
|||
types. Custom numeric literals, with |
|||
a numeric constant followed by a single letter, are treated as syntactic sugar |
|||
for API calls. |
|||
</p> |
|||
<p> |
|||
In particular, <tt>123X</tt> is now syntactic sugar for</p> |
|||
<pre> |
|||
NumericLiteralX.FromInt32(123)</pre> |
|||
<p>Likewise</p> |
|||
<pre> |
|||
NumericLiteralX.FromZero() |
|||
NumericLiteralX.FromOne() |
|||
NumericLiteralX.FromInt32(6) |
|||
NumericLiteralX.FromInt64(…) |
|||
NumericLiteralX.FromString(…) |
|||
</pre> |
|||
<p>Depending on the input constant.</p> |
|||
<h5>"?" operator enables definition of |
|||
dynamic member lookup</h5> |
|||
<p> The <tt>?</tt> and <tt>?<-</tt> operators now treat their right-hand argument as a parse-time |
|||
symbol, and pass this symbol to the operator definition as a string argument. This enables the definition of |
|||
dynamic lookup as a library implementation of the <tt>?</tt> operator. |
|||
</p> |
|||
<pre> |
|||
open System.Reflection |
|||
|
|||
let (?) (x: 'a) (prop: string) : 'b = |
|||
// A simplified '?' operator for dynamic property |
|||
// lookup using reflection |
|||
let pi = typeof<'a>.GetProperty(prop) |
|||
pi.GetValue(x, [||]) :?> 'b |
|||
|
|||
let statically = "hello".Length |
|||
let dynamically : int = "hello"?Length |
|||
</pre> |
|||
|
|||
|
|||
<h4>F# Compiler</h4> |
|||
<h5>Compiler command line option normalization</h5> |
|||
<p> |
|||
|
|||
The command line options for the F# compiler have been further aligned with |
|||
standard .NET compiler practice. Here are a few notable changes:</p> |
|||
<ul type="disc"> |
|||
<li>All long-form compiler options taking parameters now require a ':', as in <tt>--target:exe</tt></li> |
|||
<li>Tailcalls is now set based on a separate <tt>--tailcalls[+/-]</tt> flag, which is on by default</li> |
|||
<li>Cross-module optimization is now set based on a separate <tt>--crossoptimize[+/-]</tt> flag, which is on by default</li> |
|||
</ul> |
|||
<p>To see the full list of compiler options, use <tt>fsc.exe -?</tt></p> |
|||
<h4>F# Core Libraries</h4> |
|||
<h5>FSharp.Core.dll API naming standardization resulting in a handful of API changes </h5> |
|||
<p>The camelCase naming scheme has been adopted in place of |
|||
under_scores in the compositional functional programming modules. |
|||
</p> |
|||
<p>A few other functions have been renamed to align better with |
|||
this naming convention.</p> |
|||
<h5>BigInteger/BigRational </h5> |
|||
<p> F# BigInteger has been aligned with the new .NET4.0 BigInteger type. On .NET 2.0, a matching BigInteger |
|||
implementation is included in <tt>FSharp.Core.dll</tt>.</p> |
|||
<p> |
|||
The BigRational type has been moved into the F# PowerPack.</p> |
|||
<h5>Structured Formatting Customization</h5> |
|||
<p>Two tools for customizing structured formatting of values with |
|||
%A or in the F# Interactive have been added to this release.</p> |
|||
<ul> |
|||
<li>Width and node count parameters on %A format |
|||
<pre> |
|||
%<width>.<node-count>A |
|||
</pre> |
|||
A width of 0 will mean "no line splitting", i.e. 1-dimensional layout. |
|||
<p></p> |
|||
</li> |
|||
<li>Extensibility via an attribute: |
|||
<pre> |
|||
[<StructuredFormatDisplay("matrix {StructuredDisplayAsArray}")>] |
|||
type Matrix<'T>(width,height,generator:int->int->'T) = |
|||
|
|||
///...Matrix members... |
|||
|
|||
member private this.StructuredDisplayAsArray = |
|||
Array2D.init width height generator |
|||
</pre> |
|||
</li> |
|||
</ul> |
|||
<p> |
|||
This attribute is used to mark how a type is displayed by |
|||
default when using <tt>%A</tt> printf formatting patterns and other two-dimensional |
|||
text-based display layouts. In version 1 of F# the only valid values will be of |
|||
the form <tt>PreText {PropertyName} PostText. </tt>The property name indicates a |
|||
property to evaluate and to display instead of the object itself. |
|||
</p> |
|||
<p>As a library developer: |
|||
<ul> |
|||
<li>Override <tt>ToString</tt> for simple types</li> |
|||
<li>Consider implementing <tt>DebuggerDisplay</tt> |
|||
<ul> |
|||
<li>if you expect users to often see this type in the debgugger</li> |
|||
<li>AND overriding <tt>ToString</tt> is not adequate for this purpose</li> |
|||
</ul> |
|||
</li> |
|||
<li>Consider implementing <tt>StructuredFormatDisplay</tt> if </li> |
|||
<ul> |
|||
<li>you expect users to see this type in a console or other textual display</li> |
|||
<li>and the default results of <tt>printf %A</tt> for the type is not adequate</li> |
|||
<li>and overriding <tt>ToString</tt> is not adequate </li> |
|||
</ul> |
|||
</li> |
|||
<li>It is OK to implement all three</li> |
|||
</ul> |
|||
<p>As a library developer: |
|||
<ul> |
|||
<li>Use <tt>%A</tt> for structured formatting</li> |
|||
<li>Use <tt>fsi.AddPrinter</tt> to make adhoc changes to how FSI displays data</li> |
|||
</ul> |
|||
<h5>[.Net 4.0] F# uses new .NET4.0 Lazy and Tuple types</h5> |
|||
<p> F# compiled for .NET4.0 uses the new <tt>System.Tuple</tt> and <tt>System.Lazy</tt> types in place |
|||
of F#-specific types.</p> |
|||
<h5>[.Net 4.0] Converting between F# Async |
|||
and .NET4.0 Tasks</h5> |
|||
<p> F# Async workflows can be used to compose together .NET4.0 Tasks, using the |
|||
<tt>Task<'T>.AsyncValue</tt> and <tt>Async.StartAsTask</tt> functions.</p> |
|||
<pre> |
|||
async { // Await the value from some future we've been given |
|||
// This is effectively "ContinueWith" |
|||
let! v1 = someFuture.AsyncValue |
|||
... } |
|||
|
|||
async { // Set a sub-async program running as a future |
|||
let! subtask = Async.StartChildAsTask ( async { ... } ) |
|||
// Await the value from the future (don't block the thread!) |
|||
// This is effectively "ContinueWith" |
|||
let! v1 = subtask.AsyncValue |
|||
... } |
|||
|
|||
let mytask = async { ... } |> Async.StartAsTask </pre> |
|||
<h5>[.Net 4.0] Array.Parallel </h5> |
|||
<p> Data parallel versions of some of the common Array operations are available in |
|||
the <tt>Array.Parallel</tt> module. These can |
|||
be used to quickly parallelize key loops in F# code. The performance profile of these |
|||
operations is derived from the <tt>System.Threading.Parallel.For</tt> API in .NET4.0.</p> |
|||
<pre> |
|||
let random = new System.Random() |
|||
let numPoints = 10000000 |
|||
let points = Array.init numPoints (fun _ -> random.NextDouble(), random.NextDouble()) |
|||
let numInCircle = |
|||
points |
|||
|> Array.Parallel.choose (fun (x,y) -> |
|||
if x*x + y*y <= 1.0 then Some (x,y) else None) |
|||
|> Array.length |
|||
let pi = 4.0 * float numInCircle / float numPoints </pre> |
|||
<h4> F# PowerPack</h4> |
|||
<h5>Additional Async utility functions</h5> |
|||
<p>The following Async utility functions have been added to the PowerPack: |
|||
<ul> |
|||
<li><tt>Async.AwaitEvent</tt></li> |
|||
<li><tt>Async.AsBeginEnd</tt></li> |
|||
<li><tt>AsyncResult<_></tt></li> |
|||
<li><tt>AsyncResultCell<_></tt></li> |
|||
<li><tt>System.Net.WebClient.AsyncDownloadString</tt></li> |
|||
</ul> |
|||
|
|||
<h5>FSharp.PowerPack.Metadata.dll </h5> |
|||
<p>The API in this assembly |
|||
provides access to the F#-specific metadata. This can be used to get information about F# notions such as type |
|||
abbreviations, units of measure, and currying or parameters.</p> |
|||
<pre> |
|||
#r "FSharp.PowerPack.Metadata.dll" |
|||
open FSharp.PowerPack.Metadata |
|||
|
|||
let assm = FSharpAssembly.FromFile(@"FSharp.Core.dll") |
|||
let entities = assm.Entities |
|||
let allAbbreviations = |
|||
[ for e in entities do |
|||
if e.IsAbbreviation |
|||
then yield e.Name ]</pre> |
|||
|
|||
</body> |
|||
</html> |
|||
Binary file not shown.
Binary file not shown.
@ -1,679 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<doc> |
|||
<assembly><name>FSharp.Compiler.CodeDom</name></assembly> |
|||
<members> |
|||
<member name="P:Internal.Utilities.HashSet`1.Count"> |
|||
<summary> |
|||
The total number of elements in the set |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Remove(``0)"> |
|||
<summary> |
|||
Remove the given element from the set |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Iterate(Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.Unit})"> |
|||
<summary> |
|||
Apply the given function to each binding in the hash table |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Fold``1(Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,``1}},``1)"> |
|||
<summary> |
|||
Apply the given function to the set threading the accumulating parameter |
|||
through the sequence of function applications |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Create"> |
|||
<summary> |
|||
Create a new empty mutable hash set |
|||
with key hash/equality based on the F# structural "hash" and (=) functions |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Create(System.Int32)"> |
|||
<summary> |
|||
Create a new empty mutable hash set with an internal bucket array of the given approximate size |
|||
and with key hash/equality based on the F# structural "hash" and (=) functions |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Create(System.Int32,System.Collections.Generic.IEqualityComparer`1{``0})"> |
|||
<summary> |
|||
Create a new empty mutable hash set with an internal bucket array of the given approximate size |
|||
and with the given key hash/equality functions |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Create(System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
Create a new mutable hash set containing elements drawn from the given sequence |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Copy"> |
|||
<summary> |
|||
Make a shallow copy of the set |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Contains(``0)"> |
|||
<summary> |
|||
Test if the set contains the given element |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Clear"> |
|||
<summary> |
|||
Clear all elements from the set |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1.Add(``0)"> |
|||
<summary> |
|||
Add an element to the collection |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1..ctor"> |
|||
<summary> |
|||
Create a new empty mutable hash set |
|||
with key hash/equality based on the F# structural "hash" and (=) functions |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1..ctor(System.Int32)"> |
|||
<summary> |
|||
Create a new empty mutable hash set with an internal bucket array of the given approximate size |
|||
and with key hash/equality based on the F# structural "hash" and (=) functions |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1..ctor(System.Int32,System.Collections.Generic.IEqualityComparer`1{``0})"> |
|||
<summary> |
|||
Create a new empty mutable hash set with an internal bucket array of the given approximate size |
|||
and with the given key hash/equality functions |
|||
</summary> |
|||
</member> |
|||
<member name="M:Internal.Utilities.HashSet`1..ctor(System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
Create a new mutable hash set containing elements drawn from the given sequence |
|||
</summary> |
|||
</member> |
|||
<member name="T:Internal.Utilities.HashSet`1"> |
|||
<summary> |
|||
Mutable hash sets based by default on F# structural "hash" and (=) functions. Implemented via a hash table and/or Dictionary. |
|||
</summary> |
|||
</member> |
|||
<member name="P:Internal.Utilities.FSharpEnvironment.FSharpRunningBinFolder"> |
|||
<summary> |
|||
The default location of FSharp.Core.dll and fsc.exe based on the version of fsc.exe that is running |
|||
</summary> |
|||
</member> |
|||
<member name="P:Internal.Utilities.FSharpEnvironment.FSharpRunningVersion"> |
|||
|
|||
</member> |
|||
<member name="P:Internal.Utilities.FSharpEnvironment.location"> |
|||
|
|||
</member> |
|||
<member name="T:Internal.Utilities.FSharpEnvironment"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.FSharpAspNetCodeProvider..ctor"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.FSharpAspNetCodeProvider"> |
|||
<summary> |
|||
Implementation of the CodeDomProvider for the F# language. |
|||
This is specialized version that can be used with ASP.NET. |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider..ctor"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.FSharpCodeProvider"> |
|||
<summary> |
|||
Implementation of the CodeDomProvider for the F# language. |
|||
If you intend to use CodeDom with ASP.NET you should use <c>FSharpAspNetCodeProvider</c> instead. |
|||
</summary> |
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.AssemblyAttributes"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.cmdArgsFromParameters(System.CodeDom.Compiler.CompilerParameters,System.String[]`1)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.compileAssemblyFromFileBatch(System.CodeDom.Compiler.CompilerParameters,System.String[]`1,System.CodeDom.Compiler.CompilerResults,Microsoft.FSharp.Core.FastFunc`2{System.String[]`1,System.String[]`1})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.compileFiles(System.String,System.CodeDom.Compiler.CompilerResults)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.id``1(``0)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.op_MinusMinus(System.Text.StringBuilder,System.String)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.op_PlusGreater(System.Text.StringBuilder,Microsoft.FSharp.Core.FastFunc`2{System.Text.StringBuilder,System.Text.StringBuilder})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.processMsg(System.String,System.CodeDom.Compiler.CompilerResults)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler.untyped_fold``2(Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,``0}},System.Collections.IEnumerable,``0)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Compiler"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.AdditionalOptions"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.MemberGenerateType"> |
|||
<summary> |
|||
Where are we generating member? |
|||
</summary> |
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.ResizeArray`1"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.binaryOp(System.CodeDom.CodeBinaryOperatorType,Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context})"> |
|||
<summary> |
|||
Generates code for binary operator using function for left and right operand |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.col``1(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.Collections.IEnumerable,Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context}},Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Process collection - keeps context through the whole processing |
|||
calls 'f' for every element in sequence and 'fs' between every two elements |
|||
as a separator |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.colFilter``1(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.Collections.IEnumerable,Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context}},Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.colFilterT``1(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.Collections.IEnumerable,Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context}},Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Call specified function only on elements of specified type. |
|||
(performs dynamic type test using x.GetType()) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.colT``1(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.Collections.Generic.IEnumerable`1{``0},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context}},Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Process collection - keeps context through the whole processing |
|||
calls 'f' for every element in sequence and 'fs' between every two elements |
|||
as a separator. This is a variant that works on typed collections. |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.convertFunc(System.Type)"> |
|||
<summary> |
|||
Returns F# conversion function for the specified type (or empty string) |
|||
</summary> |
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.coreAssemblies"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.createContext(System.IO.TextWriter,System.CodeDom.Compiler.CodeGeneratorOptions,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.AdditionalOptions)"> |
|||
<summary> |
|||
Create context using specified text writer and options |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.createCounter"> |
|||
<summary> |
|||
Create closure to do the counting |
|||
(this is usend when we need indexing during collection processing) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.decIndent(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.delay``2(Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``0,``1}},``0)"> |
|||
<summary> |
|||
Call function, but give it context as an argument |
|||
</summary> |
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.dict"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.freshName"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.fsKeyWords"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateAbstractParamDecl(System.CodeDom.CodeParameterDeclarationExpression)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateArrayCreateExpr(System.CodeDom.CodeArrayCreateExpression)"> |
|||
<summary> |
|||
Generate array initializer. Checks generator options for ASP.NET workaround. |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateAttributeArg(System.CodeDom.CodeAttributeArgument)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateBoxedExpression(System.CodeDom.CodeExpression)"> |
|||
<summary> |
|||
Generates expression which is casted to the inferred type using "(unbox (box e))" |
|||
this is useful if the environment where it is used specifies the type explicitly |
|||
for example in array initializers |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCatchClause(System.CodeDom.CodeCatchClause)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateClassMember(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.MemberGenerateType,System.CodeDom.CodeTypeMember)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateClassMemberMethod(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.MemberGenerateType,System.CodeDom.CodeMemberMethod,System.Int32)"> |
|||
<summary> |
|||
Generates method code, adds OverloadID attribute when index isn't "-1" |
|||
Generates comments and than calls 'generatMethod' |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateClassOrStruct(System.String,Microsoft.FSharp.Collections.FSharpList`1{System.String},System.CodeDom.CodeTypeDeclaration,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateClassProperty(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.MemberGenerateType,System.CodeDom.CodeMemberProperty)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCodeSnippetMember(System.CodeDom.CodeSnippetTypeMember)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateComment(System.CodeDom.CodeComment)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCompileUnit(System.CodeDom.CodeCompileUnit,Microsoft.FSharp.Core.FastFunc`2{System.CodeDom.CodeCompileUnit,Microsoft.FSharp.Core.Unit})"> |
|||
<summary> |
|||
Generate code for compile unit (file) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateConstructor(System.CodeDom.CodeConstructor)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCustomAttrDecl(System.CodeDom.CodeAttributeDeclaration)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCustomAttrDecls(System.CodeDom.CodeAttributeDeclarationCollection)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCustomAttrDeclsForType(Microsoft.FSharp.Collections.FSharpList`1{System.CodeDom.CodeAttributeDeclaration},System.Reflection.TypeAttributes)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateCustomAttrDeclsList(Microsoft.FSharp.Collections.FSharpList`1{System.CodeDom.CodeAttributeDeclaration})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateDefaultValue(System.CodeDom.CodeTypeReference)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateDelegate(Microsoft.FSharp.Collections.FSharpList`1{System.String},System.CodeDom.CodeTypeDelegate)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateEntryPointMethod(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.MemberGenerateType,System.CodeDom.CodeEntryPointMethod)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateEnum(Microsoft.FSharp.Collections.FSharpList`1{System.String},System.CodeDom.CodeTypeDeclaration)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateEnumField(System.Int32,System.CodeDom.CodeMemberField)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateEvent(System.CodeDom.CodeMemberEvent)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateEventField(System.CodeDom.CodeMemberEvent)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateExpression(System.CodeDom.CodeExpression)"> |
|||
<summary> |
|||
Generate expression - with unkonw type |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateExpressionDefaultThis(System.CodeDom.CodeExpression)"> |
|||
<summary> |
|||
Generates expression, but generates "this" if the expression is null |
|||
(used in field reference etc. because some CodeDOM generators do this |
|||
though I believe it is a mistake) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateExpressionTyped(Microsoft.FSharp.Core.Option`1{System.Type},System.CodeDom.CodeExpression,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateField(System.CodeDom.CodeMemberField)"> |
|||
<summary> |
|||
fields |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateImport(System.CodeDom.CodeNamespaceImport)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateInterface(Microsoft.FSharp.Collections.FSharpList`1{System.String},System.CodeDom.CodeTypeDeclaration)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateInterfaceImplementation``2(System.Collections.Generic.KeyValuePair`2{System.String,``0})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateInterfaceMemberMethod(System.CodeDom.CodeMemberMethod,System.Int32)"> |
|||
<summary> |
|||
Abstract method in the interface |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateInterfaceMemberProperty(System.CodeDom.CodeMemberProperty)"> |
|||
<summary> |
|||
Abstract property in the interface |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateLinePragma``1(System.CodeDom.CodeLinePragma)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateMainMethod(System.CodeDom.CodeEntryPointMethod,System.CodeDom.CodeTypeDeclaration,System.CodeDom.CodeNamespace)"> |
|||
<summary> |
|||
Generates a main method. |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateMethod(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.MemberGenerateType,System.CodeDom.CodeMemberMethod,Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context})"> |
|||
<summary> |
|||
By default all CodeDOM generated methods are 'virtual' which means that |
|||
we have to generate "abstract and default" (unless we're in struct or |
|||
we're implementing an interface, or the method is overriden) |
|||
(NOTE: the same logic isn't properly implemented for properties) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateNamespace(System.CodeDom.CodeNamespace)"> |
|||
<summary> |
|||
Generate code for namespace without compilation unit |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateNamespaceInternal``1(Microsoft.FSharp.Core.Tuple`3{System.CodeDom.CodeNamespace,Microsoft.FSharp.Collections.FSharpList`1{Microsoft.FSharp.Core.Tuple`2{Microsoft.FSharp.Collections.FSharpList`1{System.String},System.CodeDom.CodeTypeDeclaration}},``0},System.Collections.Generic.IEnumerable`1{System.String})"> |
|||
<summary> |
|||
Generates namespace code - takes output from 'preprocessNamespace' |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateParamDecl(System.CodeDom.CodeParameterDeclarationExpression)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generatePrimitiveExpr(Microsoft.FSharp.Core.Option`1{System.Type},System.CodeDom.CodePrimitiveExpression)"> |
|||
<summary> |
|||
Generate value of primitive expression |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateStatement(System.CodeDom.CodeStatement)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateStatementBlock(Microsoft.FSharp.Core.Option`1{System.CodeDom.CodeTypeReference},System.CodeDom.CodeStatementCollection)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateStatements(System.CodeDom.CodeStatementCollection)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateTypeArgs(System.CodeDom.CodeTypeReferenceCollection)"> |
|||
<summary> |
|||
Generate type arguments using context |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateTypeDecl(System.Int32,Microsoft.FSharp.Collections.FSharpList`1{System.String},System.CodeDom.CodeTypeDeclaration)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateTypeDeclOnly(System.CodeDom.CodeTypeDeclaration)"> |
|||
<summary> |
|||
Generate code for type declaration (not included in namespace) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateTypeRef(System.CodeDom.CodeTypeReference)"> |
|||
<summary> |
|||
Generate type reference using context |
|||
(this is most commonly used method) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateTypeRefNet(System.CodeDom.CodeTypeReference)"> |
|||
<summary> |
|||
Get type reference, but don't rename .NET types to F# types |
|||
(this is only needed when calling static methods on the type) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.generateVariableDeclStmt(System.CodeDom.CodeVariableDeclarationStatement)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.getBaseTypeRef(System.CodeDom.CodeTypeReference,Microsoft.FSharp.Collections.Map`2{System.String,System.String},System.String,Microsoft.FSharp.Collections.Set`1{System.String},System.Boolean)"> |
|||
<summary> |
|||
Generates type reference (not for arrays) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.getBaseTypeRefString(System.String)"> |
|||
<summary> |
|||
Generate type reference with empty context |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.getMethodOverloads``1(System.CodeDom.CodeTypeMemberCollection)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.getTypeArgs(System.CodeDom.CodeTypeReferenceCollection,Microsoft.FSharp.Collections.Map`2{System.String,System.String},System.String,Microsoft.FSharp.Collections.Set`1{System.String},System.Boolean)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.getTypeRef(System.CodeDom.CodeTypeReference,Microsoft.FSharp.Collections.Map`2{System.String,System.String},System.String,Microsoft.FSharp.Collections.Set`1{System.String},System.Boolean)"> |
|||
<summary> |
|||
Get full type reference using information from context |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.getTypeRefSimple(System.CodeDom.CodeTypeReference)"> |
|||
<summary> |
|||
Get full type reference string using empty context |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.id``1(``0)"> |
|||
<summary> |
|||
Identity function |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.incIndent(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.isInterface(System.CodeDom.CodeTypeReference,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.isNumericConversion(System.Type,System.Type)"> |
|||
<summary> |
|||
Are both types numerical types where numeric conversion function can be applied? |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.isValidIdentifier(System.String)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.makeEscapedIdentifier(System.String)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.makeValidIdentifier(System.String)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.mapFilter``2(Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.Option`1{``1}},Microsoft.FSharp.Collections.FSharpList`1{``0})"> |
|||
<summary> |
|||
Perform map and filter operations in one |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.op_MinusBang(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.String,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Output string as a valid F# identifier |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.op_MinusMinus(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.String,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Append specified string without line-break |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.op_PlusGreater(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Function composition operator |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.op_PlusPlus(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},System.String,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Break-line and append specified string |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.preprocessNamespace(System.CodeDom.CodeNamespace)"> |
|||
<summary> |
|||
Returns CodeNamespace, list of classes with scope (which includes class names |
|||
of containing classes and sequence of class renames) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.processTypeArgs(System.CodeDom.CodeTypeParameterCollection)"> |
|||
<summary> |
|||
Preprocess collection with type parameters |
|||
Returns array to be used with <c>usingTyParams</c> and |
|||
function to be called to generate < ... > code |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.resolveHierarchy(System.CodeDom.CodeTypeDeclaration,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepArgs"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepArgsSemi"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepDot"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepNln"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepNlnSemiSpace"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepNone``1"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepSpace"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepStar"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.sepWordAnd"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.str``1(``0,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Print object converted to string |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.tryAddVariableType(System.String,System.CodeDom.CodeTypeReference,Microsoft.FSharp.Collections.Map`2{System.String,System.Type})"> |
|||
<summary> |
|||
Tries to resolve type of a variable and adds it to the Context dictionary |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.tryGetExpressionType(System.CodeDom.CodeExpression,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Tries to resolve type of an expression using a few tricks: |
|||
* Fields of current type may have known type |
|||
* Properties of current type as well |
|||
* We can also try to resolve other properties (sometimes it helps) |
|||
* Resolve type for local variables or argument reference |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.tryGetSystemType(Microsoft.FSharp.Core.Option`1{System.CodeDom.CodeTypeReference})"> |
|||
<summary> |
|||
Get System.Type of know type (either standard type or resolved) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.tryIsExpressionArray(System.CodeDom.CodeExpression,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Tries to resolve if type is an array, so we can generate |
|||
appropriate code (it can be either indexer or array, but we need to generate |
|||
.Item call for indexers (no overloading is supported by .[]). |
|||
Returns: "None" - can't resolve, "Some" resovled (true/false - is it an array?) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.uniqid(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Print unique id using: "+> uniqid" |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.usingTyParams(System.Collections.Generic.IEnumerable`1{System.String},Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context},Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context)"> |
|||
<summary> |
|||
Record specified type parameters in the context, call generating function |
|||
and then restore the original type parameters |
|||
(this works if someone uses nested type parameters with the same name) |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.|CodeArrayAccessOrIndexer|_|(Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.Context,System.CodeDom.CodeExpression)"> |
|||
<summary> |
|||
Matches array or indexer expression and corrects it if the generated CodeDOM is incorrect |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator.|FoundSystemType|_|(System.String)"> |
|||
<summary> |
|||
Tries to find .NET type for specified type name |
|||
This is used when we need to know type in order to generate something correctly, |
|||
but it's just a fallback case |
|||
</summary> |
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Generator"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.FSharpBinFromEnvironmentVariable"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.FSharpBinFromInstallLocationGuess"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.FSharpBinFromRegistry"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.FSharpRunningVersion"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.FscExeBaseName"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.FscPath"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.debug_commandline_args"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.op_PlusPlus(System.String,System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.regParseFsOutput"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Global.regParseFsOutputNoNum"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Global"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.children``1(``0)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.codeDomCallBackNoScope``3(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,``0}},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{System.Object,``0}}},``0,``2)"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.codeDomCallbackWithScope``4(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,Microsoft.FSharp.Core.FastFunc`2{``2,``1}}},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,Microsoft.FSharp.Core.FastFunc`2{System.Object,``1}}}},``0,``1,``3)"> |
|||
<summary> |
|||
Walks through the CodeDom tree and keeps current "scope" and the result. |
|||
The result is collected through entire tree, but the modified scope is |
|||
passed only to sub-nodes of the current node. |
|||
|
|||
First argument is a function that is called for nodes and has a |
|||
function as a first argument, scope and result as a second and current node as a third. |
|||
The function argument can be used to walk deeper in the tree if wanted. |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.codeDomCallbackWithScope'``4(Microsoft.FSharp.Core.FastFunc`2{Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,Microsoft.FSharp.Core.FastFunc`2{``2,``1}}},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,Microsoft.FSharp.Core.FastFunc`2{System.Object,``1}}}})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.codeDomFlatFilter``1(Microsoft.FSharp.Core.FastFunc`2{System.Object,Microsoft.FSharp.Core.Tuple`2{System.Boolean,System.Boolean}},``0)"> |
|||
<summary> |
|||
Search for members and return flat list of selected members |
|||
Function given as an argument returns tuple - first item specifies |
|||
if the current element should be included in the result, the second |
|||
specifies if we should walk through child members of the current object |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.codeDomFold'``1(Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{System.Object,Microsoft.FSharp.Core.Tuple`2{``0,System.Boolean}}},``0,System.Object)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor.memberMap"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Compiler.CodeDom.Internal.Visitor"> |
|||
|
|||
</member> |
|||
</members> |
|||
</doc> |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,104 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<doc> |
|||
<assembly><name>FSharp.PowerPack.Build.Tasks</name></assembly> |
|||
<members> |
|||
<member name="P:Internal.Utilities.FSharpEnvironment.FSharpRunningBinFolder"> |
|||
<summary> |
|||
The default location of FSharp.Core.dll and fsc.exe based on the version of fsc.exe that is running |
|||
</summary> |
|||
</member> |
|||
<member name="P:Internal.Utilities.FSharpEnvironment.FSharpRunningVersion"> |
|||
|
|||
</member> |
|||
<member name="P:Internal.Utilities.FSharpEnvironment.location"> |
|||
|
|||
</member> |
|||
<member name="T:Internal.Utilities.FSharpEnvironment"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.Unicode(System.Boolean)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.ToolPath(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.ToolExe(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.OutputFile(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.OtherFlags(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.InputFile(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.CodePage(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsLex.ToolName"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsLex.InternalGenerateCommandLineCommands"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsLex.GenerateFullPathToTool"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsLex.GenerateCommandLineCommands"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsLex..ctor"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Build.FsLex"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.ToolPath(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.ToolExe(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.OutputFile(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.OtherFlags(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.Open(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.Module(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.MLCompatibility(System.Boolean)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.InputFile(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.CodePage(System.String)"> |
|||
|
|||
</member> |
|||
<member name="P:Microsoft.FSharp.Build.FsYacc.ToolName"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsYacc.InternalGenerateCommandLineCommands"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsYacc.GenerateFullPathToTool"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsYacc.GenerateCommandLineCommands"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Build.FsYacc..ctor"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Build.FsYacc"> |
|||
|
|||
</member> |
|||
</members> |
|||
</doc> |
|||
Binary file not shown.
Binary file not shown.
@ -1,337 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<doc> |
|||
<assembly><name>FSharp.PowerPack.Linq</name></assembly> |
|||
<members> |
|||
<member name="T:Assembly"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``1(System.Func`1{``0})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``2(System.Func`2{``0,``1})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``2(System.Action`2{``0,``1})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``3(System.Func`3{``0,``1,``2})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``3(System.Action`3{``0,``1,``2})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``4(System.Func`4{``0,``1,``2,``3})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``4(System.Action`4{``0,``1,``2,``3})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToTupledFastFunc``5(System.Func`5{``0,``1,``2,``3,``4})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``1(System.Func`1{``0})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``2(System.Func`2{``0,``1})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``2(System.Action`2{``0,``1})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``3(System.Func`3{``0,``1,``2})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``3(System.Action`3{``0,``1,``2})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``4(System.Func`4{``0,``1,``2,``3})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``4(System.Action`4{``0,``1,``2,``3})"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.FuncConvertExtensions.ToFastFunc``5(System.Func`5{``0,``1,``2,``3,``4})"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.FuncConvertExtensions"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.contains``1(``0,System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Min operator and the <c>query</c> convertor recognises it as such |
|||
It differs in return type from <c>Seq.min_by</c> |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.groupBy``2(Microsoft.FSharp.Core.FastFunc`2{``0,``1},System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Join operator and the <c>query</c> convertor recognises it as such |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.groupJoin``4(System.Collections.Generic.IEnumerable`1{``0},System.Collections.Generic.IEnumerable`1{``1},Microsoft.FSharp.Core.FastFunc`2{``0,``2},Microsoft.FSharp.Core.FastFunc`2{``1,``2},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{System.Collections.Generic.IEnumerable`1{``1},``3}})"> |
|||
<summary> |
|||
This join operator implements the LINQ GroupJoin operator and the <c>query</c> convertor recognises it as such |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.group_by``2(Microsoft.FSharp.Core.FastFunc`2{``0,``1},System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Join operator and the <c>query</c> convertor recognises it as such |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.group_join``4(System.Collections.Generic.IEnumerable`1{``0},System.Collections.Generic.IEnumerable`1{``1},Microsoft.FSharp.Core.FastFunc`2{``0,``2},Microsoft.FSharp.Core.FastFunc`2{``1,``2},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{System.Collections.Generic.IEnumerable`1{``1},``3}})"> |
|||
<summary> |
|||
This join operator implements the LINQ GroupJoin operator and the <c>query</c> convertor recognises it as such |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.join``4(System.Collections.Generic.IEnumerable`1{``0},System.Collections.Generic.IEnumerable`1{``1},Microsoft.FSharp.Core.FastFunc`2{``0,``2},Microsoft.FSharp.Core.FastFunc`2{``1,``2},Microsoft.FSharp.Core.FastFunc`2{``0,Microsoft.FSharp.Core.FastFunc`2{``1,``3}})"> |
|||
<summary> |
|||
This join operator corresponds to the LINQ Join operator and the <c>query</c> convertor recognises it as such |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.maxBy``2(Microsoft.FSharp.Core.FastFunc`2{``0,``1},System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Max operator and the <c>query</c> convertor recognises it as such |
|||
It differs in return type from <c>Seq.max_by</c> |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.max_by``2(Microsoft.FSharp.Core.FastFunc`2{``0,``1},System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Max operator and the <c>query</c> convertor recognises it as such |
|||
It differs in return type from <c>Seq.max_by</c> |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.minBy``2(Microsoft.FSharp.Core.FastFunc`2{``0,``1},System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Min operator and the <c>query</c> convertor recognises it as such |
|||
It differs in return type from <c>Seq.min_by</c> |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.min_by``2(Microsoft.FSharp.Core.FastFunc`2{``0,``1},System.Collections.Generic.IEnumerable`1{``0})"> |
|||
<summary> |
|||
When used in queries, this operator corresponds to the LINQ Min operator and the <c>query</c> convertor recognises it as such |
|||
It differs in return type from <c>Seq.min_by</c> |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.Query.query``1(Microsoft.FSharp.Quotations.Expr`1{``0})"> |
|||
<summary> |
|||
Evaluate the quotation expression by first converting to a LINQ expression tree |
|||
making use of IQueryable operators and then executing expression tree |
|||
|
|||
Exceptions: <c>InvalidArgumentException</c> will be raised if the input expression is |
|||
not in the subset that can be converted to a LINQ expression tree |
|||
</summary> |
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.Query"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.LinqExpressionHelper``1(``0)"> |
|||
<summary> |
|||
This function should not be called directly. |
|||
</summary> |
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`10.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`10"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`11.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`11"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`12.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`12"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`13.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`13"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`14.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`14"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`15.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`15"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`16.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`16"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`17.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`17"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`18.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16,``17)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`18"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`19.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16,``17,``18)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`19"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`20.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16,``17,``18,``19)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`20"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`5.Invoke(``0,``1,``2,``3,``4)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`5"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`6.Invoke(``0,``1,``2,``3,``4,``5)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`6"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`7.Invoke(``0,``1,``2,``3,``4,``5,``6)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`7"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`8.Invoke(``0,``1,``2,``3,``4,``5,``6,``7)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`8"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`9.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.ActionHelper`9"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`10.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`10"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`11.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`11"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`12.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`12"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`13.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`13"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`14.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`14"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`15.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`15"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`16.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`16"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`17.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`17"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`18.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`18"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`19.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16,``17)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`19"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`20.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16,``17,``18)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`20"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`21.Invoke(``0,``1,``2,``3,``4,``5,``6,``7,``8,``9,``10,``11,``12,``13,``14,``15,``16,``17,``18,``19)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`21"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`6.Invoke(``0,``1,``2,``3,``4)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`6"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`7.Invoke(``0,``1,``2,``3,``4,``5)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`7"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`8.Invoke(``0,``1,``2,``3,``4,``5,``6)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`8"> |
|||
|
|||
</member> |
|||
<member name="M:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`9.Invoke(``0,``1,``2,``3,``4,``5,``6,``7)"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes.FuncHelper`9"> |
|||
|
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation.HelperTypes"> |
|||
<summary> |
|||
A set of types used for implementing quotation conversions. |
|||
These are public only because targets of Linq Lambda expressions require them to be so |
|||
</summary> |
|||
</member> |
|||
<member name="T:Microsoft.FSharp.Linq.QuotationEvaluation"> |
|||
<summary> |
|||
This module provides Compile and Eval extension members |
|||
for F# quotation values, implemented by translating to LINQ |
|||
expression trees and using the LINQ dynamic compiler. |
|||
</summary> |
|||
</member> |
|||
</members> |
|||
</doc> |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,86 +0,0 @@ |
|||
<!-- |
|||
*********************************************************************************************** |
|||
FSharp.PowerPack.targets |
|||
|
|||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have |
|||
created a backup copy. Incorrect changes to this file will make it |
|||
impossible to load or build your projects from the command-line or the IDE. |
|||
|
|||
PowerPack extended build rules. |
|||
|
|||
Copyright (C) Microsoft Corporation. All rights reserved. |
|||
*********************************************************************************************** |
|||
--> |
|||
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<UsingTask TaskName="FsLex" AssemblyFile="FSharp.PowerPack.Build.Tasks.dll"/> |
|||
<UsingTask TaskName="FsYacc" AssemblyFile="FSharp.PowerPack.Build.Tasks.dll"/> |
|||
<Import Project="Microsoft.FSharp.Targets"/> |
|||
<PropertyGroup> |
|||
<CompileDependsOn>CallFsLex;CallFsYacc;$(CompileDependsOn)</CompileDependsOn> |
|||
</PropertyGroup> |
|||
|
|||
<!-- Build FsLex files. --> |
|||
<Target |
|||
Name="CallFsLex" |
|||
Inputs="@(FsLex)" |
|||
Outputs="@(FsLex->'$(FsLexOutputFolder)%(Filename).fs')" |
|||
Condition="'@(FsLex)'!=''"> |
|||
|
|||
<!-- Create the output directory --> |
|||
<MakeDir Directories="$(FsLexOutputFolder)"/> |
|||
<!-- Call FsLex --> |
|||
<FsLex |
|||
InputFile="%(FsLex.Identity)" |
|||
OutputFile="$(FsLexOutputFolder)%(FsLex.Filename).fs" |
|||
ToolPath="$(FsLexToolPath)" |
|||
ToolExe="$(FsLexToolExe)" |
|||
OtherFlags="%(FsLex.OtherFlags)" |
|||
Unicode="$(FsLexUnicode)"> |
|||
<!-- Track outputs for 'Clean' --> |
|||
<Output TaskParameter="OutputFile" ItemName="FileWrites"/> |
|||
</FsLex> |
|||
<!-- Make sure it will get cleaned --> |
|||
<CreateItem Include="$(FsLexOutputFolder)%(FsLex.Filename).fs"> |
|||
<Output TaskParameter="Include" ItemName="FileWrites"/> |
|||
</CreateItem> |
|||
</Target> |
|||
|
|||
<!-- Build FsYacc files. --> |
|||
<Target |
|||
Name="CallFsYacc" |
|||
Inputs="@(FsYacc)" |
|||
Outputs="@(FsYacc->'$(FsYaccOutputFolder)%(Filename).fs')" |
|||
Condition="'@(FsYacc)'!=''"> |
|||
|
|||
<!-- Create the output directory --> |
|||
<MakeDir Directories="$(FsYaccOutputFolder)"/> |
|||
<!-- Call FsYacc --> |
|||
<FsYacc |
|||
InputFile="%(FsYacc.Identity)" |
|||
OutputFile="$(FsYaccOutputFolder)%(FsYacc.Filename).fs" |
|||
Open="%(FsYacc.Open)" |
|||
Module="%(FsYacc.Module)" |
|||
OtherFlags="%(FsYacc.OtherFlags)" |
|||
ToolPath="$(FsYaccToolPath)" |
|||
ToolExe="$(FsYaccToolExe)"> |
|||
<!-- Track outputs for 'Clean' --> |
|||
<Output TaskParameter="OutputFile" ItemName="FileWrites"/> |
|||
</FsYacc> |
|||
<!-- Make sure it will get cleaned --> |
|||
<CreateItem Include="$(FsYaccOutputFolder)%(FsYacc.Filename).fs"> |
|||
<Output TaskParameter="Include" ItemName="FileWrites"/> |
|||
</CreateItem> |
|||
</Target> |
|||
<ItemGroup> |
|||
<AvailableItemName Include="FsLex"> |
|||
<Visible>false</Visible> |
|||
</AvailableItemName> |
|||
<AvailableItemName Include="FsYacc"> |
|||
<Visible>false</Visible> |
|||
</AvailableItemName> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
|
|||
|
|||
File diff suppressed because it is too large
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,177 +0,0 @@ |
|||
<!-- |
|||
*********************************************************************************************** |
|||
Microsoft.FSharp.targets |
|||
|
|||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have |
|||
created a backup copy. Incorrect changes to this file will make it |
|||
impossible to load or build your projects from the command-line or the IDE. |
|||
|
|||
This file defines the steps in the standard build process specific for F# .NET projects. |
|||
For example, it contains the step that actually calls the F# compiler. The remainder |
|||
of the build process is defined in Microsoft.Common.targets, which is imported by |
|||
this file. |
|||
|
|||
Copyright (C) Microsoft Corporation. All rights reserved. |
|||
*********************************************************************************************** |
|||
--> |
|||
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
|
|||
<UsingTask TaskName="Fsc" AssemblyFile="FSharp.Build.dll"/> |
|||
<UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="FSharp.Build.dll"/> |
|||
|
|||
|
|||
<PropertyGroup> |
|||
<FSharpTargetsDir Condition="'$(FSharpTargetsDir)'==''">$(MSBuildExtensionsPath)\FSharp\1.0\</FSharpTargetsDir> |
|||
<MSBuildAllProjects>$(MSBuildAllProjects);$(FSharpTargetsDir)\Microsoft.FSharp.targets</MSBuildAllProjects> |
|||
<DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension> |
|||
<Language>F#</Language> |
|||
<!-- Earlier project types did not have an explicit tailcalls property in the .fsproj. In this case, derive the value from the optimize flag --> |
|||
<Tailcalls Condition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls> |
|||
</PropertyGroup> |
|||
|
|||
<!-- |
|||
The CreateManifestResourceNames target create the manifest resource names from the .RESX |
|||
files. |
|||
|
|||
[IN] |
|||
@(EmbeddedResource) - The list of EmbeddedResource items that have been pre-processed to add metadata about resource type |
|||
Expected Metadata "Type" can either be "Resx" or "Non-Resx" |
|||
|
|||
[OUT] |
|||
@(EmbeddedResource) - EmbeddedResource items with metadata |
|||
|
|||
For F# applications the transformation is like: |
|||
|
|||
Resources1.resx => Resources1 => Build into main assembly |
|||
SubFolder\Resources1.resx => SubFolder.Resources1 => Build into main assembly |
|||
Resources1.fr.resx => Resources1.fr => Build into satellite assembly |
|||
Resources1.notaculture.resx => Resources1.notaculture => Build into main assembly |
|||
|
|||
For other project systems, this transformation may be different. |
|||
--> |
|||
<PropertyGroup> |
|||
<CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn> |
|||
</PropertyGroup> |
|||
<Target |
|||
Name="CreateManifestResourceNames" |
|||
Condition="'@(EmbeddedResource)' != ''" |
|||
DependsOnTargets="$(CreateManifestResourceNamesDependsOn)" |
|||
> |
|||
|
|||
<ItemGroup> |
|||
<_Temporary Remove="@(_Temporary)" /> |
|||
</ItemGroup> |
|||
|
|||
<!-- Create manifest names for culture and non-culture Resx files, and for non-culture Non-Resx resources --> |
|||
<CreateFSharpManifestResourceName |
|||
ResourceFiles="@(EmbeddedResource)" |
|||
RootNamespace="$(RootNamespace)" |
|||
Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx')"> |
|||
|
|||
<Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" /> |
|||
|
|||
</CreateFSharpManifestResourceName> |
|||
|
|||
<!-- Create manifest names for all culture non-resx resources --> |
|||
<CreateFSharpManifestResourceName |
|||
ResourceFiles="@(EmbeddedResource)" |
|||
RootNamespace="$(RootNamespace)" |
|||
PrependCultureAsDirectory="false" |
|||
Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'"> |
|||
|
|||
<Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" /> |
|||
|
|||
</CreateFSharpManifestResourceName> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/> |
|||
<EmbeddedResource Include="@(_Temporary)" /> |
|||
<_Temporary Remove="@(_Temporary)" /> |
|||
</ItemGroup> |
|||
</Target> |
|||
|
|||
<ItemGroup> |
|||
<DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/> |
|||
<_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/> |
|||
<!-- Add any missing .pdb extension, as the compiler does --> |
|||
<_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/> |
|||
</ItemGroup> |
|||
|
|||
<PropertyGroup> |
|||
<!-- Provide a facility to override UseHostCompilerIfAvailable--> |
|||
<UseHostCompilerIfAvailable Condition=" '$(UseHostCompilerIfAvailable)' == ''">false</UseHostCompilerIfAvailable> |
|||
<CoreCompileDependsOn>_ComputeNonExistentFileProperty</CoreCompileDependsOn> |
|||
<WarningsAsErrors>$(WarningsAsErrors)</WarningsAsErrors> |
|||
</PropertyGroup> |
|||
|
|||
<Target |
|||
Name="CoreCompile" |
|||
Inputs="$(MSBuildProjectFullPath); |
|||
@(Compile); |
|||
@(_CoreCompileResourceInputs); |
|||
$(ApplicationIcon); |
|||
$(AssemblyOriginatorKeyFile); |
|||
@(ReferencePath); |
|||
@(CompiledLicenseFile); |
|||
@(EmbeddedDocumentation); |
|||
$(Win32Resource); |
|||
$(Win32Manifest); |
|||
@(CustomAdditionalCompileInputs); |
|||
$(VersionFile); |
|||
$(KeyOriginatorFile); |
|||
@(CompileBefore); |
|||
@(CompileAfter)" |
|||
Outputs="@(DocFileItem); |
|||
@(IntermediateAssembly); |
|||
$(NonExistentFile); |
|||
@(CustomAdditionalCompileOutputs)" |
|||
DependsOnTargets="$(CoreCompileDependsOn)" |
|||
Condition="'$(OutputType)'!='None'"> |
|||
|
|||
<!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler --> |
|||
<Fsc Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' " |
|||
CodePage="$(CodePage)" |
|||
DebugSymbols="$(DebugSymbols)" |
|||
DebugType="$(DebugType)" |
|||
BaseAddress="$(BaseAddress)" |
|||
DefineConstants="$(DefineConstants)" |
|||
DisabledWarnings="$(DisabledWarnings)" |
|||
DocumentationFile="$(DocumentationFile)" |
|||
GenerateInterfaceFile="$(GenerateInterfaceFile)" |
|||
KeyFile="$(KeyOriginatorFile)" |
|||
NoFramework="true" |
|||
NoWarn="$(NoWarn)" |
|||
Optimize="$(Optimize)" |
|||
Tailcalls="$(Tailcalls)" |
|||
OtherFlags="$(OtherFlags)" |
|||
OutputAssembly="@(IntermediateAssembly)" |
|||
PdbFile="$(PdbFile)" |
|||
Platform="$(PlatformTarget)" |
|||
VersionFile="$(VersionFile)" |
|||
References="@(ReferencePath)" |
|||
ReferencePath="$(ReferencePath)" |
|||
Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)" |
|||
Sources="@(CompileBefore);@(Compile);@(CompileAfter)" |
|||
TargetType="$(OutputType)" |
|||
ToolPath="$(FscToolPath)" |
|||
ToolExe="$(FscToolExe)" |
|||
TreatWarningsAsErrors="$(TreatWarningsAsErrors)" |
|||
Utf8Output="$(Utf8Output)" |
|||
VisualStudioStyleErrors="$(VisualStudioStyleErrors)" |
|||
WarningsAsErrors="$(WarningsAsErrors)" |
|||
WarningLevel="$(WarningLevel)" |
|||
Win32ResourceFile="$(Win32Resource)" |
|||
Win32ManifestFile="$(Win32Manifest)"> |
|||
</Fsc> |
|||
|
|||
<ItemGroup> |
|||
<_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" /> |
|||
</ItemGroup> |
|||
|
|||
</Target> |
|||
|
|||
<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets"/> |
|||
|
|||
</Project> |
|||
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,26 +0,0 @@ |
|||
<html> |
|||
|
|||
<head> |
|||
<title>The F# Compiler Version 1.9.6.16</title> |
|||
|
|||
<link type="text/css" rel="Stylesheet" href="/rmcstyle.css"><link type="text/css" rel="Stylesheet" href="rmcstyle-copy.css"> |
|||
<link type="text/css" rel="Stylesheet" href="/groupStyle.css"><link type="text/css" rel="Stylesheet" href="groupStyle-copy.css"> |
|||
|
|||
<style type="text/css"> |
|||
TT { font-weight: bold; color: blue; font-size: 10pt; } |
|||
PRE { font-weight: bold; color: blue; font-size: 10pt; } |
|||
</style> |
|||
</head> |
|||
|
|||
|
|||
<body> |
|||
|
|||
<h1>Samples </h1> |
|||
|
|||
<p> |
|||
The F# samples for this release can be found online at <a href="http://code.msdn.com/fsharpsamples">http://code.msdn.com/fsharpsamples</a>. |
|||
</p> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -1,88 +0,0 @@ |
|||
<html> |
|||
|
|||
<head> |
|||
<title>The F# Compiler Version 1.9.6.16</title> |
|||
|
|||
<link type="text/css" rel="Stylesheet" href="/rmcstyle.css"><link type="text/css" rel="Stylesheet" href="rmcstyle-copy.css"> |
|||
<link type="text/css" rel="Stylesheet" href="/groupStyle.css"><link type="text/css" rel="Stylesheet" href="groupStyle-copy.css"> |
|||
|
|||
<style type="text/css"> |
|||
TT { font-weight: bold; color: blue; font-size: 10pt; } |
|||
PRE { font-weight: bold; color: blue; font-size: 10pt; } |
|||
</style> |
|||
</head> |
|||
|
|||
|
|||
<body> |
|||
|
|||
<h1> Using F# Interactive in Visual Studio</h1> |
|||
|
|||
<p> |
|||
If you use Visual Studio 2008 (including the |
|||
freely available <a href="http://msdn.microsoft.com/en-us/vsx2008/products/bb933751.aspx">Visual Studio 2008 Shell</a>), |
|||
you can use 'F# Interactive' as a tool window! </p> |
|||
|
|||
<h4>Starting F# Interactive</h4> |
|||
|
|||
<p> To start the session, go to the View -> Other Windows and select 'F# Interactive'. You can also start a session |
|||
simply using <tt>Alt-Return</tt> in an F# source document, or using the shortcut Ctrl+Alt+F.</p> |
|||
|
|||
|
|||
<h4>Editing and Evaluating a Script</h4> |
|||
|
|||
<p>You create a script file using File -> New File -> Script -> F# Script File.</p> |
|||
|
|||
<p> The normal mode of operation is to edit an F# script file and send fragments for execution in the tool window. In |
|||
this mode, your fragments are typechecked as you type, and you are actively working towards a completed |
|||
file that can act as the finished product of your explorative programming. The tool window is then |
|||
just used for displaying data.</p> |
|||
|
|||
<p>In the script file, you should use <tt>#r</tt> and <tt>#I</tt> to reference assemblies |
|||
and augment your assembly include path.</p> |
|||
|
|||
|
|||
<p>The session is global to the instance of Visual Studio and text can be sent from any |
|||
F# source code file (.fs, .fsi, .fsx, .ml, .mli). |
|||
Use the <tt>Alt-Return</tt> combination to evaluate |
|||
selected text. For example, highlight <tt>printfn "Hello World"</tt> and use this key combination - the code will then |
|||
execute. </p> |
|||
|
|||
|
|||
<h4>Execution Context for Scripts</h4> |
|||
|
|||
|
|||
<p>The F# Interactive session executes only those code fragments you direct it to. If you select a fragment from |
|||
half-way through your script, earlier portions of the script will not be executed implicitly. </p> |
|||
|
|||
<p>When sending text from a file, file names are resolved relative to the scripts containing the reference. Visual F# Interactive sets the |
|||
line and directory context of the session each time an entry is sent from Visual Studio, though it doesn't |
|||
adjust the value of <tt>System.Environment.CurrentDirectory</tt>. It can be useful to add </p> |
|||
<pre> |
|||
System.Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ |
|||
</pre> |
|||
<p>to your script. <tt>__SOURCE_DIRECTORY</tt> can be used in any F# source file and is expanded to the directory |
|||
containing the file.</p> |
|||
|
|||
|
|||
<h4>Organizing Your Scripts</h4> |
|||
|
|||
<p> Although scripts can be authored without a project, it can be useful to create an F# Project to hold a group of related scripts. |
|||
You can do this with <tt>New Project</tt> or by making a copy of one of the projects in |
|||
the F# Samples directory. You can also use <tt>#load</tt> to load both signature and implementation files as |
|||
if they have been compiled as compilation units by the command-line compiler.</p> |
|||
|
|||
|
|||
<h4>Controlling the Evaluation Session</h4> |
|||
|
|||
<p>In the tool window, <tt>#quit;;</tt> will quit and Ctrl+C will cancel execution. |
|||
The context menu in the tool window includes |
|||
"Reset Session" and "Cancel Evaluation" commands. |
|||
If you do type into the tool window, history is available with the up/down arrows. </p> |
|||
|
|||
|
|||
<p> To troubleshoot, see README-fsharp.html</p> |
|||
|
|||
<p>Please contact fsbugs@microsoft.com with feedback on this documentation.</p> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -1,64 +0,0 @@ |
|||
<STYLE type="text/css"> |
|||
BODY |
|||
{ |
|||
font-family: verdana; |
|||
} |
|||
|
|||
|
|||
H1, H2, H3 { font-family: Verdana, Helvetica, sans-serif;} |
|||
H1 {color: maroon; text-decoration: underline;} |
|||
|
|||
H1 |
|||
{ |
|||
font-family: tahoma; |
|||
font-weight: bold; |
|||
font-size: 100%; |
|||
color: #000000; |
|||
} |
|||
H2 |
|||
{ |
|||
font-family: tahoma; |
|||
font-weight: bold; |
|||
font-size: 90%; |
|||
color: #000000; |
|||
} |
|||
H3 |
|||
{ |
|||
font-family: tahoma; |
|||
font-weight: bold; |
|||
font-size: 90%; |
|||
color: #000000; |
|||
} |
|||
P |
|||
{ |
|||
font-family: verdana; |
|||
color: #000000; |
|||
} |
|||
P P |
|||
{ |
|||
font-size: 80%; |
|||
} |
|||
HR |
|||
{ |
|||
color: #cccccc; |
|||
height: 1px; |
|||
} |
|||
|
|||
LI |
|||
{ |
|||
font-family: Verdana; |
|||
font-size: 80%; |
|||
} |
|||
LI LI |
|||
{ |
|||
font-size: 90%; |
|||
} |
|||
LI A |
|||
{ |
|||
font-size: 90%; |
|||
} |
|||
|
|||
|
|||
SUP {font-size: x-small; color: #666666;} |
|||
.link {text-decoration: underline;} |
|||
</STYLE> |
|||
@ -1,112 +0,0 @@ |
|||
BODY |
|||
{ |
|||
font-family: verdana; |
|||
} |
|||
P |
|||
{ |
|||
padding-left: 20px; |
|||
} |
|||
.TitleHeader |
|||
{ |
|||
padding-left: 20px; |
|||
font-size: 1em; |
|||
font-weight: bold; |
|||
} |
|||
.linkbox |
|||
{ |
|||
margin-left: 20px; |
|||
margin-right: 30px; |
|||
margin-bottom: 20px; |
|||
padding-bottom: 10px; |
|||
width: 175px; |
|||
float: right; |
|||
border-right: #0066CC 1px solid; |
|||
background: #f1f1f1; |
|||
border-left: #0066CC 1px solid; |
|||
border-bottom: #0066CC 1px solid; |
|||
} |
|||
.outlineDivTitle |
|||
{ |
|||
background-color: #0066CC; |
|||
color: #FFFFFF; |
|||
padding-left: 15px; |
|||
padding-bottom: 2px; |
|||
padding-top: 2px; |
|||
font: bold 70% Verdana; |
|||
color: #ffffff; |
|||
} |
|||
.outlineDiv |
|||
{ |
|||
padding-left: 20px; |
|||
background-image: URL(/images/blueTriangle.gif); |
|||
background-repeat: no-repeat; |
|||
background-position: 6 8; |
|||
font: 70% verdana; |
|||
color: #003399; |
|||
line-height: 200%; |
|||
} |
|||
|
|||
.GroupContactTitle |
|||
{ |
|||
color: #003399; |
|||
font-size: .93em; |
|||
} |
|||
.GroupContact |
|||
{ |
|||
color: #003399; |
|||
font-size: .93em; |
|||
font-weight: bold; |
|||
} |
|||
A.GroupContactLink |
|||
{ |
|||
color: #003399; |
|||
} |
|||
.BlankPictureDiv |
|||
{ |
|||
background-color: #cccccc; |
|||
width: 75px; |
|||
height: 75px; |
|||
border: solid #999999 1px; |
|||
font-size: 70%; |
|||
font-weight: bold; |
|||
padding-left: 5px; |
|||
padding-top: 20px; |
|||
padding-right: 5px; |
|||
padding-bottom: 5px; |
|||
} |
|||
.PeopleGroupImage |
|||
{ |
|||
border-color: #999999; |
|||
} |
|||
A.PeopleLastNameLink |
|||
{ |
|||
color: #003399; |
|||
} |
|||
.PeopleLastNameLinked |
|||
{ |
|||
padding-top: 3px; |
|||
font-size: .82em; |
|||
font-weight: bold; |
|||
} |
|||
.PeopleFirstNameLinked |
|||
{ |
|||
color: #003399; |
|||
padding-top: 3px; |
|||
padding-bottom: 8px; |
|||
font-size: .82em; |
|||
text-decoration: none; |
|||
} |
|||
.PeopleLastName |
|||
{ |
|||
padding-top: 3px; |
|||
font-size: .82em; |
|||
font-weight: bold; |
|||
} |
|||
.PeopleFirstName |
|||
{ |
|||
padding-top: 3px; |
|||
padding-bottom: 8px; |
|||
font-size: .82em; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
@ -1,287 +0,0 @@ |
|||
.title_2ndLvl |
|||
{ |
|||
font-family: tahoma; |
|||
font-size: 120%; |
|||
color: #FFFFFF; |
|||
padding-left: 5px; |
|||
} |
|||
.BODY |
|||
{ |
|||
font-family:verdana; |
|||
} |
|||
A |
|||
{ |
|||
color: #003399; |
|||
} |
|||
.VR |
|||
{ |
|||
background-color: #cccccc; |
|||
width: 1px; |
|||
} |
|||
.HR |
|||
{ |
|||
background-color: #cccccc; |
|||
height: 1px; |
|||
} |
|||
.link1 |
|||
{ |
|||
font-size:70%; |
|||
font-family: verdana; |
|||
} |
|||
.link2 |
|||
{ |
|||
font-size: 70%; |
|||
font-family:Verdana; |
|||
font-style:italic; |
|||
} |
|||
.link3 |
|||
{ |
|||
font-style: italic; |
|||
font-family: Verdana; |
|||
color: #000000; |
|||
font-weight: bold; |
|||
} |
|||
.link4 |
|||
{ |
|||
font: italic 70% Verdana; |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.link5 |
|||
{ |
|||
font: 70% Verdana; |
|||
color: #003399; |
|||
text-decoration: none; |
|||
} |
|||
.link6 |
|||
{ |
|||
font: 70% verdana; |
|||
color: #003399; |
|||
} |
|||
.text1 |
|||
{ |
|||
font: 70% Verdana; |
|||
} |
|||
.text2 |
|||
{ |
|||
padding-bottom: 10px; |
|||
font: 70% Verdana; |
|||
} |
|||
.text3 |
|||
{ |
|||
font-size: 120%; |
|||
font-family:Verdana; |
|||
color: #000000; |
|||
} |
|||
.text3_w_padding |
|||
{ |
|||
font: 120% Verdana; |
|||
color: #000000; |
|||
padding-left:20px; |
|||
} |
|||
.text4 |
|||
{ |
|||
font-weight: bold; |
|||
font-size: 70%; |
|||
font-family: Verdana; |
|||
color: #000000; |
|||
} |
|||
.text5 |
|||
{ |
|||
padding-left: 5px; |
|||
font-weight: bold; |
|||
font-size: 70%; |
|||
font-family: Verdana; |
|||
color: #ffffff; |
|||
} |
|||
.text6 |
|||
{ |
|||
font: 70%; |
|||
font-family: verdana; |
|||
} |
|||
.newsTitle |
|||
{ |
|||
font-family: tahoma; |
|||
font-size: 120%; |
|||
color: #CCCCCC; |
|||
} |
|||
.areaTitle |
|||
{ |
|||
font-family: tahoma; |
|||
font-size: 120%; |
|||
color: #FFFFFF; |
|||
} |
|||
.newsContentTitle |
|||
{ |
|||
font-family: tahoma; |
|||
font-size: 120%; |
|||
color: #FFFFFF; |
|||
} |
|||
.areaContentTitle |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 140%; |
|||
color: #000000; |
|||
} |
|||
.areaContentTitle_w_pad |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 140%; |
|||
color: #000000; |
|||
padding-left: 20px; |
|||
padding-top: 20px; |
|||
} |
|||
|
|||
.newsArchiveTitle |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 150%; |
|||
color: #000000; |
|||
} |
|||
.FeatureStoryTitle |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 130%; |
|||
color: #000000; |
|||
} |
|||
.FeatureStoryByLine |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 80%; |
|||
color: #000000; |
|||
} |
|||
.SideBarLink |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 80%; |
|||
color: #000000; |
|||
} |
|||
.newsArchiveSubTitle |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 118%; |
|||
color: #666666; |
|||
} |
|||
.newsArchiveYear |
|||
{ |
|||
font: bold 80% Verdana; |
|||
color: #000000; |
|||
border-bottom: #cccccc 1px solid; |
|||
border-top: #cccccc 1px solid; |
|||
} |
|||
|
|||
.newsHeadlineTitle |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 140%; |
|||
color: #000000; |
|||
} |
|||
|
|||
.newsPublicationDate |
|||
{ |
|||
font-family: Verdana; |
|||
font-size: 60%; |
|||
color: #000000; |
|||
font-weight: bold; |
|||
} |
|||
.newsPublicationSource |
|||
{ |
|||
font-family: Verdana; |
|||
font-size: 60%; |
|||
color: #000000; |
|||
font-weight: bold; |
|||
} |
|||
H1 |
|||
{ |
|||
font-family: tahoma; |
|||
font-weight: bold; |
|||
font-size: 120%; |
|||
color: #000000; |
|||
} |
|||
H3 |
|||
{ |
|||
font-family: tahoma; |
|||
font-weight: bold; |
|||
font-size: 110%; |
|||
color: #000000; |
|||
} |
|||
P |
|||
{ |
|||
font-family: verdana; |
|||
font-size: 70%; |
|||
color: #000000; |
|||
} |
|||
P P |
|||
{ |
|||
font-size: 100%; |
|||
} |
|||
HR |
|||
{ |
|||
color: #cccccc; |
|||
height: 1px; |
|||
} |
|||
|
|||
|
|||
.groupheading |
|||
{ |
|||
padding-left: 20px; |
|||
padding-top: 40px; |
|||
padding-bottom: 10px; |
|||
font-size: 1.4em; |
|||
color: #0065CF; |
|||
font-family:verdana; |
|||
} |
|||
.GroupTitle |
|||
{ |
|||
padding-left: 20px; |
|||
padding-top: 20px; |
|||
padding-bottom: 10px; |
|||
font-size: 1.4em; |
|||
color: #0065CF; |
|||
} |
|||
LI |
|||
{ |
|||
font-size: 70%; |
|||
font-family: Verdana; |
|||
} |
|||
LI LI |
|||
{ |
|||
font-size: 100%; |
|||
} |
|||
LI A |
|||
{ |
|||
font-size: 100%; |
|||
} |
|||
.linkbox |
|||
{ |
|||
margin-left: 20px; |
|||
margin-right: 30px; |
|||
margin-bottom: 20px; |
|||
padding-bottom: 10px; |
|||
width: 175px; |
|||
float: right; |
|||
border-right: #0066CC 1px solid; |
|||
background: #f1f1f1; |
|||
border-left: #0066CC 1px solid; |
|||
border-bottom: #0066CC 1px solid; |
|||
} |
|||
.outlineDivTitle |
|||
{ |
|||
background-color: #0066CC; |
|||
color: #FFFFFF; |
|||
padding-left: 15px; |
|||
padding-bottom: 2px; |
|||
padding-top: 2px; |
|||
font: bold 70% Verdana; |
|||
color: #ffffff; |
|||
} |
|||
.outlineDiv |
|||
{ |
|||
padding-left: 20px; |
|||
background-image: URL(/images/blueTriangle.gif); |
|||
background-repeat: no-repeat; |
|||
background-position: 6 8; |
|||
font: 70% verdana; |
|||
color: #003399; |
|||
line-height: 200%; |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
#!/bin/sh |
|||
|
|||
# This script is for use with CLIs on Unix, e.g. Mono |
|||
gacutil -i bin/FSharp.Core.dll |
|||
gacutil -i bin/FSharp.Compiler.dll |
|||
gacutil -i bin/FSharp.PowerPack.dll |
|||
|
|||
# Trying to use --aot on Mono does not seem to work correctly, |
|||
# at least on the pre-release of Mono 2.0. |
|||
# On Un*x, it seems to work in the sense that it creates the |
|||
# .so files, but then fsi.exe does not seem to work at all. |
|||
# On Windows, it just does not work. |
|||
# For this reason, it does not seem to be advisable to try to |
|||
# use it. |
|||
#mono --aot bin/FSharp.Core.dll |
|||
#mono --aot bin/FSharp.Compiler.dll |
|||
#mono --aot bin/FSharp.PowerPack.dll |
|||
#mono --aot bin/fsc.exe |
|||
#mono --aot bin/fsi.exe |
|||
@ -1,754 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Diagnostics |
|||
open System.Collections.Generic |
|||
open System.Diagnostics.CodeAnalysis |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
/// Basic operations on arrays |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Array = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length (array: array<_>) = array.Length |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init n f = Microsoft.FSharp.Primitives.Basics.Array.init n f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zeroCreate n = Microsoft.FSharp.Primitives.Basics.Array.zeroCreate n |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let create (n:int) (x:'T) = |
|||
let array = (zeroCreate n : array<'T>) |
|||
for i = 0 to n - 1 do |
|||
array.[i] <- x |
|||
array |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let isEmpty (array: array<'T>) = (array.Length = 0) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let empty<'T> = ([| |] : 'T []) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let blit (array1 : array<'T>) sourceIndex (array2: array<'T>) targetIndex count = |
|||
if sourceIndex < 0 then invalidArg "sourceIndex" "index must be positive" |
|||
if count < 0 then invalidArg "count" "length must be positive" |
|||
if targetIndex < 0 then invalidArg "targetIndex" "index must be positive" |
|||
if sourceIndex + count > array1.Length then invalidArg "sourceIndex" "out of range" |
|||
if targetIndex + count > array2.Length then invalidArg "targetIndex" "out of range" |
|||
for i = 0 to count - 1 do |
|||
array2.[targetIndex+i] <- array1.[sourceIndex + i] |
|||
|
|||
let rec concatAddLengths (arrs:array<'T> array) i acc = |
|||
if i >= arrs.Length then acc |
|||
else concatAddLengths arrs (i+1) (acc + arrs.[i].Length) |
|||
|
|||
let rec concatBlit (arrs:array<array<'T>>) i j (tgt:array<'T>) = |
|||
if i < arrs.Length then |
|||
let h = arrs.[i] |
|||
let len = h.Length in |
|||
for i = 0 to len - 1 do |
|||
tgt.[j+i] <- h.[i] |
|||
concatBlit arrs (i+1) (j+len) tgt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let concatArrays (arrs : array<array<'T>>) = |
|||
let res = zeroCreate (concatAddLengths arrs 0 0) |
|||
concatBlit arrs 0 0 res ; |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let concat (arrs: seq<array<'T>>) = |
|||
let arrs = Seq.to_array arrs in |
|||
concatArrays arrs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let collect (f : 'T -> array<'U>) (input : array<'T>) : array<'U>= |
|||
let inputLength = input.Length |
|||
let result = Array.zeroCreate<array<'U>> inputLength |
|||
for i = 0 to inputLength - 1 do |
|||
result.[i] <- f input.[i] |
|||
concatArrays result |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let append (array1:array<'T>) (array2:array<'T>) = |
|||
let n1 = array1.Length |
|||
let n2 = array2.Length |
|||
let res = zeroCreate (n1 + n2) |
|||
for i = 0 to n1 - 1 do |
|||
res.[i] <- array1.[i] |
|||
for i = 0 to n2 - 1 do |
|||
res.[i+n1] <- array2.[i] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let copy (array: array<'T>) = |
|||
let len = array.Length |
|||
let res = zeroCreate len |
|||
for i = 0 to len - 1 do |
|||
res.[i] <- array.[i] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_list array = Microsoft.FSharp.Primitives.Basics.List.of_array array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_list xs = Microsoft.FSharp.Primitives.Basics.List.to_array xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f (array: array<'T>) = |
|||
let len = array.Length |
|||
for i = 0 to len - 1 do |
|||
f array.[i] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map (f: 'T -> 'U) (array:array<'T>) = |
|||
let len = array.Length |
|||
let res = (zeroCreate len : array<'U>) |
|||
for i = 0 to len - 1 do |
|||
res.[i] <- f array.[i] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter2 f (array1: array<'T>) (array2: array<'U>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths"; |
|||
for i = 0 to len1 - 1 do |
|||
f.Invoke(array1.[i], array2.[i]) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map2 f (array1: array<'T>) (array2: array<'U>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths"; |
|||
let res = zeroCreate len1 |
|||
for i = 0 to len1 - 1 do |
|||
res.[i] <- f.Invoke(array1.[i], array2.[i]) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi2 f (array1: array<'T>) (array2: array<'U>) = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths"; |
|||
let res = zeroCreate len1 |
|||
for i = 0 to len1 - 1 do |
|||
res.[i] <- f.Invoke(i,array1.[i], array2.[i]) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri f (array:array<'T>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let len = array.Length |
|||
for i = 0 to len - 1 do |
|||
f.Invoke(i, array.[i]) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri2 f (array1: array<'T>) (array2: array<'U>) = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths"; |
|||
for i = 0 to len1 - 1 do |
|||
f.Invoke(i,array1.[i], array2.[i]) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi (f : int -> 'T -> 'U) (array: array<'T>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let len = array.Length |
|||
let res = zeroCreate<'U> len |
|||
for i = 0 to len - 1 do |
|||
res.[i] <- f.Invoke(i,array.[i]) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists (f: 'T -> bool) (array:array<'T>) = |
|||
let len = array.Length |
|||
let rec loop i = i < len && (f array.[i] || loop (i+1)) |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists2 f (array1: array<_>) (array2: array<_>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths" |
|||
let rec loop i = i < len1 && (f.Invoke(array1.[i], array2.[i]) || loop (i+1)) |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall (f: 'T -> bool) (array:array<'T>) = |
|||
let len = array.Length |
|||
let rec loop i = i >= len || (f array.[i] && loop (i+1)) |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall2 f (array1: array<_>) (array2: array<_>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths" |
|||
let rec loop i = i >= len1 || (f.Invoke(array1.[i], array2.[i]) && loop (i+1)) |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let pick f (array: array<_>) = |
|||
let rec loop i = |
|||
if i >= array.Length then raise (System.Collections.Generic.KeyNotFoundException()) else |
|||
match f array.[i] with |
|||
| None -> loop(i+1) |
|||
| Some res -> res |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryPick f (array: array<_>) = |
|||
let rec loop i = |
|||
if i >= array.Length then None else |
|||
match f array.[i] with |
|||
| None -> loop(i+1) |
|||
| res -> res |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let choose f (array: array<_>) = |
|||
let res = new System.Collections.Generic.List<_>() // ResizeArray |
|||
for i = 0 to array.Length - 1 do |
|||
match f array.[i] with |
|||
| None -> () |
|||
| Some b -> res.Add(b) |
|||
res.ToArray() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let filter f (array: array<_>) = |
|||
let res = new System.Collections.Generic.List<_>() // ResizeArray |
|||
for i = 0 to array.Length - 1 do |
|||
let x = array.[i] |
|||
if f x then res.Add(x) |
|||
res.ToArray() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition f (array: array<_>) = |
|||
let res1 = new System.Collections.Generic.List<_>() // ResizeArray |
|||
let res2 = new System.Collections.Generic.List<_>() // ResizeArray |
|||
for i = 0 to array.Length - 1 do |
|||
let x = array.[i] |
|||
if f x then res1.Add(x) else res2.Add(x) |
|||
res1.ToArray(), res2.ToArray() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find f (array: array<_>) = |
|||
let rec loop i = |
|||
if i >= array.Length then raise (System.Collections.Generic.KeyNotFoundException()) else |
|||
if f array.[i] then array.[i] else loop (i+1) |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryFind f (array: array<_>) = |
|||
let rec loop i = |
|||
if i >= array.Length then None else |
|||
if f array.[i] then Some array.[i] else loop (i+1) |
|||
loop 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zip (array1: array<_>) (array2: array<_>) = |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths" |
|||
let res = zeroCreate len1 |
|||
for i = 0 to len1 - 1 do |
|||
res.[i] <- (array1.[i],array2.[i]) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zip3 (array1: array<_>) (array2: array<_>) (array3: array<_>) = |
|||
let len1 = array1.Length |
|||
if len1 <> array2.Length then invalidArg "array2" "the arrays have different lengths" |
|||
if len1 <> array3.Length then invalidArg "array3" "the arrays have different lengths" |
|||
let res = zeroCreate len1 |
|||
for i = 0 to len1 - 1 do |
|||
res.[i] <- (array1.[i],array2.[i],array3.[i]) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let unzip (array: array<_>) = |
|||
let len = array.Length |
|||
let res1 = zeroCreate len |
|||
let res2 = zeroCreate len |
|||
for i = 0 to len - 1 do |
|||
let x,y = array.[i] |
|||
res1.[i] <- x; |
|||
res2.[i] <- y; |
|||
res1,res2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let unzip3 (array: array<_>) = |
|||
let len = array.Length |
|||
let res1 = zeroCreate len |
|||
let res2 = zeroCreate len |
|||
let res3 = zeroCreate len |
|||
for i = 0 to len - 1 do |
|||
let x,y,z = array.[i] |
|||
res1.[i] <- x; |
|||
res2.[i] <- y; |
|||
res3.[i] <- z; |
|||
res1,res2,res3 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rev (array: array<_>) = |
|||
let len = array.Length |
|||
let res = zeroCreate len |
|||
for i = 0 to len - 1 do |
|||
res.[(len - i) - 1] <- array.[i] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold (f : 'T -> 'U -> 'T) (acc: 'T) (array:array<'U>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let mutable state = acc |
|||
let len = array.Length |
|||
for i = 0 to len - 1 do |
|||
state <- f.Invoke(state,array.[i]) |
|||
state |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldBack (f : 'T -> 'U -> 'U) (array:array<'T>) (acc: 'U) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let mutable res = acc |
|||
let len = array.Length |
|||
for i = len - 1 downto 0 do |
|||
res <- f.Invoke(array.[i],res) |
|||
res |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldBack2 f (array1:'T1[]) (array2:'T2 []) (acc: 'U) = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
let mutable res = acc |
|||
let len = array1.Length |
|||
if len <> array2.Length then invalidArg "array2" "the arrays have different lengths" |
|||
for i = len - 1 downto 0 do |
|||
res <- f.Invoke(array1.[i],array2.[i],res) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold2 f (acc: 'T) (array1:'T1[]) (array2:'T2 []) = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
let mutable state = acc |
|||
let len = array1.Length |
|||
if len <> array2.Length then invalidArg "array2" "the arrays have different lengths" |
|||
for i = 0 to len - 1 do |
|||
state <- f.Invoke(state,array1.[i],array2.[i]) |
|||
state |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldSubLeft f acc (array : array<_>) start fin = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let mutable res = acc |
|||
for i = start to fin do |
|||
res <- f.Invoke(res,array.[i]) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldSubRight f (array : array<_>) start fin acc = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let mutable res = acc |
|||
for i = fin downto start do |
|||
res <- f.Invoke(array.[i],res) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scanSubRight f (array : array<_>) start fin initState = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let mutable state = initState |
|||
let res = create (2+fin-start) initState |
|||
for i = fin downto start do |
|||
state <- f.Invoke(array.[i],state); |
|||
res.[i - start] <- state |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scanSubLeft f initState (array : array<_>) start fin = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let mutable state = initState |
|||
let res = create (2+fin-start) initState |
|||
for i = start to fin do |
|||
state <- f.Invoke(state,array.[i]); |
|||
res.[i - start+1] <- state |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan f acc (array : array<_>) = |
|||
let arrn = array.Length |
|||
scanSubLeft f acc array 0 (arrn - 1) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scanBack f (array : array<_>) acc = |
|||
let arrn = array.Length |
|||
scanSubRight f array 0 (arrn - 1) acc |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduce f (array : array<_>) = |
|||
let arrn = array.Length |
|||
if arrn = 0 then invalidArg "array" "the input array may not be empty" |
|||
else foldSubLeft f array.[0] array 1 (arrn - 1) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduceBack f (array : array<_>) = |
|||
let arrn = array.Length |
|||
if arrn = 0 then invalidArg "array" "the input array may not be empty" |
|||
else foldSubRight f array 0 (arrn - 2) array.[arrn - 1] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortInPlaceWith f (array : array<'T>) = |
|||
let len = array.Length |
|||
if len < 2 then () |
|||
elif len = 2 then |
|||
let c = f array.[0] array.[1] |
|||
if c > 0 then |
|||
let tmp = array.[0] |
|||
array.[0] <- array.[1]; |
|||
array.[1] <- tmp |
|||
else |
|||
System.Array.Sort(array, ComparisonIdentity.FromFunction(f)) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortInPlaceBy (f: 'T -> 'U) (array : array<'T>) = |
|||
let len = array.Length |
|||
if len < 2 then () |
|||
elif len = 2 then |
|||
let c = Operators.compare (f array.[0]) (f array.[1]) |
|||
if c > 0 then |
|||
let tmp = array.[0] |
|||
array.[0] <- array.[1]; |
|||
array.[1] <- tmp |
|||
else |
|||
System.Array.Sort(array, ComparisonIdentity.FromFunction(fun x y -> Operators.compare (f x) (f y))) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortWith (f: 'T -> 'T -> int) (array : array<'T>) = |
|||
let array = copy array |
|||
sortInPlaceWith f array; |
|||
array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortBy f array = |
|||
let array = copy array |
|||
sortInPlaceBy f array; |
|||
array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sort array = |
|||
sortWith Operators.compare array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortInPlace array = |
|||
sortInPlaceWith Operators.compare array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_seq a = Seq.of_array a |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_seq ie = Seq.to_array ie |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let findIndex f (array : array<_>) = |
|||
let len = array.Length |
|||
let rec go n = if n >= len then raise (System.Collections.Generic.KeyNotFoundException()) elif f array.[n] then n else go (n+1) |
|||
go 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryFindIndex f (array : array<_>) = |
|||
let len = array.Length |
|||
let rec go n = if n >= len then None elif f array.[n] then Some n else go (n+1) |
|||
go 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let permute p (array : array<_>) = Microsoft.FSharp.Primitives.Basics.Array.permute p array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline sum (array:array< (^T) >) : ^T = |
|||
let mutable acc = LanguagePrimitives.GenericZero< (^T) > |
|||
for i = 0 to array.Length - 1 do |
|||
acc <- Checked.(+) acc array.[i] |
|||
acc |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline sumBy (f: 'T -> ^U) (array:array<'T>) : ^U = |
|||
let mutable acc = LanguagePrimitives.GenericZero< (^U) > |
|||
for i = 0 to array.Length - 1 do |
|||
acc <- Checked.(+) acc (f array.[i]) |
|||
acc |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let min (array:array<_>) = |
|||
if array.Length = 0 then invalidArg "array" "the array is empty" |
|||
let mutable acc = array.[0] |
|||
for i = 1 to array.Length - 1 do |
|||
acc <- Operators.min acc array.[i] |
|||
acc |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let minBy f (array:array<_>) = |
|||
if array.Length = 0 then invalidArg "array" "the array is empty" |
|||
let mutable acc = f array.[0] |
|||
let mutable acc_v = array.[0] |
|||
for i = 1 to array.Length - 1 do |
|||
let cur = f array.[i] |
|||
if cur < acc then |
|||
acc <- cur |
|||
acc_v <- array.[i] |
|||
acc_v |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let max (array:array<_>) = |
|||
if array.Length = 0 then invalidArg "array" "the array is empty" |
|||
let mutable acc = array.[0] |
|||
for i = 1 to array.Length - 1 do |
|||
acc <- Operators.max acc array.[i] |
|||
acc |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let maxBy f (array:array<_>) = |
|||
if array.Length = 0 then invalidArg "array" "the array is empty" |
|||
let mutable acc = f array.[0] |
|||
let mutable acc_v = array.[0] |
|||
for i = 1 to array.Length - 1 do |
|||
let cur = f array.[i] |
|||
if cur > acc then |
|||
acc <- cur |
|||
acc_v <- array.[i] |
|||
acc_v |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline average (array:array<_>) = Seq.average array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline averageBy f (array:array<_>) = Seq.averageBy f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sub (array:array<'T>) (startIndex:int) (count:int) = |
|||
if startIndex < 0 then invalidArg "startIndex" "index must be positive" |
|||
if count < 0 then invalidArg "count" "length must be positive" |
|||
if startIndex + count > array.Length then invalidArg "count" "out of range" |
|||
|
|||
let res = (zeroCreate count : array<'T>) |
|||
for i = 0 to count - 1 do |
|||
res.[i] <- array.[startIndex + i] |
|||
res |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let is_empty array = isEmpty array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let get (array:array<_>) n = array.[n] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let set (array:array<_>) n v = array.[n] <- v |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zero_create n = Array.zeroCreate n |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fill (array:array<'T>) (startIndex:int) (count:int) (x:'T) = |
|||
if startIndex < 0 then invalidArg "startIndex" "index must be positive" |
|||
if count < 0 then invalidArg "count" "length must be positive" |
|||
for i = startIndex to startIndex + count - 1 do |
|||
array.[i] <- x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left f z array = fold f z array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right f array z = foldBack f array z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left2 f z array1 array2 = fold2 f z array1 array2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right2 f array1 array2 z = foldBack2 f array1 array2 z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduce_left f array = reduce f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduce_right f array = reduceBack f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan_left f z array = scan f z array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan_right f array z = scanBack f array z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all f array = forall f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all2 f array1 array2 = forall2 f array1 array2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind f array = tryFind f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find_index f array = findIndex f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind_index f array = tryFindIndex f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let first f array = tryPick f array |
|||
|
|||
(* |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sort f array = sortInPlaceWith f array |
|||
*) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sort_by f array = sortInPlaceBy f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline sum_by f array = sumBy f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline average_by f array = averageBy f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let min_by f array = minBy f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let max_by f array = maxBy f array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find_indexi f (array : array<_>) = |
|||
let len = array.Length |
|||
let rec go n = if n >= len then raise (System.Collections.Generic.KeyNotFoundException()) elif f n array.[n] then n else go (n+1) |
|||
go 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind_indexi f (array : array<_>) = |
|||
let len = array.Length |
|||
let rec go n = if n >= len then None elif f n array.[n] then Some n else go (n+1) |
|||
go 0 |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let split array = unzip array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let combine array1 array2 = zip array1 array2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let make (n:int) (x:'T) = create n x |
|||
|
|||
#if FX_ATLEAST_40 |
|||
module Parallel = |
|||
open System.Threading |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let choose f (c: array<'T>) = |
|||
let inputLength = c.Length |
|||
let lastInputIndex = inputLength - 1 |
|||
|
|||
let isChosen = zeroCreate<bool> inputLength |
|||
let results = zeroCreate<'U> inputLength |
|||
|
|||
Parallel.For(0, inputLength, (fun i -> |
|||
match f c.[i] with |
|||
| None -> () |
|||
| Some v -> |
|||
isChosen.[i] <- true; |
|||
results.[i] <- v |
|||
)) |> ignore |
|||
|
|||
let mutable outputLength = 0 |
|||
for i = 0 to lastInputIndex do |
|||
if isChosen.[i] then |
|||
outputLength <- outputLength + 1 |
|||
|
|||
let output = zeroCreate<'U> outputLength |
|||
let mutable curr = 0 |
|||
for i = 0 to lastInputIndex do |
|||
if isChosen.[i] then |
|||
output.[curr] <- results.[i] |
|||
curr <- curr + 1 |
|||
output |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let collect (f : 'T -> array<'U>) (input : array<'T>) : array<'U>= |
|||
let inputLength = input.Length |
|||
let result = zeroCreate<array<'U>> inputLength |
|||
Parallel.For(0, inputLength, |
|||
(fun i -> result.[i] <- f input.[i])) |> ignore |
|||
concatArrays result |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map (f: 'T -> 'U) (input : array<'T>) : array<'U>= |
|||
let inputLength = input.Length |
|||
let result = zeroCreate<'U> inputLength |
|||
Parallel.For(0, inputLength, fun i -> |
|||
result.[i] <- f input.[i]) |> ignore |
|||
result |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi f (input: array<'T>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let inputLength = input.Length |
|||
let result = zeroCreate inputLength |
|||
Parallel.For(0, inputLength, fun i -> |
|||
result.[i] <- f.Invoke (i, input.[i])) |> ignore |
|||
result |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f (input : array<'T>) = |
|||
Parallel.For (0, input.Length, fun i -> f input.[i]) |> ignore |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri f (input : array<'T>) = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
Parallel.For (0, input.Length, fun i -> f.Invoke(i, input.[i])) |> ignore |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init count f = |
|||
let result = zeroCreate count |
|||
Parallel.For (0, count, fun i -> result.[i] <- f i) |> ignore |
|||
result |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition predicate (array : array<'T>) = |
|||
let inputLength = array.Length |
|||
let lastInputIndex = inputLength - 1 |
|||
|
|||
let isTrue = zeroCreate<bool> inputLength |
|||
Parallel.For(0, inputLength, |
|||
fun i -> isTrue.[i] <- predicate array.[i] |
|||
) |> ignore |
|||
|
|||
let mutable trueLength = 0 |
|||
for i in 0 .. lastInputIndex do |
|||
if isTrue.[i] then trueLength <- trueLength + 1 |
|||
|
|||
let trueResult = zeroCreate<'T> trueLength |
|||
let falseResult = zeroCreate<'T> (inputLength - trueLength) |
|||
let mutable iTrue = 0 |
|||
let mutable iFalse = 0 |
|||
for i = 0 to lastInputIndex do |
|||
if isTrue.[i] then |
|||
trueResult.[iTrue] <- array.[i] |
|||
iTrue <- iTrue + 1 |
|||
else |
|||
falseResult.[iFalse] <- array.[i] |
|||
iFalse <- iFalse + 1 |
|||
|
|||
(trueResult, falseResult) |
|||
#endif |
|||
@ -1,463 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open System.Collections.Generic |
|||
|
|||
/// Basic operations on arrays |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Array = |
|||
|
|||
/// Build a new array that contains the elements of the first array followed by the elements of the second array |
|||
val append: array1:array<'T> -> array2:array<'T> -> array<'T> |
|||
|
|||
/// Return the average of the elements in the array. If the array is empty an ArgumentException is thrown. |
|||
val inline average : array:^T array -> ^T |
|||
when ^T : (static member ( + ) : ^T * ^T -> ^T) |
|||
and ^T : (static member DivideByInt : ^T*int -> ^T) |
|||
and ^T : (static member Zero : ^T) |
|||
|
|||
|
|||
/// Return the average of the elements generated by applying the function to each element of the array. |
|||
/// If the array is empty an ArgumentException is thrown. |
|||
val inline averageBy : projection:('T -> ^U) -> array:array<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member DivideByInt : ^U*int -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
/// Read a range of elements from the first array and write them into the second. |
|||
val blit: source:array<'T> -> sourceIndex:int -> target:array<'T> -> targetIndex:int -> count:int -> unit |
|||
|
|||
/// For each element of the array, apply the given function. Concatenate all the results and return the combined array. |
|||
val collect : mapping:('T -> array<'U>) -> array:array<'T> -> array<'U> |
|||
|
|||
/// Build a new array that contains the elements of each of the given sequence of arrays |
|||
val concat: arrays:seq<array<'T>> -> array<'T> |
|||
|
|||
/// Build a new array that contains the elements of the given array |
|||
val copy: array:array<'T> -> array<'T> |
|||
|
|||
/// Create an array whose elements are all initially the given value. |
|||
val create: count:int -> value:'T -> array<'T> |
|||
|
|||
/// Apply the given function to successive elements, returning the first |
|||
/// result where function returns <c>Some(x)</c> for some <c>x</c>. If the function |
|||
/// never returns <c>Some(x)</c> then <c>None</c> is returned. |
|||
val tryPick: chooser:('T -> 'U option) -> array:array<'T> -> 'U option |
|||
|
|||
/// Fill a range of elements of the array with the given value. |
|||
val fill: target:array<'T> -> targetIndex:int -> count:int -> value:'T -> unit |
|||
|
|||
/// Apply the given function to successive elements, returning the first |
|||
/// result where function returns <c>Some(x)</c> for some <c>x</c>. If the function |
|||
/// never returns <c>Some(x)</c> then <c>KeyNotFoundException</c> is raised. |
|||
val pick: chooser:('T -> 'U option) -> array:array<'T> -> 'U |
|||
|
|||
/// Apply the given function to each element of the array. Return |
|||
/// the array comprised of the results "x" for each element where |
|||
/// the function returns Some(x) |
|||
val choose: chooser:('T -> 'U option) -> array:array<'T> -> 'U array |
|||
|
|||
/// Return an empty array of the given type |
|||
[<GeneralizableValue>] |
|||
val empty<'T> : array<'T> |
|||
|
|||
/// Test if any element of the array satisfies the given predicate. |
|||
/// |
|||
/// The predicate is applied to the elements of the input array. If any application |
|||
/// returns true then the overall result is true and no further elements are tested. |
|||
/// Otherwise, false is returned. |
|||
val exists: predicate:('T -> bool) -> array:array<'T> -> bool |
|||
|
|||
/// Test if any pair of corresponding elements of the arrays satisfies the given predicate. |
|||
/// |
|||
/// The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
/// two lengths of the collections. If any application returns true then the overall result is |
|||
/// true and no further elements are tested. Otherwise, if one collections is longer |
|||
/// than the other then the <c>ArgumentException</c> exception is raised. |
|||
/// Otherwise, false is returned. |
|||
val exists2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1 array -> array2:'T2 array -> bool |
|||
|
|||
/// Return a new collection containing only the elements of the collection |
|||
/// for which the given predicate returns "true" |
|||
val filter: predicate:('T -> bool) -> array:array<'T> -> array<'T> |
|||
|
|||
/// Return the first element for which the given function returns 'true'. |
|||
/// Raise <c>KeyNotFoundException</c> if no such element exists. |
|||
val find: predicate:('T -> bool) -> array:array<'T> -> 'T |
|||
|
|||
/// Return the index of the first element in the array |
|||
/// that satisfies the given predicate. Raise <c>KeyNotFoundException</c> if |
|||
/// none of the elements satisy the predicate. |
|||
val findIndex: predicate:('T -> bool) -> array:array<'T> -> int |
|||
|
|||
/// Test if all elements of the array satisfy the given predicate. |
|||
/// |
|||
/// The predicate is applied to the elements of the input collection. If any application |
|||
/// returns false then the overall result is false and no further elements are tested. |
|||
/// Otherwise, true is returned. |
|||
val forall: predicate:('T -> bool) -> array:array<'T> -> bool |
|||
|
|||
|
|||
/// Test if all corresponding elements of the array satisfy the given predicate pairwise. |
|||
/// |
|||
/// The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
/// two lengths of the collections. If any application returns false then the overall result is |
|||
/// false and no further elements are tested. Otherwise, if one collection is longer |
|||
/// than the other then the <c>ArgumentException</c> exception is raised. |
|||
/// Otherwise, true is returned. |
|||
val forall2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1 array -> array2:'T2 array -> bool |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then computes |
|||
/// <c>f (... (f s i0)...) iN</c> |
|||
val fold: folder:('State -> 'T -> 'State) -> state:'State -> array: array<'T> -> 'State |
|||
|
|||
/// Apply a function to each element of the array, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then computes |
|||
/// <c>f i0 (...(f iN s))</c> |
|||
val foldBack: folder:('T -> 'State -> 'State) -> array:array<'T> -> state:'State -> 'State |
|||
|
|||
/// Apply a function to pairs of elements drawn from the two collections, |
|||
/// left-to-right, threading an accumulator argument |
|||
/// through the computation. The two input |
|||
/// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val fold2: folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> array1:'T1 array -> array2:'T2 array -> 'State |
|||
|
|||
/// Apply a function to pairs of elements drawn from the two collections, right-to-left, |
|||
/// threading an accumulator argument through the computation. The two input |
|||
/// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val foldBack2: folder:('T1 -> 'T2 -> 'State -> 'State) -> array1:'T1 array -> array2:'T2 array -> state:'State -> 'State |
|||
|
|||
/// Get an element from an array |
|||
val get: array:array<'T> -> index:int -> 'T |
|||
|
|||
/// Create an array given the dimension and a generator function to compute the elements. |
|||
val init: count:int -> initializer:(int -> 'T) -> array<'T> |
|||
|
|||
/// Create an array where the entries are initially the default value Unchecked.defaultof<'T>. |
|||
val zeroCreate: count:int -> array<'T> |
|||
|
|||
/// Return true if the given array is empty, otherwise false |
|||
val isEmpty: array:array<'T> -> bool |
|||
|
|||
/// Apply the given function to each element of the array. |
|||
val iter: action:('T -> unit) -> array:array<'T> -> unit |
|||
|
|||
/// Apply the given function to pair of elements drawn from matching indices in two arrays. The |
|||
/// two arrays must have the same lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val iter2: action:('T1 -> 'T2 -> unit) -> array1:'T1 array -> array2:'T2 array -> unit |
|||
|
|||
/// Apply the given function to each element of the array. The integer passed to the |
|||
/// function indicates the index of element. |
|||
val iteri: action:(int -> 'T -> unit) -> array:array<'T> -> unit |
|||
|
|||
/// Apply the given function to pair of elements drawn from matching indices in two arrays, |
|||
/// also passing the index of the elements. The two arrays must have the same lengths, |
|||
/// otherwise an <c>ArgumentException</c> is raised. |
|||
val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> array1:'T1 array -> array2:'T2 array -> unit |
|||
|
|||
/// Return the length of an array. You can also use property arr.Length. |
|||
val length: array:array<'T> -> int |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. |
|||
val map: mapping:('T -> 'U) -> array:array<'T> -> 'U array |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to the corresponding elements of the two collections pairwise. The two input |
|||
/// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val map2: mapping:('T1 -> 'T2 -> 'U) -> array1:'T1 array -> array2:'T2 array -> 'U array |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to the corresponding elements of the two collections pairwise, also passing the index of |
|||
/// the elements. The two input arrays must have the same lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> array1:'T1 array -> array2:'T2 array -> 'U array |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. The integer index passed to the |
|||
/// function indicates the index of element being transformed. |
|||
val mapi: mapping:(int -> 'T -> 'U) -> array:array<'T> -> 'U array |
|||
|
|||
/// Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
val max : array:array<'T> -> 'T |
|||
|
|||
/// Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
val maxBy : projection:('T -> 'U) -> array:array<'T> -> 'T |
|||
|
|||
/// Return the lowest of all elements of the array, compared via Operators.min |
|||
val min : array:array<'T> -> 'T |
|||
|
|||
/// Return the lowest of all elements of the array, compared via Operators.min on the function result |
|||
val minBy : projection:('T -> 'U) -> array:array<'T> -> 'T |
|||
|
|||
/// Build an array from the given list |
|||
val of_list: elements:'T list -> array<'T> |
|||
|
|||
/// Build a new array from the given enumerable object |
|||
val of_seq: elements:seq<'T> -> array<'T> |
|||
|
|||
/// Split the collection into two collections, containing the |
|||
/// elements for which the given predicate returns "true" and "false" |
|||
/// respectively |
|||
val partition: predicate:('T -> bool) -> array:array<'T> -> array<'T> * array<'T> |
|||
|
|||
/// Returns an array with all elements permuted according to the |
|||
/// specified permutation |
|||
val permute : indexMap:(int -> int) -> array:array<'T> -> array<'T> |
|||
|
|||
/// Apply a function to each element of the array, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> |
|||
/// then computes <c>f (... (f i0 i1)...) iN</c>. |
|||
/// Raises ArgumentException if the array has size zero. |
|||
val reduce: reduction:('T -> 'T -> 'T) -> array:array<'T> -> 'T |
|||
|
|||
/// Apply a function to each element of the array, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> |
|||
/// then computes <c>f i0 (...(f iN-1 iN))</c>. |
|||
/// Raises ArgumentException if the array has size zero. |
|||
val reduceBack: reduction:('T -> 'T -> 'T) -> array:array<'T> -> 'T |
|||
|
|||
/// Return a new array with the elements in reverse order |
|||
val rev: array:array<'T> -> array<'T> |
|||
|
|||
/// Like <c>fold_left</c>, but return the intermediary and final results |
|||
val scan : folder:('State -> 'T -> 'State) -> state:'State -> array:array<'T> -> 'State array |
|||
|
|||
/// Like <c>fold_right</c>, but return both the intermediary and final results |
|||
val scanBack : folder:('T -> 'State -> 'State) -> array:array<'T> -> state:'State -> 'State array |
|||
|
|||
/// Set an element of an array |
|||
val set: array:array<'T> -> index:int -> value:'T -> unit |
|||
|
|||
/// Build a new array that contains the given subrange specified by |
|||
/// starting index and length. |
|||
val sub: array:array<'T> -> startIndex:int -> count:int -> array<'T> |
|||
|
|||
/// Sort the elements of an array, returning a new array. Elements are compared using Operators.compare. |
|||
val sort: array:array<'T> -> array<'T> |
|||
|
|||
/// Sort the elements of an array, using the given projection for the keys and returning a new array. Elements are compared using Operators.compare. |
|||
val sortBy: projection:('T -> 'U) -> array:array<'T> -> array<'T> |
|||
|
|||
/// Sort the elements of an array, using the given comparison function as the order, returning a new array |
|||
val sortWith: comparer:('T -> 'T -> int) -> array:array<'T> -> array<'T> |
|||
|
|||
/// Sort the elements of an array by mutating the array in-place, using the given projection for the keys. Elements are compared using Operators.compare. |
|||
val sortInPlaceBy: projection:('T -> 'U) -> array:array<'T> -> unit |
|||
|
|||
|
|||
/// Sort the elements of an array by mutating the array in-place, using the given comparison function as the order |
|||
val sortInPlaceWith: comparer:('T -> 'T -> int) -> array:array<'T> -> unit |
|||
|
|||
/// Sort the elements of an array by mutating the array in-place, using the given comparison function. Elements are compared using Operators.compare. |
|||
val sortInPlace: array:array<'T> -> unit |
|||
|
|||
/// Return the sum of the elements in the array |
|||
val inline sum : array: ^T array -> ^T |
|||
when ^T : (static member ( + ) : ^T * ^T -> ^T) |
|||
and ^T : (static member Zero : ^T) |
|||
|
|||
|
|||
/// Return the sum of the results generated by applying the function to each element of the array. |
|||
val inline sumBy : projection:('T -> ^U) -> array:array<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
/// Build a list from the given array |
|||
val to_list: array:array<'T> -> 'T list |
|||
|
|||
/// View the given array as a sequence |
|||
val to_seq: array:array<'T> -> seq<'T> |
|||
|
|||
/// Return the first element for which the given function returns <c>true</c>. |
|||
/// Return <c>None</c> if no such element exists. |
|||
val tryFind: predicate:('T -> bool) -> array:array<'T> -> 'T option |
|||
|
|||
/// Return the index of the first element in the array |
|||
/// that satisfies the given predicate. |
|||
val tryFindIndex : predicate:('T -> bool) -> array:array<'T> -> int option |
|||
|
|||
/// Split an array of pairs into two arrays |
|||
val unzip: array:('T1 * 'T2) array -> ('T1 array * 'T2 array) |
|||
|
|||
/// Split an array of triples into three arrays |
|||
val unzip3: array:('T1 * 'T2 * 'T3) array -> ('T1 array * 'T2 array * 'T3 array) |
|||
|
|||
/// Combine the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val zip: array1:'T1 array -> array2:'T2 array -> ('T1 * 'T2) array |
|||
|
|||
/// Combine three arrays into an array of pairs. The three arrays must have equal lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
val zip3: array1:'T1 array -> array2:'T2 array -> array3:'T3 array -> ('T1 * 'T2 * 'T3) array |
|||
|
|||
#if FX_ATLEAST_40 |
|||
/// Provides parallel operations on arrays |
|||
module Parallel = |
|||
|
|||
/// Apply the given function to each element of the array. Return |
|||
/// the array comprised of the results "x" for each element where |
|||
/// the function returns Some(x). |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to elements of the input array is not specified. |
|||
val choose: chooser:('T -> 'U option) -> array:'T array -> 'U array |
|||
|
|||
/// For each element of the array, apply the given function. Concatenate all the results and return the combined array. |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to elements of the input array is not specified. |
|||
val collect : mapping:('T -> array<'U>) -> array:array<'T> -> array<'U> |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to elements of the input array is not specified. |
|||
val map : mapping:('T -> 'U) -> array:array<'T> -> array<'U> |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. The integer index passed to the |
|||
/// function indicates the index of element being transformed. |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to elements of the input array is not specified. |
|||
val mapi: mapping:(int -> 'T -> 'U) -> array:'T array -> 'U array |
|||
|
|||
/// Apply the given function to each element of the array. |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to elements of the input array is not specified. |
|||
val iter : action:('T -> unit) -> array:array<'T> -> unit |
|||
|
|||
/// Apply the given function to each element of the array. The integer passed to the |
|||
/// function indicates the index of element. |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to elements of the input array is not specified. |
|||
val iteri: action:(int -> 'T -> unit) -> array:'T array -> unit |
|||
|
|||
/// Create an array given the dimension and a generator function to compute the elements. |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to indicies is not specified. |
|||
val init : count:int -> initializer:(int -> 'T) -> array<'T> |
|||
|
|||
/// Split the collection into two collections, containing the |
|||
/// elements for which the given predicate returns "true" and "false" |
|||
/// respectively |
|||
/// |
|||
/// Performs the operation in parallel using System.Threading.Parallel.For. |
|||
/// The order in which the given function is applied to indicies is not specified. |
|||
val partition : predicate:('T -> bool) -> array:array<'T> -> array<'T> * array<'T> |
|||
#endif |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'zip' instead")>] |
|||
val combine: array1:'T1 array -> array2:'T2 array -> ('T1 * 'T2) array |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'unzip' instead")>] |
|||
val split: array:('T1 * 'T2) array -> ('T1 array * 'T2 array) |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'averageBy' instead")>] |
|||
val inline average_by : projection:('T -> ^U) -> array:array<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member DivideByInt : ^U*int -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'findIndex' instead")>] |
|||
val find_index: predicate:('T -> bool) -> array:array<'T> -> int |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:('T -> bool) -> array:array<'T> -> bool |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'create' instead")>] |
|||
val make: count:int -> value:'T -> array<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryPick' instead")>] |
|||
val first: chooser:('T -> 'U option) -> array:array<'T> -> 'U option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall2' instead")>] |
|||
val for_all2: predicate:('T1 -> 'T2 -> bool) -> array1:'T1 array -> array2:'T2 array -> bool |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> array: array<'T> -> 'State |
|||
|
|||
/// Apply a function to each element of the array, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> |
|||
/// then computes <c>f i0 (...(f iN s))</c> |
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right: folder:('T -> 'State -> 'State) -> array:array<'T> -> state:'State -> 'State |
|||
|
|||
/// Apply a function to pairs of elements drawn from the two collections, |
|||
/// left-to-right, threading an accumulator argument |
|||
/// through the computation. The two input |
|||
/// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is |
|||
/// raised. |
|||
[<Obsolete("This F# library function has been renamed. Use 'fold2' instead")>] |
|||
val fold_left2: folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> array1:'T1 array -> array2:'T2 array -> 'State |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'foldBack2' instead")>] |
|||
val fold_right2: folder:('T1 -> 'T2 -> 'State -> 'State) -> array1:'T1 array -> array2:'T2 array -> state:'State -> 'State |
|||
|
|||
/// Create an array where the entries are initially the default value Unchecked.defaultof<'T>. |
|||
[<Obsolete("This F# library function has been renamed. Use 'zeroCreate' instead")>] |
|||
val zero_create: count:int -> array<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'isEmpty' instead")>] |
|||
val is_empty: array:array<'T> -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'maxBy' instead")>] |
|||
val max_by : projection:('T -> 'U) -> array:array<'T> -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'minBy' instead")>] |
|||
val min_by : projection:('T -> 'U) -> array:array<'T> -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'reduce' instead")>] |
|||
val reduce_left: reduction:('T -> 'T -> 'T) -> array:array<'T> -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'reduceBack' instead")>] |
|||
val reduce_right: reduction:('T -> 'T -> 'T) -> array:array<'T> -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'scan' instead")>] |
|||
val scan_left : folder:('State -> 'T -> 'State) -> state:'State -> array:array<'T> -> 'State array |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'scanBack' instead")>] |
|||
val scan_right : folder:('T -> 'State -> 'State) -> array:array<'T> -> state:'State -> 'State array |
|||
|
|||
/// Sort the elements of an array, using the given projection for the keys. Elements are compared using Operators.compare. |
|||
[<Obsolete("This F# library function has been renamed. Use 'sortInPlaceBy' instead")>] |
|||
val sort_by: projection:('T -> 'U) -> array:array<'T> -> unit |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'sumBy' instead")>] |
|||
val inline sum_by : projection:('T -> ^U) -> array:array<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFind' instead")>] |
|||
val tryfind: predicate:('T -> bool) -> array:array<'T> -> 'T option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFindIndex' instead")>] |
|||
val tryfind_index: predicate:('T -> bool) -> array:array<'T> -> int option |
|||
|
|||
[<Obsolete("This function will be removed from the F# library. Replacement functions 'tryPick' and 'tryFindIndex' are now provided")>] |
|||
val tryfind_indexi: predicate:(int -> 'T -> bool) -> array:array<'T> -> int option |
|||
|
|||
[<Obsolete("This function will be removed from the F# library. Replacement functions 'pick' and 'findIndex' are now provided")>] |
|||
val find_indexi: predicate:(int -> 'T -> bool) -> array:array<'T> -> int |
|||
|
|||
#endif |
|||
@ -1,160 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System.Diagnostics |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Array2D = |
|||
|
|||
// Define the primitive operations. |
|||
// Note: the "type" syntax is for the type parameter for inline |
|||
// polymorphic IL. This helps the compiler inline these fragments, |
|||
// i.e. work out the correspondence between IL and F# type variables. |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length1 (arr: 'a[,]) = (# "ldlen.multi 2 0" arr : int #) |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length2 (arr: 'a[,]) = (# "ldlen.multi 2 1" arr : int #) |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let base1 (arr: 'a[,]) = arr.GetLowerBound(0) |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let base2 (arr: 'a[,]) = arr.GetLowerBound(1) |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let get (arr: 'a[,]) (n:int) (m:int) = (# "ldelem.multi 2 !0" type ('a) arr n m : 'a #) |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let set (arr: 'a[,]) (n:int) (m:int) (x:'a) = (# "stelem.multi 2 !0" type ('a) arr n m x #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zeroCreate (n:int) (m:int) = (# "newarr.multi 2 !0" type ('a) n m : 'a[,] #) |
|||
|
|||
let zeroCreateBased (b1:int) (b2:int) (n1:int) (n2:int) = |
|||
if (b1 = 0 && b2 = 0) then |
|||
// Note: this overload is available on Compact Framework and Silverlight |
|||
(System.Array.CreateInstance(typeof<'a>, [|n1;n2|]) :?> 'a[,]) |
|||
else |
|||
#if FX_NO_BASED_ARRAYS |
|||
raise (new System.NotSupportedException("arrays with non-zero base may not be created on this platform")) |
|||
#else |
|||
(System.Array.CreateInstance(typeof<'a>, [|n1;n2|],[|b1;b2|]) :?> 'a[,]) |
|||
#endif |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zero_create_based b1 b2 n1 n2 = zeroCreateBased b1 b2 n1 n2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let createBased b1 b2 n m (x:'a) = |
|||
let arr = (zeroCreateBased b1 b2 n m : 'a[,]) |
|||
for i = b1 to b1+n - 1 do |
|||
for j = b2 to b2+m - 1 do |
|||
arr.[i,j] <- x |
|||
arr |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let initBased b1 b2 n m f = |
|||
let arr = (zeroCreateBased b1 b2 n m : 'a[,]) |
|||
for i = b1 to b1+n - 1 do |
|||
for j = b2 to b2+m - 1 do |
|||
arr.[i,j] <- f i j |
|||
arr |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let create n m (x:'a) = |
|||
createBased 0 0 n m x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init n m f = |
|||
initBased 0 0 n m f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f arr = |
|||
let count1 = length1 arr |
|||
let count2 = length2 arr |
|||
let b1 = base1 arr |
|||
let b2 = base2 arr |
|||
for i = b1 to b1+count1 - 1 do |
|||
for j = b1 to b2+count2 - 1 do |
|||
f arr.[i,j] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri (f : int -> int -> 'a -> unit) (arr:'a[,]) = |
|||
let count1 = length1 arr |
|||
let count2 = length2 arr |
|||
let b1 = base1 arr |
|||
let b2 = base2 arr |
|||
for i = b1 to b1+count1 - 1 do |
|||
for j = b1 to b2+count2 - 1 do |
|||
f i j arr.[i,j] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f arr = |
|||
initBased (base1 arr) (base2 arr) (length1 arr) (length2 arr) (fun i j -> f arr.[i,j]) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi f arr = |
|||
initBased (base1 arr) (base2 arr) (length1 arr) (length2 arr) (fun i j -> f i j arr.[i,j]) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let copy arr = |
|||
initBased (base1 arr) (base2 arr) (length1 arr) (length2 arr) (fun i j -> arr.[i,j]) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rebase arr = |
|||
let b1 = base1 arr |
|||
let b2 = base2 arr |
|||
init (length1 arr) (length2 arr) (fun i j -> arr.[b1+i,b2+j]) |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let copyTo(source: 'a[,],sourceIndex1,sourceIndex2,target: 'a[,],targetIndex1,targetIndex2,count1,count2) = |
|||
if sourceIndex1 < 0 then invalidArg "sourceIndex1" "index must be positive" |
|||
if sourceIndex2 < 0 then invalidArg "sourceIndex2" "index must be positive" |
|||
if targetIndex1 < 0 then invalidArg "targetIndex1" "index must be positive" |
|||
if targetIndex2 < 0 then invalidArg "targetIndex2" "index must be positive" |
|||
if sourceIndex1 + count1 > length1 source then invalidArg "count1" "out of range" |
|||
if sourceIndex2 + count2 > length2 source then invalidArg "count2" "out of range" |
|||
if targetIndex1 + count1 > length1 target then invalidArg "count1" "out of range" |
|||
if targetIndex2 + count2 > length2 target then invalidArg "count2" "out of range" |
|||
|
|||
for i = 0 to count1 - 1 do |
|||
for j = 0 to count2 - 1 do |
|||
target.[targetIndex1+i,targetIndex2+j] <- source.[sourceIndex1+i,sourceIndex2+j] |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zero_create count1 count2 = zeroCreate count1 count2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let create_based base1 base2 count1 count2 initial = createBased base1 base2 count1 count2 initial |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init_based base1 base2 count1 count2 f = initBased base1 base2 count1 count2 f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sub (source : 'a[,]) sourceIndex1 sourceIndex2 count1 count2 = |
|||
if sourceIndex1 < 0 then invalidArg "sourceIndex1" "index must be positive" |
|||
if sourceIndex2 < 0 then invalidArg "sourceIndex2" "index must be positive" |
|||
if count1 < 0 then invalidArg "count1" "length must be positive" |
|||
if count2 < 0 then invalidArg "count2" "length must be positive" |
|||
if sourceIndex1 + count1 > length1 source then invalidArg "count1" "out of range" |
|||
if sourceIndex2 + count2 > length2 source then invalidArg "count2" "out of range" |
|||
|
|||
let res = zeroCreate count1 count2 |
|||
for i = 0 to count1 - 1 do |
|||
for j = 0 to count2 - 1 do |
|||
res.[i,j] <- source.[sourceIndex1 + i,sourceIndex2 + j] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let blit (source : 'a[,]) sourceIndex1 sourceIndex2 target targetIndex1 targetIndex2 count1 count2 = |
|||
copyTo(source,sourceIndex1,sourceIndex2,target,targetIndex1,targetIndex2,count1,count2) |
|||
|
|||
@ -1,121 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
/// Basic operations on 2-dimensional arrays. |
|||
/// |
|||
/// F# and .NET multi-dimensional arrays are typically zero-based. |
|||
/// However, .NET multi-dimensional arrays used in conjunction with external |
|||
/// libraries (e.g. libraries associated with Visual Basic) be |
|||
/// non-zero based, using a potentially different base for each dimension. |
|||
/// The operations in this module will accept such arrays, and |
|||
/// the basing on an input array will be propogated to a matching output |
|||
/// array on the <c>Array2D.map</c> and <c>Array2D.mapi</c> operations. |
|||
/// Non-zero-based arrays can also be created using <c>Array2D.zero_create_based</c>, |
|||
/// <c>Array2D.create_based</c> and <c>Array2D.init_based</c>. |
|||
module Array2D = |
|||
|
|||
/// Fetch the base-index for the first dimension of the array. |
|||
/// |
|||
/// See notes on the Array2D module re. zero-basing. |
|||
val base1: array:'T[,] -> int |
|||
|
|||
/// Fetch the base-index for the second dimension of the array. |
|||
/// |
|||
/// See notes on the Array2D module re. zero-basing. |
|||
val base2: array:'T[,] -> int |
|||
|
|||
/// Build a new array whose elements are the same as the input array. |
|||
/// |
|||
/// For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
/// array. |
|||
val copy: array:'T[,] -> 'T[,] |
|||
|
|||
/// Read a range of elements from the first array and write them into the second. |
|||
val blit: source:'T[,] -> sourceIndex1:int -> sourceIndex2:int -> target:'T[,] -> targetIndex1:int -> targetIndex2:int -> length1:int -> length2:int -> unit |
|||
|
|||
/// Create an array given the dimensions and a generator function to compute the elements. |
|||
val init: length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] |
|||
|
|||
/// Create an array whose elements are all initially the given value |
|||
val create: length1:int -> length2:int -> value:'T -> 'T[,] |
|||
|
|||
/// Create an array where the entries are initially Unchecked.defaultof<'T>. |
|||
val zeroCreate : length1:int -> length2:int -> 'T[,] |
|||
|
|||
#if FX_NO_BASED_ARRAYS |
|||
#else |
|||
/// Create a based array given the dimensions and a generator function to compute the elements. |
|||
val initBased: base1:int -> base2:int -> length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] |
|||
|
|||
/// Create a based array whose elements are all initially the given value |
|||
val createBased: base1:int -> base2:int -> length1:int -> length2:int -> initial: 'T -> 'T[,] |
|||
|
|||
/// Create a based array where the entries are initially Unchecked.defaultof<'T>. |
|||
val zeroCreateBased : base1:int -> base2:int -> length1:int -> length2:int -> 'T[,] |
|||
#endif |
|||
|
|||
/// Apply the given function to each element of the array. |
|||
val iter: action:('T -> unit) -> array:'T[,] -> unit |
|||
|
|||
/// Apply the given function to each element of the array. The integer indicies passed to the |
|||
/// function indicates the index of element. |
|||
val iteri: action:(int -> int -> 'T -> unit) -> array:'T[,] -> unit |
|||
|
|||
/// Return the length of an array in the first dimension |
|||
val length1: array:'T[,] -> int |
|||
|
|||
/// Return the length of an array in the second dimension |
|||
val length2: array:'T[,] -> int |
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. |
|||
/// |
|||
/// For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
/// array. |
|||
val map: mapping:('T -> 'U) -> array:'T[,] -> 'U[,] |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. The integer indices passed to the |
|||
/// function indicates the element being transformed. |
|||
/// |
|||
/// For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
/// array. |
|||
val mapi: mapping:(int -> int -> 'T -> 'U) -> array:'T[,] -> 'U[,] |
|||
|
|||
|
|||
/// Build a new array whose elements are the same as the input array but |
|||
/// where a non-zero-based input array generates a corresponding zero-based |
|||
/// output array. |
|||
val rebase: array:'T[,] -> 'T[,] |
|||
|
|||
/// Set the value of an element in an array. You can also use the syntax 'array.[index1,index2] <- value' |
|||
val set: array:'T[,] -> index1:int -> index2:int -> value:'T -> unit |
|||
|
|||
/// Fetch an element from a 2D array. You can also use the syntax 'array.[index1,index2]' |
|||
val get: array:'T[,] -> index1:int -> index2:int -> 'T |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'initBased' instead")>] |
|||
val init_based: base1:int -> base2:int -> length1:int -> length2:int -> initializer:(int -> int -> 'T) -> 'T[,] |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'createBased' instead")>] |
|||
val create_based: base1:int -> base2:int -> length1:int -> length2:int -> initial: 'T -> 'T[,] |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'zeroCreate' instead")>] |
|||
val zero_create : length1:int -> length2:int -> 'T[,] |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'zeroCreateBased' instead")>] |
|||
val zero_create_based : base1:int -> base2:int -> length1:int -> length2:int -> 'T[,] |
|||
|
|||
[<Obsolete("Use arr2.[startIndex1..endIndex1, startIndex2..endIndex2] instead")>] |
|||
val sub: source:'T[,] -> sourceIndex1:int -> sourceIndex2:int -> count1:int -> count2:int -> 'T[,] |
|||
#endif |
|||
@ -1,145 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System.Diagnostics |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Array3D = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length1 (arr: 'a[,,]) = (# "ldlen.multi 3 0" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length2 (arr: 'a[,,]) = (# "ldlen.multi 3 1" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length3 (arr: 'a[,,]) = (# "ldlen.multi 3 2" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let get (arr: 'a[,,]) (n1:int) (n2:int) (n3:int) = (# "ldelem.multi 3 !0" type ('a) arr n1 n2 n3 : 'a #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let set (arr: 'a[,,]) (n1:int) (n2:int) (n3:int) (x:'a) = (# "stelem.multi 3 !0" type ('a) arr n1 n2 n3 x #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zeroCreate (n1:int) (n2:int) (n3:int) = (# "newarr.multi 3 !0" type ('a) n1 n2 n3 : 'a[,,] #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let create (n1:int) (n2:int) (n3:int) (x:'a) = |
|||
let arr = (zeroCreate n1 n2 n3 : 'a[,,]) |
|||
for i = 0 to n1 - 1 do |
|||
for j = 0 to n2 - 1 do |
|||
for k = 0 to n3 - 1 do |
|||
arr.[i,j,k] <- x |
|||
arr |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init n1 n2 n3 f = |
|||
let arr = (zeroCreate n1 n2 n3 : 'a[,,]) |
|||
for i = 0 to n1 - 1 do |
|||
for j = 0 to n2 - 1 do |
|||
for k = 0 to n3 - 1 do |
|||
arr.[i,j,k] <- f i j k |
|||
arr |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f arr = |
|||
let len1 = length1 arr |
|||
let len2 = length2 arr |
|||
let len3 = length3 arr |
|||
for i = 0 to len1 - 1 do |
|||
for j = 0 to len2 - 1 do |
|||
for k = 0 to len3 - 1 do |
|||
f arr.[i,j,k] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f arr = |
|||
let len1 = length1 arr |
|||
let len2 = length2 arr |
|||
let len3 = length3 arr |
|||
let res = (zeroCreate len1 len2 len3 : 'b[,,]) |
|||
for i = 0 to len1 - 1 do |
|||
for j = 0 to len2 - 1 do |
|||
for k = 0 to len3 - 1 do |
|||
res.[i,j,k] <- f arr.[i,j,k] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri f arr = |
|||
let len1 = length1 arr |
|||
let len2 = length2 arr |
|||
let len3 = length3 arr |
|||
for i = 0 to len1 - 1 do |
|||
for j = 0 to len2 - 1 do |
|||
for k = 0 to len3 - 1 do |
|||
f i j k arr.[i,j,k] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi f arr = |
|||
let len1 = length1 arr |
|||
let len2 = length2 arr |
|||
let len3 = length3 arr |
|||
let res = (zeroCreate len1 len2 len3 : 'b[,,]) |
|||
for i = 0 to len1 - 1 do |
|||
for j = 0 to len2 - 1 do |
|||
for k = 0 to len3 - 1 do |
|||
res.[i,j,k] <- f i j k arr.[i,j,k] |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zero_create n1 n2 n3 = zeroCreate n1 n2 n3 |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Array4D = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length1 (arr: 'a[,,,]) = (# "ldlen.multi 4 0" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length2 (arr: 'a[,,,]) = (# "ldlen.multi 4 1" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length3 (arr: 'a[,,,]) = (# "ldlen.multi 4 2" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length4 (arr: 'a[,,,]) = (# "ldlen.multi 4 3" arr : int #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zeroCreate (n1:int) (n2:int) (n3:int) (n4:int) = (# "newarr.multi 4 !0" type ('a) n1 n2 n3 n4 : 'a[,,,] #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let create n1 n2 n3 n4 (x:'a) = |
|||
let arr = (zeroCreate n1 n2 n3 n4 : 'a[,,,]) |
|||
for i = 0 to n1 - 1 do |
|||
for j = 0 to n2 - 1 do |
|||
for k = 0 to n3 - 1 do |
|||
for m = 0 to n4 - 1 do |
|||
arr.[i,j,k,m] <- x |
|||
arr |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init n1 n2 n3 n4 f = |
|||
let arr = (zeroCreate n1 n2 n3 n4 : 'a[,,,]) |
|||
for i = 0 to n1 - 1 do |
|||
for j = 0 to n2 - 1 do |
|||
for k = 0 to n3 - 1 do |
|||
for m = 0 to n4 - 1 do |
|||
arr.[i,j,k,m] <- f i j k m |
|||
arr |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let get (arr: 'a[,,,]) (n1:int) (n2:int) (n3:int) (n4:int) = (# "ldelem.multi 4 !0" type ('a) arr n1 n2 n3 n4 : 'a #) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let set (arr: 'a[,,,]) (n1:int) (n2:int) (n3:int) (n4:int) (x:'a) = (# "stelem.multi 4 !0" type ('a) arr n1 n2 n3 n4 x #) |
|||
|
|||
@ -1,103 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
/// Basic operations on rank 3 arrays. |
|||
module Array3D = |
|||
|
|||
/// Create an array whose elements are all initially the given value |
|||
val create: length1:int -> length2:int -> length3:int -> initial:'T -> 'T[,,] |
|||
|
|||
/// Create an array given the dimensions and a generator function to compute the elements. |
|||
val init: length1:int -> length2:int -> length3:int -> initializer:(int -> int -> int -> 'T) -> 'T[,,] |
|||
|
|||
/// Fetch an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]' |
|||
val get: array:'T[,,] -> index1:int -> index2:int -> index3:int -> 'T |
|||
|
|||
/// Apply the given function to each element of the array. |
|||
val iter: action:('T -> unit) -> array:'T[,,] -> unit |
|||
|
|||
/// Apply the given function to each element of the array. The integer indicies passed to the |
|||
/// function indicates the index of element. |
|||
val iteri: action:(int -> int -> int -> 'T -> unit) -> array:'T[,,] -> unit |
|||
|
|||
/// Return the length of an array in the first dimension |
|||
val length1: array:'T[,,] -> int |
|||
|
|||
/// Return the length of an array in the second dimension |
|||
val length2: array:'T[,,] -> int |
|||
|
|||
/// Return the length of an array in the third dimension |
|||
val length3: array:'T[,,] -> int |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. |
|||
/// |
|||
/// For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
/// array. |
|||
val map: mapping:('T -> 'U) -> array:'T[,,] -> 'U[,,] |
|||
|
|||
/// Build a new array whose elements are the results of applying the given function |
|||
/// to each of the elements of the array. The integer indices passed to the |
|||
/// function indicates the element being transformed. |
|||
/// |
|||
/// For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
/// array. |
|||
val mapi: mapping:(int -> int -> int -> 'T -> 'U) -> array:'T[,,] -> 'U[,,] |
|||
|
|||
/// Set the value of an element in an array. You can also |
|||
/// use the syntax 'array.[index1,index2,index3] <- value'. |
|||
val set: array:'T[,,] -> index1:int -> index2:int -> index3:int -> value:'T -> unit |
|||
|
|||
/// Create an array where the entries are initially the "default" value. |
|||
val zeroCreate: length1:int -> length2:int -> length3:int -> 'T[,,] |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'zeroCreate' instead")>] |
|||
val zero_create: length1:int -> length2:int -> length3:int -> 'T[,,] |
|||
#endif |
|||
|
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
/// Basic operations on rank 4 arrays. |
|||
module Array4D = |
|||
|
|||
/// Create an array whose elements are all initially the given value |
|||
val create: length1:int -> length2:int -> length3:int -> length4:int -> initial:'T -> 'T[,,,] |
|||
|
|||
/// Create an array given the dimensions and a generator function to compute the elements. |
|||
val init: length1:int -> length2:int -> length3:int -> length4:int -> initializer:(int -> int -> int -> int -> 'T) -> 'T[,,,] |
|||
|
|||
/// Return the length of an array in the first dimension |
|||
val length1: array:'T[,,,] -> int |
|||
|
|||
/// Return the length of an array in the second dimension |
|||
val length2: array:'T[,,,] -> int |
|||
|
|||
/// Return the length of an array in the third dimension |
|||
val length3: array:'T[,,,] -> int |
|||
|
|||
/// Return the length of an array in the fourth dimension |
|||
val length4: array:'T[,,,] -> int |
|||
|
|||
/// Create an array where the entries are initially the "default" value. |
|||
val zeroCreate: length1:int -> length2:int -> length3:int -> length4:int -> 'T[,,,] |
|||
|
|||
/// Fetch an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]' |
|||
val get: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> 'T |
|||
|
|||
/// Set the value of an element in an array. You can also |
|||
/// use the syntax 'array.[index1,index2,index3,index4] <- value'. |
|||
val set: array:'T[,,,] -> index1:int -> index2:int -> index3:int -> index4:int -> value:'T -> unit |
|||
|
|||
@ -1,113 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
#nowarn "51" |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
open System |
|||
open System.Diagnostics |
|||
open System.Collections |
|||
open System.Collections.Generic |
|||
|
|||
module HashIdentity = |
|||
|
|||
let inline Structural<'a> : IEqualityComparer<'a> = |
|||
// type-specialize some common cases to generate more efficient functions |
|||
{ new IEqualityComparer<'a> with |
|||
member self.GetHashCode(x) = LanguagePrimitives.GenericHash(x) |
|||
member self.Equals(x,y) = LanguagePrimitives.GenericEquality x y } |
|||
|
|||
let LimitedStructural<'T>(limit) : IEqualityComparer<'T> = |
|||
LanguagePrimitives.FastLimitedGenericEqualityComparer<'T>(limit) |
|||
|
|||
let Reference<'T> : IEqualityComparer<'T> = |
|||
{ new IEqualityComparer<'T> with |
|||
member self.GetHashCode(x) = LanguagePrimitives.PhysicalHash(x) |
|||
member self.Equals(x,y) = LanguagePrimitives.PhysicalEquality x y } |
|||
|
|||
let inline FromFunctions hash eq : IEqualityComparer<'a> = |
|||
let eq = OptimizedClosures.FastFunc2<_,_,_>.Adapt(eq) |
|||
{ new IEqualityComparer<'a> with |
|||
member self.GetHashCode(x) = hash x |
|||
member self.Equals(x,y) = eq.Invoke(x,y) } |
|||
|
|||
|
|||
module ComparisonIdentity = |
|||
|
|||
let inline MakeFastStructuralComparisonFunction<'a>() : OptimizedClosures.FastFunc2<'a,'a,int> = |
|||
OptimizedClosures.FastFunc2<'a,'a,int>.Adapt(LanguagePrimitives.GenericComparison) |
|||
|
|||
let Char = MakeFastStructuralComparisonFunction<char>() |
|||
let String = MakeFastStructuralComparisonFunction<string>() |
|||
let SByte = MakeFastStructuralComparisonFunction<sbyte>() |
|||
let Int16 = MakeFastStructuralComparisonFunction<int16>() |
|||
let Int32 = MakeFastStructuralComparisonFunction<int32>() |
|||
let Int64 = MakeFastStructuralComparisonFunction<int64>() |
|||
let IntPtr = MakeFastStructuralComparisonFunction<nativeint>() |
|||
let Byte = MakeFastStructuralComparisonFunction<byte>() |
|||
let UInt16 = MakeFastStructuralComparisonFunction<uint16>() |
|||
let UInt32 = MakeFastStructuralComparisonFunction<uint32>() |
|||
let UInt64 = MakeFastStructuralComparisonFunction<uint64>() |
|||
let UIntPtr = MakeFastStructuralComparisonFunction<unativeint>() |
|||
|
|||
/// Use a type-indexed table to ensure we only create a single FastStructuralComparison function |
|||
/// for each type |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Performance","CA1812:AvoidUninstantiatedInternalClasses")>] |
|||
type FastStructuralComparisonTable<'a>() = |
|||
static let f : OptimizedClosures.FastFunc2<'a,'a,int> = |
|||
match typeof<'a> with |
|||
| ty when ty.Equals(typeof<byte>) -> unbox (box Byte) |
|||
| ty when ty.Equals(typeof<char>) -> unbox (box Char) |
|||
| ty when ty.Equals(typeof<sbyte>) -> unbox (box SByte) |
|||
| ty when ty.Equals(typeof<int16>) -> unbox (box Int16) |
|||
| ty when ty.Equals(typeof<int32>) -> unbox (box Int32) |
|||
| ty when ty.Equals(typeof<int64>) -> unbox (box Int64) |
|||
| ty when ty.Equals(typeof<nativeint>) -> unbox (box IntPtr) |
|||
| ty when ty.Equals(typeof<uint16>) -> unbox (box UInt16) |
|||
| ty when ty.Equals(typeof<uint32>) -> unbox (box UInt32) |
|||
| ty when ty.Equals(typeof<uint64>) -> unbox (box UInt64) |
|||
| ty when ty.Equals(typeof<unativeint>) -> unbox (box UIntPtr) |
|||
| ty when ty.Equals(typeof<string>) -> unbox (box String) |
|||
| _ -> MakeFastStructuralComparisonFunction<'a>() |
|||
static member Function : OptimizedClosures.FastFunc2<'a,'a,int> = f |
|||
|
|||
let GetFastStructuralComparisonFunction<'a>() : OptimizedClosures.FastFunc2<'a,'a,int> = |
|||
FastStructuralComparisonTable<'a>.Function |
|||
|
|||
/// If an IComparer also implements this interface then library implementations |
|||
/// have the option of using the given FastComparisonFunction |
|||
/// for implementing comparison semantics. Calling the FastFunc2 implementation |
|||
/// tends to be faster than calling IComparer. Furthermore most F# comparers are |
|||
/// ultimately specified using FastFunc2 values, hence making a direct call to |
|||
/// a FastFunc2 value avoids a double indirection. |
|||
type IHasFastComparisonFunction<'a> = |
|||
interface IComparer<'a> |
|||
abstract FastComparisonFunction : OptimizedClosures.FastFunc2<'a,'a,int> |
|||
|
|||
let GetFastComparisonFunction(icomparer : IComparer<'a>) : OptimizedClosures.FastFunc2<'a,'a,int> = |
|||
match box icomparer with |
|||
| :? IHasFastComparisonFunction<'a> as x -> x.FastComparisonFunction |
|||
| _ -> OptimizedClosures.FastFunc2<_,_,_>.Adapt(fun x y -> icomparer.Compare(x,y)) |
|||
|
|||
let Structural<'a> : IComparer<'a> = |
|||
let comparer = MakeFastStructuralComparisonFunction<'a>() |
|||
{ new IComparer<'a> with |
|||
member self.Compare(x,y) = LanguagePrimitives.GenericComparison x y |
|||
interface IHasFastComparisonFunction<'a> with |
|||
member self.FastComparisonFunction = comparer } |
|||
|
|||
let FromFunction comparer = |
|||
let comparer = OptimizedClosures.FastFunc2<'a,'a,int>.Adapt(comparer) |
|||
{ new IComparer<'a> with |
|||
member self.Compare(x,y) = comparer.Invoke(x,y) |
|||
interface IHasFastComparisonFunction<'a> with |
|||
member self.FastComparisonFunction = comparer } |
|||
|
|||
|
|||
@ -1,55 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// This namespace contains some common collections in a style primarily designed for use from F#. |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
open System |
|||
open System.Collections.Generic |
|||
|
|||
/// Common notions of comparison identity used with sorted data structures. |
|||
module ComparisonIdentity = |
|||
|
|||
/// Structural comparison. Compare using Operators.compare. |
|||
val Structural<'T> : IComparer<'T> |
|||
|
|||
/// Convert an existing IComparer object into a comparison function with a fast entry point |
|||
/// If comparer was originally built using ComparisonIdentity.FromFunction then the original function will be |
|||
/// returned |
|||
val GetFastComparisonFunction : comparer:IComparer<'T> -> OptimizedClosures.FastFunc2<'T,'T,int> |
|||
|
|||
/// Convert an existing IComparer object into a comparison function with a fast entry point |
|||
val GetFastStructuralComparisonFunction : unit -> OptimizedClosures.FastFunc2<'T,'T,int> |
|||
|
|||
/// Compare using the given comparer function |
|||
val FromFunction : comparer:('T -> 'T -> int) -> IComparer<'T> |
|||
|
|||
/// Common notions of value identity used with hash tables. |
|||
module HashIdentity = |
|||
|
|||
/// Structural hashing. Hash using Operators.(=) and Operators.hash. |
|||
|
|||
// inline justification: allows specialization of structural hash functions based on type |
|||
val inline Structural<'T> : IEqualityComparer<'T> |
|||
|
|||
val LimitedStructural<'T> : limit: int -> IEqualityComparer<'T> |
|||
|
|||
/// Physical hashing (hash on reference identity of objects, and the contents of value types). |
|||
/// Hash using LanguagePrimitives.PhysicalEquality and LanguagePrimitives.PhysicalHash, |
|||
/// That is, for value types use GetHashCode and Object.Equals (if no other optimization available), |
|||
/// and for reference types use System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode and |
|||
/// reference equality. |
|||
// |
|||
// inline justification: allows specialization of reference hash functions based on type |
|||
val Reference<'T> : IEqualityComparer<'T> |
|||
|
|||
/// Hash using the given hashing and equality functions |
|||
// |
|||
// inline justification: allows inlining of hash functions |
|||
val inline FromFunctions<'T> : hasher:('T -> int) -> equality:('T -> 'T -> bool) -> IEqualityComparer<'T> |
|||
|
|||
|
|||
File diff suppressed because it is too large
@ -1,508 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// This namespace contains types for derived control constructs including |
|||
/// on-demand and asynchronous computations. |
|||
namespace Microsoft.FSharp.Control |
|||
|
|||
#nowarn "44" // This construct is deprecated. This method will be removed in the next version of F# and may no longer be used. Consider using Async.RunWithContinuations |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Control |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
#if FX_ATLEAST_40 |
|||
open System.Threading.Tasks |
|||
#endif |
|||
|
|||
#if FX_NO_OPERATION_CANCELLED |
|||
|
|||
type OperationCanceledException = |
|||
inherit System.Exception |
|||
new : System.String -> OperationCanceledException |
|||
#endif |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
type |
|||
#else |
|||
[<Sealed>] |
|||
[<AutoSerializable(false)>] |
|||
[<Obsolete("This type will be removed in the next version of F# and should no longer be used. Consider using Async.RunWithContinuations")>] |
|||
type AsyncFuture<'T> = |
|||
interface System.IDisposable |
|||
interface System.IAsyncResult |
|||
/// Wait for the completion of the operation and get its result |
|||
member Value : 'T |
|||
|
|||
|
|||
/// A handle to a capability to cancel a set of asynchronous computations. |
|||
and |
|||
#endif |
|||
|
|||
[<Sealed>] |
|||
AsyncGroup = |
|||
/// Generate a new asynchronous group |
|||
new : unit -> AsyncGroup |
|||
/// Raise the cancellation condition for this group of computations |
|||
member TriggerCancel : ?message:string -> unit |
|||
|
|||
/// Run the asynchronous computation and await its result. |
|||
/// |
|||
/// If an exception occurs in the asynchronous computation then an exception is re-raised by this |
|||
/// function. |
|||
member RunSynchronously : computation:Async<'T> * ?timeout : int -> 'T |
|||
|
|||
/// Start the asynchronous computation as a work item. Do not await its result. |
|||
member Start : computation:Async<unit> -> unit |
|||
|
|||
#if FX_ATLEAST_40 |
|||
/// Creates a <c>System.Threading.Tasks.Task</c> that executes asynchronous computation. |
|||
/// The task is not started. |
|||
member CreateTask : computation:Async<'T> * ?taskCreationOptions : TaskCreationOptions -> Task<'T> |
|||
|
|||
/// Starts a <c>System.Threading.Tasks.Task</c> that executes asynchronous computation. |
|||
member StartAsTask : computation:Async<'T> * ?taskCreationOptions : TaskCreationOptions -> Task<'T> |
|||
|
|||
/// Creates an asynchronous computation which starts given computation as <c>System.Threading.Tasks.Task</c> |
|||
member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions : TaskCreationOptions -> Async<Task<'T>> |
|||
#endif |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This method was renamed. It is now called RunSynchronously")>] |
|||
member Run : computation:Async<'T> * ?timeout : int -> 'T |
|||
|
|||
[<Obsolete("This method was renamed. It is now called Start")>] |
|||
member Spawn : computation:Async<unit> -> unit |
|||
|
|||
[<Obsolete("This method will be removed in the next version of F# and may no longer be used. Consider using Async.RunWithContinuations",true)>] |
|||
member SpawnFuture : computation:Async<'T> -> AsyncFuture<'T> |
|||
#endif |
|||
|
|||
/// Start the asynchronous computation as a work item. |
|||
/// Return a handle to the computation as an AsyncFuture. |
|||
member RunWithContinuations: continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * computation:Async<'T> -> unit |
|||
|
|||
/// An asynchronous computation, which, when run, will eventually produce a value |
|||
/// of the given type, or else raise an exception. The value and/or exception is not returned |
|||
/// to the caller immediately, but is rather passed to a success continuation, exception continuation |
|||
/// or cancellation continuation. |
|||
/// |
|||
/// Asynchronous computations are normally specified using the F# 'workflow' syntax for building |
|||
/// computations. |
|||
/// |
|||
/// When run, asynchronous computations can normally be thought of as running run in one of |
|||
/// two modes: 'work item mode' or 'waiting mode'. |
|||
/// |
|||
/// - 'work item mode' indicates that the computation is executing as a work item, |
|||
/// e.g. in the .NET Thread Pool via ThreadPool.QueueUserWorkItem, or is running |
|||
/// a brief event-response action on the GUI thread. |
|||
/// |
|||
/// - 'waiting mode' indicates the computations a waiting for asynchronous I/O completions, |
|||
/// typically suspended as thunks using ThreadPool.RegisterWaitForSingleObject. |
|||
/// |
|||
/// Asynchronous computations running as 'work items' should not generally perform blocking |
|||
/// operations, e.g. long running synchronous loops. However, some asynchronous |
|||
/// computations may, out of necessity, need to execute blocking I/O operations: |
|||
/// these should be run on new threads or a user-managed pool of threads specifically |
|||
/// dedicated to resolving blocking conditions. For example, System.IO.OpenFile is, by |
|||
/// design, a blocking operation. However frequently it is important to code as |
|||
/// if this is asynchronous. This can be done by executing Async.SwitchToNewThread |
|||
/// as part of the workflow. |
|||
/// |
|||
/// When run, asynchronous computations belong to an AsyncGroup. This can usually be specified |
|||
/// when the async computation is started. The only action on an AsyncGroup is to raise a cancellation |
|||
/// condition for the AsyncGroup. Async values check the cancellation condition for their AsyncGroup |
|||
/// regularly, though synchronous computations within an asynchronous computation will not automatically |
|||
/// check this condition. This gives a user-level cooperative cancellation protocol. |
|||
and |
|||
[<Sealed>] |
|||
[<StructuralEquality(false); StructuralComparison(false)>] |
|||
Async<'T> |
|||
|
|||
/// This static class holds members for creating and manipulating asynchronous computations |
|||
and |
|||
[<Sealed>] |
|||
Async = |
|||
|
|||
/// Run the asynchronous computation and await its result. |
|||
/// |
|||
/// If an exception occurs in the asynchronous computation then an exception is re-raised by this |
|||
/// function. |
|||
/// |
|||
/// Run as part of the default AsyncGroup |
|||
static member RunSynchronously : computation:Async<'T> * ?timeout : int -> 'T |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This method was renamed. It is now called RunSynchronously")>] |
|||
static member Run : computation:Async<'T> * ?timeout : int -> 'T |
|||
|
|||
#if FX_NO_SYNC_CONTEXT |
|||
#else |
|||
[<Obsolete("This method will be removed in a future version of F#")>] |
|||
static member SpawnThenPostBack : computation:Async<'T> * postBack:('T -> unit) -> unit |
|||
#endif |
|||
#endif |
|||
|
|||
/// Start the asynchronous computation in the thread pool. Do not await its result. |
|||
/// |
|||
/// Run as part of the default AsyncGroup |
|||
static member Start : computation:Async<unit> -> unit |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This method was renamed. It is now called Start")>] |
|||
static member Spawn : computation:Async<unit> -> unit |
|||
|
|||
[<Obsolete("This method will be removed in the next version of F# and may no longer be used. Consider using Async.RunWithContinuations",true)>] |
|||
static member SpawnFuture : computation:Async<'T> -> AsyncFuture<'T> |
|||
#endif |
|||
|
|||
#if FX_ATLEAST_40 |
|||
/// Creates a <c>System.Threading.Tasks.Task</c> that executes asynchronous computation. |
|||
/// The task is not started. |
|||
static member CreateTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Task<'T> |
|||
|
|||
/// Starts a <c>System.Threading.Tasks.Task</c> that executes asynchronous computation. |
|||
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Task<'T> |
|||
|
|||
/// Creates an asynchronous computation which starts given computation as <c>System.Threading.Tasks.Task</c> |
|||
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>> |
|||
#endif |
|||
|
|||
/// Run an asynchronous computation, initially as a work item. |
|||
/// |
|||
/// Run as part of the default AsyncGroup |
|||
static member RunWithContinuations: continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * computation:Async<'T> -> unit |
|||
|
|||
//---------- Exceptions |
|||
|
|||
/// Get the default group for executing asynchronous computations |
|||
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>> |
|||
|
|||
/// Specify an asynchronous computation that, when run, executes <c>computation</c>, |
|||
/// If <c>p</c> is effectively cancelled before its termination then |
|||
/// the process <c>f exn</c> is executed. |
|||
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T> |
|||
|
|||
//---------- Cancellation checking and performing actions on cancellation. |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This method will be removed in a future version of F#")>] |
|||
static member CancelCheck : unit -> Async<unit> |
|||
#endif |
|||
|
|||
/// Generate a scoped, cooperative cancellation handler for use within an asynchronous workflow. |
|||
/// |
|||
/// <c>async { use! holder = Async.OnCancel f ... }</c> generates an asynchronous computation where, |
|||
/// if a cancellation happens any time during the execution of the asynchronous computation in the scope of 'holder', |
|||
/// then action 'f' is executed on the thread that is performing the cancellation. You can use |
|||
/// this to arrange for your own computation to be asynchronously notified that a cancellation has occurred, e.g. |
|||
/// by setting a flag, or deregistering a pending I/O action. |
|||
static member OnCancel : compensation: (string -> unit) -> Async<System.IDisposable> |
|||
|
|||
/// Raise the cancellation condition for the most recent set of Async computations started without any specific AsyncGroup. |
|||
/// Replace the global group with a new global group for any asynchronous computations created after this point without |
|||
/// any specific AsyncGroup. |
|||
static member CancelDefaultGroup : ?message:string -> unit |
|||
|
|||
/// Get the default group for executing asynchronous computations |
|||
static member DefaultGroup : AsyncGroup |
|||
|
|||
//---------- Parallelism |
|||
|
|||
/// Start a child computation within an asynchronous workflow. |
|||
/// This allows multiple asynchronous computations to be executed simultaneously. |
|||
/// |
|||
/// This method should normally be used as the immediate |
|||
/// right-hand-side of a 'let!' binding in an F# asynchronous workflow, i.e., |
|||
/// |
|||
/// async { ... |
|||
/// let! completor1 = childComputation1 |> Async.StartChild |
|||
/// let! completor2 = childComputation2 |> Async.StartChild |
|||
/// ... |
|||
/// let! result1 = completor1 |
|||
/// let! result2 = completor2 |
|||
/// ... } |
|||
/// |
|||
/// When used in this way, each use of <c>StartChild</c> starts an instance of <c>childComputation</c> |
|||
/// and returns a completor object representing a computation to wait for the completion of the operation. |
|||
/// When executed, the completor awaits the completion of <c>childComputation</c>. |
|||
static member StartChild : computation:Async<'T> * ?millisecondsTimeout : int -> Async<Async<'T>> |
|||
|
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This function is now obsolete. Use <c>Async.StartChild(computation) |> Async.Ignore</c> or <c>let! _ = Async.StartChild(computation)</c>. This indicates that results and errors from the child computation are ignored")>] |
|||
static member SpawnChild : computation:Async<unit> -> Async<unit> |
|||
|
|||
[<Obsolete("This method will be removed in a future version of F#")>] |
|||
static member Generate : itemCount:int * generator: (int -> Async<'T>) * ?groupCount: int -> Async<'T array> |
|||
#endif |
|||
|
|||
/// Specify an asynchronous computation that, when run, executes all the given asynchronous computations, initially |
|||
/// queueing each as work items and using a fork/join pattern. If any raise an exception then the |
|||
/// overall computation will raise the first detected exception, and attempt to cancel the others. |
|||
/// All the sub-computations belong to an AsyncGroup that is a subsidiary of the AsyncGroup of the outer computations. |
|||
static member Parallel : computationList:seq<Async<'T>> -> Async<'T array> |
|||
|
|||
/// Specify an asynchronous computation that, when run, executes the two asynchronous computations, starting each in the thread pool. |
|||
/// If any raise an exception then the overall computation will raise an exception, and attempt to cancel the others. |
|||
/// All the sub-computations belong to an AsyncGroup that is a subsidiary of the AsyncGroup of the outer computations. |
|||
static member Parallel2 : computation1:Async<'T1> * computation2:Async<'T2> -> Async<'T1 * 'T2> |
|||
|
|||
/// Specify an asynchronous computation that, when run, executese the three asynchronous computations, starting each in the thread pool. |
|||
/// If any raise an exception then the overall computation will raise an exception, and attempt to cancel the others. |
|||
/// All the sub-computations belong to an AsyncGroup that is a subsidiary of the AsyncGroup of the outer computations. |
|||
static member Parallel3 : computation1:Async<'T1> * computation2:Async<'T2> * computation3:Async<'T3> -> Async<'T1 * 'T2 * 'T3> |
|||
|
|||
//---------- Thread Control |
|||
|
|||
/// Specify an asynchronous computation that, when run, creates a new thread and runs |
|||
/// its continutation in that thread |
|||
static member SwitchToNewThread : unit -> Async<unit> |
|||
|
|||
/// Specify an asynchronous computation that, when run, queues a CPU-intensive work in the thread pool item that runs |
|||
/// its continutation. |
|||
static member SwitchToThreadPool : unit -> Async<unit> |
|||
|
|||
#if FX_NO_SYNC_CONTEXT |
|||
#else |
|||
/// Specify an asynchronous computation that, when run, runs |
|||
/// its continuation using syncContext.Post. If syncContext is null |
|||
/// then the asynchronous computation is equivalent to SwitchToThreadPool(). |
|||
static member SwitchToGuiThread : syncContext:System.Threading.SynchronizationContext -> Async<unit> |
|||
#endif |
|||
|
|||
|
|||
//---------- Building new primitive Async values |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<OverloadID("Primitive")>] |
|||
[<Obsolete("This overload will be removed in a future version of F#. Please use the overload where the callback takes three continuations, for success, exception and cancellation",true)>] |
|||
static member Primitive : callback:(('T -> unit) * (exn -> unit) -> unit) -> Async<'T> |
|||
#endif |
|||
|
|||
/// Specify an asynchronous computation that, when run, executes the given callback. |
|||
/// The callback must eventually call either the continuation, |
|||
/// the exception continuation or the cancel exception. |
|||
[<OverloadID("Primitive_with_ccont")>] |
|||
static member Primitive : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation in terms of a Begin/End pair of actions in |
|||
/// the style used in .NET APIs where the overall operation is not qualified by any arguments. For example, |
|||
/// <c>Async.BuildPrimitive(ws.BeginGetWeather,ws.EndGetWeather)</c> |
|||
/// When the computation is run, the 'Begin' half of the operation is executed, and |
|||
/// an asynchronous computation is returned that, when run, awaits the completion |
|||
/// of the computation and fetches its overall result using the 'End' operation. |
|||
[<OverloadID("BuildPrimitve_zero_arg")>] |
|||
static member BuildPrimitive : beginAction:(System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation in terms of a Begin/End pair of actions in |
|||
/// the style used in .NET APIs where the |
|||
/// overall operation is qualified by one argument. For example, |
|||
/// <c>Async.BuildPrimitive(place,ws.BeginGetWeather,ws.EndGetWeather)</c> |
|||
/// When the computation is run, the 'Begin' half of the operation is executed, and |
|||
/// an asynchronous computation is returned that, when run, awaits the completion |
|||
/// of the computation and fetches its overall result using the 'End' operation. |
|||
[<OverloadID("BuildPrimitve_one_arg")>] |
|||
static member BuildPrimitive : arg:'Arg1 * beginAction:('Arg1 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation in terms of a Begin/End pair of actions in |
|||
/// the style used in .NET APIs where the |
|||
/// overall operation is qualified by two arguments. For example, |
|||
/// <c>Async.BuildPrimitive(arg1,arg2,ws.BeginGetWeather,ws.EndGetWeather)</c> |
|||
/// When the computation is run, the 'Begin' half of the operation is executed, and |
|||
/// an asynchronous computation is returned that, when run, awaits the completion |
|||
/// of the computation and fetches its overall result using the 'End' operation. |
|||
[<OverloadID("BuildPrimitve_two_arg")>] |
|||
static member BuildPrimitive : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation in terms of a Begin/End pair of actions in |
|||
/// the style used in .NET APIs where the overall operation is qualified by three arguments. For example, |
|||
/// <c>Async.BuildPrimitive(arg1,arg2,arg3,ws.BeginGetWeather,ws.EndGetWeather)</c> |
|||
/// When the computation is run, the 'Begin' half of the operation is executed, and |
|||
/// an asynchronous computation is returned that, when run, awaits the completion |
|||
/// of the computation and fetches its overall result using the 'End' operation. |
|||
[<OverloadID("BuildPrimitve_three_arg")>] |
|||
static member BuildPrimitive : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * System.AsyncCallback * obj -> System.IAsyncResult) * endAction:(System.IAsyncResult -> 'T) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'p', ignoring the result and |
|||
/// returning the result '()'. |
|||
static member Ignore : computation: Async<'T> -> Async<unit> |
|||
|
|||
|
|||
[<Sealed>] |
|||
/// The type of the 'async' operator, used to build workflows for asynchronous computations. |
|||
type AsyncBuilder = |
|||
/// Specify an asynchronous computation that, when run, enumerates the sequence 'seq' |
|||
/// on demand and runs 'f' for each element. |
|||
member For: sequence:seq<'T> * body:('T -> Async<unit>) -> Async<unit> |
|||
|
|||
/// Specify an asynchronous computation that, when run, just returns '()' |
|||
member Zero : unit -> Async<unit> |
|||
|
|||
/// Specify an asynchronous computation that, when run, first runs 'p1' and then runs 'p2', returning the result of 'p2'. |
|||
member Combine : computation1:Async<unit> * computation2:Async<'T> -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'p' repeatedly |
|||
/// until 'gd()' becomes false. |
|||
member While : guard:(unit -> bool) * computation:Async<unit> -> Async<unit> |
|||
|
|||
/// Specify an asynchronous computation that, when run, returns the result 'v' |
|||
member Return : value:'T -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'f()' |
|||
member Delay : generator:(unit -> Async<'T>) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'f(resource)'. |
|||
/// The action 'resource.Dispose()' is executed as this computation yields its result |
|||
/// or if the asynchronous computation exits by an exception or by cancellation. |
|||
member Using: resource:'T * binder:('T -> Async<'U>) -> Async<'U> when 'T :> System.IDisposable |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'p', and when |
|||
/// 'p' generates a result 'T', runs 'f res'. |
|||
member Bind: computation: Async<'T> * binder: ('T -> Async<'U>) -> Async<'U> |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'p'. The action 'f' is executed |
|||
/// after 'p' completes, whether 'p' exits normally or by an exception. If 'f' raises an exception itself |
|||
/// the original exception is discarded and the new exception becomes the overall result of the computation. |
|||
member TryFinally : computation:Async<'T> * compensation:(unit -> unit) -> Async<'T> |
|||
|
|||
/// Specify an asynchronous computation that, when run, runs 'p' and returns its result. |
|||
/// If an exception happens then 'f(exn)' is called and the resulting computation executed instead. |
|||
member TryWith : computation:Async<'T> * catchHandler:(exn -> Async<'T>) -> Async<'T> |
|||
|
|||
/// Generate an object used to build asynchronous computations using F# computation expressions. The value |
|||
/// 'async' is a pre-defined instance of this type. |
|||
internal new : unit -> AsyncBuilder |
|||
|
|||
|
|||
[<AutoOpen>] |
|||
/// A module of extension members that provide asynchronous operations for some basic .NET types related to concurrency and I/O. |
|||
module CommonExtensions = |
|||
open System.IO |
|||
|
|||
type System.IO.Stream with |
|||
|
|||
/// Return an asynchronous computation that will read from the stream into the given buffer. |
|||
member AsyncRead : buffer:byte[] * ?offset:int * ?count:int -> Async<int> |
|||
|
|||
/// Return an asynchronous computation that will read the given number of bytes from the stream |
|||
member AsyncRead : count:int -> Async<byte[]> |
|||
|
|||
/// Return an asynchronous computation that will write the given bytes to the stream |
|||
member AsyncWrite : buffer:byte[] * ?offset:int * ?count:int -> Async<unit> |
|||
|
|||
type System.Threading.WaitHandle with |
|||
/// Return an asynchronous computation that will wait on the given WaitHandle. This is scheduled |
|||
/// as a wait-item in the .NET thread pool using RegisterWaitForSingleObject, |
|||
/// meaning that the operation will not block any .NET threads for |
|||
/// the duration of the wait. |
|||
member AsyncWaitOne: ?millisecondsTimeout:int -> Async<bool> |
|||
|
|||
type System.Threading.Thread with |
|||
/// Return an asynchronous computation that will sleep for the given time. This is scheduled |
|||
/// using a System.Threading.Timer object, meaning that the operation will not block any threads |
|||
/// for the duration of the wait. |
|||
static member AsyncSleep : millisecondsDueTime:int -> Async<unit> |
|||
|
|||
#if FX_ATLEAST_40 |
|||
type System.Threading.Tasks.Task<'T> with |
|||
member AsyncValue : Async<'T> |
|||
#endif |
|||
|
|||
|
|||
[<Sealed>] |
|||
/// A handle to a capability to reply to a PostAndReply message |
|||
type AsyncReplyChannel<'Reply> = |
|||
/// Send a reply to a PostAndReply message |
|||
member Reply : value:'Reply -> unit |
|||
|
|||
/// A MailboxProcessor is a message-processing agent defined using an asynchronous workflow. |
|||
/// The agent encapsulates a message queue that supports multiple-writers and the single reader agent. |
|||
/// Writers send messages to the agent by using the Post, PostAndReply or AsyncPostAndReply methods. |
|||
/// |
|||
/// The reader agent is specified when creating the MailboxProcessor. The |
|||
/// agent is usually an asychronous workflow that waits for messages |
|||
/// by using the Receive or TryReceive methods. |
|||
/// A MailboxProcessor may also scan through all available messages by using the |
|||
/// Scan or TryScan method. The encapsulated message queue only |
|||
/// supports a single active reader, thus at most one concurrent call to Receive, TryReceive, |
|||
/// Scan and/or TryScan may be active at any one time. |
|||
|
|||
[<Sealed>] |
|||
[<AutoSerializable(false)>] |
|||
type MailboxProcessor<'Msg> = |
|||
|
|||
/// Create an instance of a MailboxProcessor. The asynchronous computation executed by the |
|||
/// processor is the one returned by the 'initial' function. This function is not executed until |
|||
/// 'Start' is called. |
|||
new : initial:(MailboxProcessor<'Msg> -> Async<unit>) * ?asyncGroup: AsyncGroup -> MailboxProcessor<'Msg> |
|||
|
|||
/// Create and start an instance of a MailboxProcessor. The asynchronous computation executed by the |
|||
/// processor is the one returned by the 'initial' function. |
|||
static member Start : initial:(MailboxProcessor<'Msg> -> Async<unit>) * ?asyncGroup: AsyncGroup -> MailboxProcessor<'Msg> |
|||
|
|||
/// Post a message to the message queue of the MailboxProcessor, asynchronously |
|||
member Post : message:'Msg -> unit |
|||
|
|||
/// Post a message to the message queue of the MailboxProcessor and await a reply on the channel synchronously. |
|||
/// The message is produced by a single call to the first function which must build a message |
|||
/// containing the reply channel. The receiving MailboxProcessor must process this message and |
|||
/// invoke the Reply method on the reply channel precisly once. |
|||
member PostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply |
|||
|
|||
/// Post a message to the message queue of the MailboxProcessor and await a reply on the channel asynchronously. |
|||
/// The message is produced by a single call to the first function which must build a message |
|||
/// containing the reply channel. The receiving MailboxProcessor must process this message and |
|||
/// invoke the Reply method on the reply channel precisly once. |
|||
member AsyncPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply> |
|||
|
|||
/// Like PostAndReply, but return None if no reply within the timeout period. |
|||
member TryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> 'Reply option |
|||
|
|||
/// Like AsyncPostAndReply, but return None if no reply within the timeout period. |
|||
member AsyncTryPostAndReply : buildMessage:(AsyncReplyChannel<'Reply> -> 'Msg) * ?timeout : int -> Async<'Reply option> |
|||
|
|||
/// Return an asynchronous computation which will |
|||
/// consume the first message in arrival order. No thread |
|||
/// is blocked while waiting for further messages. Raise a TimeoutException |
|||
/// if the timeout is exceeded. |
|||
member Receive : ?timeout:int -> Async<'Msg> |
|||
|
|||
/// Return an asynchronous computation which will |
|||
/// consume the first message in arrival order. No thread |
|||
/// is blocked while waiting for further messages. Return None |
|||
/// if the timeout is exceeded. |
|||
member TryReceive : ?timeout:int -> Async<'Msg option> |
|||
|
|||
/// Return an asynchronous computation which will |
|||
/// look through messages in arrival order until 'scanner' returns a Some value. No thread |
|||
/// is blocked while waiting for further messages. Raise a TimeoutException |
|||
/// if the timeout is exceeded. |
|||
member Scan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T> |
|||
|
|||
/// Return an asynchronous computation which will |
|||
/// look through messages in arrival order until 'scanner' returns a Some value. No thread |
|||
/// is blocked while waiting for further messages. Return None |
|||
/// if the timeout is exceeded. |
|||
member TryScan : scanner:('Msg -> (Async<'T>) option) * ?timeout:int -> Async<'T option> |
|||
|
|||
#if DEBUG |
|||
member UnsafeMessageQueueContents : obj |
|||
#endif |
|||
|
|||
/// Start the MailboxProcessor |
|||
member Start : unit -> unit |
|||
|
|||
/// Raise a timeout exception if a message not received in this amount of time. Default infinite. |
|||
member DefaultTimeout : int with get, set |
|||
|
|||
interface System.IDisposable |
|||
@ -1,158 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Control |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Control |
|||
open System.Reflection |
|||
open System.Diagnostics |
|||
|
|||
#if FX_NO_DELEGATE_DYNAMIC_METHOD |
|||
#else |
|||
|
|||
#if FX_NO_DELEGATE_DYNAMIC_INVOKE |
|||
module Impl = |
|||
type System.Delegate with |
|||
member d.DynamicInvoke(args: obj[]) = |
|||
d.Method.Invoke(d.Target, BindingFlags.Default ||| BindingFlags.Public ||| BindingFlags.NonPublic , null, args, null) |
|||
|
|||
open Impl |
|||
#endif |
|||
|
|||
type DelegateEvent<'Del when 'Del :> System.Delegate>() = |
|||
let mutable multicast : System.Delegate = null |
|||
member x.Trigger(args:obj[]) = |
|||
match multicast with |
|||
| null -> () |
|||
| d -> d.DynamicInvoke(args) |> ignore |
|||
member x.Publish = |
|||
{ new IDelegateEvent<'Del> with |
|||
member x.AddHandler(d) = |
|||
multicast <- System.Delegate.Combine(multicast, d) |
|||
member x.RemoveHandler(d) = |
|||
multicast <- System.Delegate.Remove(multicast, d) } |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId="Event")>] |
|||
type Event<'Del,'Args when 'Del : delegate<'Args,unit> and 'Del :> System.Delegate >() = |
|||
let mutable multicast : System.Delegate = null |
|||
static let argTypes = |
|||
let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly |
|||
let mi = typeof<'Del>.GetMethod("Invoke",instanceBindingFlags) |
|||
mi.GetParameters() |> (fun arr -> arr.[1..]) |> Array.map (fun p -> p.ParameterType) |
|||
|
|||
member x.Trigger(sender:obj,args:'Args) = |
|||
match multicast with |
|||
| null -> () |
|||
| d -> |
|||
if argTypes.Length = 1 then |
|||
d.DynamicInvoke([| sender; box args |]) |> ignore |
|||
else |
|||
d.DynamicInvoke(Array.append [| sender |] (Microsoft.FSharp.Reflection.FSharpValue.GetTupleFields(box args))) |> ignore |
|||
member x.Publish = |
|||
{ new IEvent<'Del,'Args> with |
|||
member x.Add(f) = |
|||
multicast <- System.Delegate.Combine(multicast, new Handler<'Args>(fun sender arg -> f arg)) |
|||
member x.AddHandler(d) = |
|||
multicast <- System.Delegate.Combine(multicast, d) |
|||
member x.RemoveHandler(d) = |
|||
multicast <- System.Delegate.Remove(multicast, d) } |
|||
#endif |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId="Event")>] |
|||
type Event<'T>() = |
|||
let mutable multicast : Handler<'T> option = None |
|||
member x.Delegate |
|||
with get () = match multicast with None -> null | Some(d) -> (d :> System.Delegate) |
|||
and set v = multicast <- (match v with null -> None | d -> Some d) |
|||
member x.Trigger(arg:'T) = |
|||
match multicast with |
|||
| None -> () |
|||
| Some d -> d.Invoke(null,arg) |> ignore |
|||
member x.Publish = |
|||
{ new IEvent<'T> with |
|||
member e.AddHandler(d) = |
|||
x.Delegate <- (System.Delegate.Combine(x.Delegate, d) :?> Handler<'T>) |
|||
member e.RemoveHandler(d) = |
|||
x.Delegate <- (System.Delegate.Remove(x.Delegate, d) :?> Handler<'T>) |
|||
member e.Add(f:'T -> unit) = |
|||
x.Delegate <- (System.Delegate.Combine(x.Delegate, new Handler<'T>(fun sender arg -> f arg)) :?> Handler<'T>) } |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Event = |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let create<'T>() = |
|||
let ev = new Event<'T>() |
|||
ev.Trigger, ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f (w: IEvent<'Del,'T>) = |
|||
let ev = new Event<_>() |
|||
w.Add(fun x -> ev.Trigger(f x)); |
|||
ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let filter f (w: IEvent<'Del,'T>) = |
|||
let ev = new Event<_>() |
|||
w.Add(fun x -> if f x then ev.Trigger x); |
|||
ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition f (w: IEvent<'Del,'T>) = |
|||
let ev1 = new Event<_>() |
|||
let ev2 = new Event<_>() |
|||
w.Add(fun x -> if f x then ev1.Trigger x else ev2.Trigger x); |
|||
ev1.Publish,ev2.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let choose f (w: IEvent<'Del,'T>) = |
|||
let ev = new Event<_>() |
|||
w.Add(fun x -> match f x with None -> () | Some r -> ev.Trigger r); |
|||
ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan f z (w: IEvent<'Del,'T>) = |
|||
let state = ref z |
|||
let ev = new Event<_>() |
|||
w.Add(fun msg -> |
|||
let z = !state |
|||
let z = f z msg |
|||
state := z; |
|||
ev.Trigger(z)); |
|||
ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let listen f (w: IEvent<'Del,'T>) = w.Add(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let pairwise (inp : IEvent<'Del,'T>) : IEvent<'T * 'T> = |
|||
let ev = new Event<'T * 'T>() |
|||
let lastArgs = ref None |
|||
inp.Add(fun args2 -> |
|||
(match !lastArgs with |
|||
| None -> () |
|||
| Some args1 -> ev.Trigger(args1,args2)); |
|||
lastArgs := Some args2); |
|||
|
|||
ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let merge (w1: IEvent<'Del1,'T>) (w2: IEvent<'Del2,'T>) = |
|||
let ev = new Event<_>() |
|||
w1.Add(fun x -> ev.Trigger(x)); |
|||
w2.Add(fun x -> ev.Trigger(x)); |
|||
ev.Publish |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let split (f : 'T -> Choice<'U1,'U2>) (w: IEvent<'Del,'T>) = |
|||
let ev1 = new Event<_>() |
|||
let ev2 = new Event<_>() |
|||
w.Add(fun x -> match f x with Choice1Of2 y -> ev1.Trigger(y) | Choice2Of2 z -> ev2.Trigger(z)); |
|||
ev1.Publish,ev2.Publish |
|||
|
|||
@ -1,99 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Control |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Control |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
#if FX_NO_DELEGATE_DYNAMIC_METHOD // not available on CompactFramework 2.0 |
|||
#else |
|||
/// Event implementations for an arbitrary type of delegate |
|||
type DelegateEvent<'Del when 'Del :> System.Delegate> = |
|||
/// Create an event object suitable for implementing an arbitrary type of delegate |
|||
new : unit -> DelegateEvent<'Del> |
|||
/// Trigger the event using the given parameters |
|||
member Trigger : args:obj[] -> unit |
|||
/// Publish the event as a first class event value |
|||
member Publish : IDelegateEvent<'Del> |
|||
|
|||
/// Event implementations for a delegate types following the standard .NET Framework convention of a first 'sender' argument |
|||
type Event<'Del,'Args when 'Del : delegate<'Args,unit> and 'Del :> System.Delegate > = |
|||
/// Create an event object suitable for delegate types following the standard .NET Framework convention of a first 'sender' argument |
|||
new : unit -> Event<'Del,'Args> |
|||
/// Trigger the event using the given sender object and parameters. The sender object may be <c>null</c>. |
|||
member Trigger : sender:obj * args:'Args -> unit |
|||
/// Publish the event as a first class event value |
|||
member Publish : IEvent<'Del,'Args> |
|||
|
|||
#endif |
|||
/// Event implementations for the IEvent<_> type |
|||
type Event<'T> = |
|||
/// Create an event object suitable for implementing for the IEvent<_> type |
|||
new : unit -> Event<'T> |
|||
/// Trigger the event using the given parameters |
|||
member Trigger : arg:'T -> unit |
|||
/// Publish the event as a first class event value |
|||
member Publish : IEvent<'T> |
|||
|
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
/// Basic operations on first class event objects. |
|||
module Event = |
|||
|
|||
/// Create an IEvent with no initial listeners. Two items are returned: |
|||
/// a function to invoke (trigger) the event, and the event that clients |
|||
/// can plug listeners into. |
|||
val create : unit -> ('T -> unit) * IEvent<'T> |
|||
|
|||
/// Fire the output event when either of the input events fire |
|||
val merge: event1:IEvent<'del1,'T> -> event2:IEvent<'del2,'T> -> IEvent<'T> |
|||
|
|||
/// Return a new event that passes values transformed by the given function |
|||
val map: mapping:('T -> 'U) -> sourceEvent:IEvent<'Del,'T> -> IEvent<'U> |
|||
|
|||
/// Return a new event that listens to the original event and triggers the resulting |
|||
/// event only when the argument to the event passes the given function |
|||
val filter: predicate:('T -> bool) -> sourceEvent:IEvent<'Del,'T> -> IEvent<'T> |
|||
|
|||
/// Return a new event that listens to the original event and triggers the |
|||
/// first resulting event if the application of the predicate to the event arguments |
|||
/// returned true, and the second event if it returned false |
|||
val partition: predicate:('T -> bool) -> sourceEvent:IEvent<'Del,'T> -> (IEvent<'T> * IEvent<'T>) |
|||
|
|||
/// Return a new event that listens to the original event and triggers the |
|||
/// first resulting event if the application of the function to the event arguments |
|||
/// returned a Choice1Of2, and the second event if it returns a Choice2Of2 |
|||
val split: splitter:('T -> Choice<'U1,'U2>) -> sourceEvent:IEvent<'Del,'T> -> (IEvent<'U1> * IEvent<'U2>) |
|||
|
|||
/// Return a new event which fires on a selection of messages from the original event. |
|||
/// The selection function takes an original message to an optional new message. |
|||
val choose: chooser:('T -> 'U option) -> sourceEvent:IEvent<'Del,'T> -> IEvent<'U> |
|||
|
|||
/// Return a new event consisting of the results of applying the given accumulating function |
|||
/// to successive values triggered on the input event. An item of internal state |
|||
/// records the current value of the state parameter. The internal state is not locked during the |
|||
/// execution of the accumulation function, so care should be taken that the |
|||
/// input IEvent not triggered by multiple threads simultaneously. |
|||
val scan: collector:('U -> 'T -> 'U) -> state:'U -> sourceEvent:IEvent<'Del,'T> -> IEvent<'U> |
|||
|
|||
/// Run the given function each time the given event is triggered. |
|||
val listen : callback:('T -> unit) -> sourceEvent:IEvent<'Del,'T> -> unit |
|||
|
|||
/// Return a new event that triggers on the second and subsequent triggerings of the input event. |
|||
/// The Nth triggering of the input event passes the arguments from the N-1th and Nth triggering as |
|||
/// a pair. The argument passed to the N-1th triggering is held in hidden internal state until the |
|||
/// Nth triggering occurs. |
|||
/// |
|||
/// You should ensure that the contents of the values being sent down the event are |
|||
/// not mutable. Note that many EventArgs types are mutable, e.g. MouseEventArgs, and |
|||
/// each firing of an event using this argument type may reuse the same physical |
|||
/// argument obejct with different values. In this case you should extract the necessary |
|||
/// information from the argument before using this combinator. |
|||
val pairwise: sourceEvent:IEvent<'Del,'T> -> IEvent<'T * 'T> |
|||
|
|||
@ -1,152 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
module Microsoft.FSharp.Core.ExtraTopLevelOperators |
|||
|
|||
open System |
|||
open System.Collections.Generic |
|||
open System.IO |
|||
open System.Diagnostics |
|||
open Microsoft.FSharp |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Text |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Control |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let seq (x : seq<_>) = (x :> seq<_>) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let set l = Collections.Set.of_seq l |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let dict l = |
|||
// Use a dictionary (this requires hashing and equality on the key type) |
|||
// Wrap keys in an Some(_) option in case they are null (when System.Collections.Generic.Dictionary fails). Sad but true. |
|||
let t = new Dictionary<Option<_>,_>(HashIdentity.Structural) |
|||
for (k,v) in l do |
|||
t.[Some(k)] <- v |
|||
let d = (t :> IDictionary<_,_>) |
|||
let c = (t :> ICollection<_>) |
|||
let ieg = (t :> IEnumerable<_>) |
|||
let ie = (t :> System.Collections.IEnumerable) |
|||
// Give a read-only view of the dictionary |
|||
{ new IDictionary<'key, 'a> with |
|||
member s.Item |
|||
with get x = d.[Some(x)] |
|||
and set (x,v) = raise (NotSupportedException("This value may not be mutated")) |
|||
member s.Keys = |
|||
let keys = d.Keys |
|||
{ new ICollection<'key> with |
|||
member s.Add(x) = raise (NotSupportedException("This value may not be mutated")); |
|||
member s.Clear() = raise (NotSupportedException("This value may not be mutated")); |
|||
member s.Remove(x) = raise (NotSupportedException("This value may not be mutated")); |
|||
member s.Contains(x) = keys.Contains(Some(x)) |
|||
member s.CopyTo(arr,i) = |
|||
let mutable n = 0 |
|||
for k in keys do |
|||
arr.[i+n] <- k.Value |
|||
n <- n + 1 |
|||
member s.IsReadOnly = true |
|||
member s.Count = keys.Count |
|||
interface IEnumerable<'key> with |
|||
member s.GetEnumerator() = (keys |> Seq.map (fun v -> v.Value)).GetEnumerator() |
|||
interface System.Collections.IEnumerable with |
|||
member s.GetEnumerator() = ((keys |> Seq.map (fun v -> v.Value)) :> System.Collections.IEnumerable).GetEnumerator() } |
|||
|
|||
member s.Values = d.Values |
|||
member s.Add(k,v) = raise (NotSupportedException("This value may not be mutated")) |
|||
member s.ContainsKey(k) = d.ContainsKey(Some(k)) |
|||
member s.TryGetValue(k,r) = |
|||
let key = Some(k) |
|||
if d.ContainsKey(key) then (r <- d.[key]; true) else false |
|||
member s.Remove(k : 'key) = (raise (NotSupportedException("This value may not be mutated")) : bool) |
|||
interface ICollection<KeyValuePair<'key, 'a>> with |
|||
member s.Add(x) = raise (NotSupportedException("This value may not be mutated")); |
|||
member s.Clear() = raise (NotSupportedException("This value may not be mutated")); |
|||
member s.Remove(x) = raise (NotSupportedException("This value may not be mutated")); |
|||
member s.Contains(KeyValue(k,v)) = c.Contains(KeyValuePair<_,_>(Some(k),v)) |
|||
member s.CopyTo(arr,i) = |
|||
let mutable n = 0 |
|||
for (KeyValue(k,v)) in c do |
|||
arr.[i+n] <- KeyValuePair<_,_>(k.Value,v) |
|||
n <- n + 1 |
|||
member s.IsReadOnly = true |
|||
member s.Count = c.Count |
|||
interface IEnumerable<KeyValuePair<'key, 'a>> with |
|||
member s.GetEnumerator() = |
|||
(c |> Seq.map (fun (KeyValue(k,v)) -> KeyValuePair<_,_>(k.Value,v))).GetEnumerator() |
|||
interface System.Collections.IEnumerable with |
|||
member s.GetEnumerator() = |
|||
((c |> Seq.map (fun (KeyValue(k,v)) -> KeyValuePair<_,_>(k.Value,v))) :> System.Collections.IEnumerable).GetEnumerator() } |
|||
|
|||
// -------------------------------------------------------------------- |
|||
// Printf |
|||
// -------------------------------------------------------------------- |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sprintf fp = Printf.sprintf fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let failwithf fp = Printf.failwithf fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fprintf (os:TextWriter) fp = Printf.fprintf os fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let printf fp = Printf.printf fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let eprintf fp = Printf.eprintf fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fprintfn (os:TextWriter) fp = Printf.fprintfn os fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let printfn fp = Printf.printfn fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let eprintfn fp = Printf.eprintfn fp |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let failwith s = raise (Failure s) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let output_any (oc: System.IO.TextWriter) x = Printf.fprintf oc "%A" x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let any_to_string x = Printf.sprintf "%A" x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let print_any x = Printf.printf "%A" x |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let async = new Microsoft.FSharp.Control.AsyncBuilder() |
|||
|
|||
#if FX_MINIMAL_REFLECTION // not on Compact Framework |
|||
#else |
|||
let (~%) (x:Microsoft.FSharp.Quotations.Expr<'a>) : 'a = failwith "first class uses of '%' are not permitted" |
|||
|
|||
let (~%%) (x: Microsoft.FSharp.Quotations.Expr) : 'a = failwith "first class uses of '%' are not permitted" |
|||
#endif |
|||
|
|||
[<assembly: AutoOpen("Microsoft.FSharp")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Core.Operators")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Core")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Collections")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Control")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Text")>] |
|||
[<assembly: AutoOpen("Microsoft.FSharp.Core.ExtraTopLevelOperators")>] |
|||
do() |
|||
|
|||
let Array2 = 1 |
|||
let Array3 = 1 |
|||
let IEvent = 1 |
|||
|
|||
let (|Lazy|) (x:Lazy<_>) = x.SynchronizedForce() |
|||
@ -1,79 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
///Pervasives: Additional bindings available at the top level |
|||
module Microsoft.FSharp.Core.ExtraTopLevelOperators |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Control |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Text |
|||
open Microsoft.FSharp.Math |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("Use 'sprintf' with a '%A' pattern instead")>] |
|||
val any_to_string: 'T -> string |
|||
|
|||
[<Obsolete("Use 'fprintf' with a '%A' pattern instead")>] |
|||
val output_any: System.IO.TextWriter -> 'T -> unit |
|||
|
|||
[<Obsolete("Use 'printf' with a '%A' pattern instead")>] |
|||
val print_any : 'T -> unit |
|||
#endif |
|||
|
|||
/// Print to <c>stdout</c> using the given format |
|||
val printf : format:Printf.TextWriterFormat<'T> -> 'T |
|||
/// Print to <c>stdout</c> using the given format, and add a newline |
|||
val printfn : format:Printf.TextWriterFormat<'T> -> 'T |
|||
/// Print to <c>stderr</c> using the given format |
|||
val eprintf : format:Printf.TextWriterFormat<'T> -> 'T |
|||
/// Print to <c>stderr</c> using the given format, and add a newline |
|||
val eprintfn : format:Printf.TextWriterFormat<'T> -> 'T |
|||
/// Print to a string using the given format |
|||
val sprintf : format:Printf.StringFormat<'T> -> 'T |
|||
/// Print to a string buffer and raise an exception with the given |
|||
/// result. Helper printers must return strings. |
|||
val failwithf: format:Printf.StringFormat<'T,'d> -> 'T |
|||
/// Print to a file using the given format |
|||
val fprintf : textWriter:System.IO.TextWriter -> format:Printf.TextWriterFormat<'T> -> 'T |
|||
/// Print to a file using the given format, and add a newline |
|||
val fprintfn : textWriter:System.IO.TextWriter -> format:Printf.TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Builds a set from a sequence of objects. The key objects are indexed using generic comparison |
|||
val set : elements:seq<'T> -> Set<'T> |
|||
|
|||
/// Build an aysnchronous workflow using computation expression syntax |
|||
val async : Microsoft.FSharp.Control.AsyncBuilder |
|||
|
|||
/// Builds a lookup table from a sequence of key/value pairs. The key objects are indexed using generic hashing and equality. |
|||
val dict : keyValuePairs:seq<'K * 'V> -> System.Collections.Generic.IDictionary <'K,'V> |
|||
|
|||
/// Builds a sequence using sequence expression syntax |
|||
val seq : sequence:seq<'T> -> seq<'T> |
|||
|
|||
#if FX_MINIMAL_REFLECTION // not on Compact Framework |
|||
#else |
|||
/// Special prefix operator for splicing typed expressions into quotation holes |
|||
val (~%) : expression:Microsoft.FSharp.Quotations.Expr<'T> -> 'T |
|||
|
|||
/// Special prefix operator for splicing untyped expressions into quotation holes |
|||
val (~%%) : expression:Microsoft.FSharp.Quotations.Expr -> 'T |
|||
#endif |
|||
|
|||
/// An active pattern to force the execution of values of type <c>Lazy<_></c> |
|||
val (|Lazy|) : input:Lazy<'T> -> 'T |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("The 'Array2' module has been renamed to 'Array2D'", true)>] |
|||
val Array2 : int |
|||
|
|||
[<Obsolete("The 'Array3' module has been renamed to 'Array3D'", true)>] |
|||
val Array3 : int |
|||
|
|||
[<Obsolete("The 'IEvent' module has been renamed to 'Event'", true)>] |
|||
val IEvent : int |
|||
#endif |
|||
@ -1,459 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System.Diagnostics |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Core.LanguagePrimitives |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
open System.Collections.Generic |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module List = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length (list: 'a list) = list.Length |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rev list = Microsoft.FSharp.Primitives.Basics.List.rev list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let concat list = Microsoft.FSharp.Primitives.Basics.List.concat list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f list = Microsoft.FSharp.Primitives.Basics.List.map f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi f list = Microsoft.FSharp.Primitives.Basics.List.mapi f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f list = Microsoft.FSharp.Primitives.Basics.List.iter f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_array (arr:'a array) = Microsoft.FSharp.Primitives.Basics.List.of_array arr |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_array (list:'a list) = Microsoft.FSharp.Primitives.Basics.List.to_array list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let empty<'a> = ([ ] : 'a list) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let hd list = match list with (x:: _) -> x | [] -> invalidArg "list" "the input list was Empty" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tl list = match list with (_ :: t) -> t | [] -> invalidArg "list" "the input list was Empty" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let isEmpty list = match list with [] -> true | _ -> false |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let append list1 list2 = list1 @ list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec nth list index = |
|||
match list with |
|||
| h::t when index >= 0 -> |
|||
if index = 0 then h else nth t (index - 1) |
|||
| _ -> |
|||
invalidArg "index" "the index was outside the range of elements in the list" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec chooseAllAcc f xs acc = |
|||
match xs with |
|||
| [] -> rev acc |
|||
| h :: t -> |
|||
match f h with |
|||
| None -> chooseAllAcc f t acc |
|||
| Some x -> chooseAllAcc f t (x::acc) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let choose f xs = chooseAllAcc f xs [] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri f list = Microsoft.FSharp.Primitives.Basics.List.iteri f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init n f = Microsoft.FSharp.Primitives.Basics.List.init n f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec initConstAcc n x acc = |
|||
if n <= 0 then acc else initConstAcc (n-1) x (x::acc) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let replicate count x = |
|||
if count < 0 then invalidArg "count" "the element count must be non-negative" |
|||
initConstAcc count x [] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter2 f list1 list2 = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let rec loop list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> () |
|||
| (h1::t1), (h2::t2) -> f.Invoke(h1,h2); loop t1 t2 |
|||
| _ -> invalidArg "list2" "the lists had different lengths" |
|||
loop list1 list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri2 f list1 list2 = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
let rec loop n list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> () |
|||
| (h1::t1), (h2::t2) -> f.Invoke(n,h1,h2); loop (n+1) t1 t2 |
|||
| _ -> invalidArg "list2" "the lists had different lengths" |
|||
loop 0 list1 list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec map3aux (f:OptimizedClosures.FastFunc3<_,_,_,_>) list1 list2 list3 acc = |
|||
match list1,list2,list3 with |
|||
| [],[],[] -> rev acc |
|||
| (h1::t1), (h2::t2),(h3::t3) -> let x = f.Invoke(h1,h2,h3) in map3aux f t1 t2 t3 (x :: acc) |
|||
| _ -> invalidArg "list3" "the lists had different lengths" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map3 f list1 list2 list3 = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
map3aux f list1 list2 list3 [] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec mapi2aux n (f:OptimizedClosures.FastFunc3<_,_,_,_>) list1 list2 acc = |
|||
match list1,list2 with |
|||
| [],[] -> rev acc |
|||
| (h1::t1), (h2::t2) -> let x = f.Invoke(n,h1,h2) in mapi2aux (n+1) f t1 t2 (x :: acc) |
|||
| _ -> invalidArg "list2" "the lists had different lengths" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi2 f list1 list2 = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
mapi2aux 0 f list1 list2 [] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map2 f list1 list2 = Microsoft.FSharp.Primitives.Basics.List.map2 f list1 list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold f s list = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let rec loop s list = |
|||
match list with |
|||
| [] -> s |
|||
| (h::t) -> loop (f.Invoke(s,h)) t |
|||
loop s list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduce f list = |
|||
match list with |
|||
| [] -> invalidArg "list" "the input list was Empty" |
|||
| (h::t) -> fold f h t |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan f s list = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let rec loop s list acc = |
|||
match list with |
|||
| [] -> rev acc |
|||
| (h::t) -> let s = f.Invoke(s,h) in loop s t (s :: acc) |
|||
loop s list [s] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold2 f acc list1 list2 = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
let rec loop acc list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> acc |
|||
| (h1::t1),(h2::t2) -> loop (f.Invoke(acc,h1,h2)) t1 t2 |
|||
| _ -> invalidArg "list2" "the lists had different lengths" |
|||
loop acc list1 list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldArraySubRight (f:OptimizedClosures.FastFunc2<'a,_,_>) (arr: 'a[]) start fin acc = |
|||
let mutable state = acc |
|||
for i = fin downto start do |
|||
state <- f.Invoke(arr.[i], state) |
|||
state |
|||
|
|||
(* this version doesn't causes stack overflow - it uses a private stack *) |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldBack f list acc = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
match list with |
|||
| [] -> acc |
|||
| [h] -> f.Invoke(h,acc) |
|||
| [h1;h2] -> f.Invoke(h1,f.Invoke(h2,acc)) |
|||
| [h1;h2;h3] -> f.Invoke(h1,f.Invoke(h2,f.Invoke(h3,acc))) |
|||
| [h1;h2;h3;h4] -> f.Invoke(h1,f.Invoke(h2,f.Invoke(h3,f.Invoke(h4,acc)))) |
|||
| _ -> |
|||
// It is faster to allocate and iterate an array than to create all those |
|||
// highly nested stacks. It also means we won't get stack overflows here. |
|||
let arr = to_array list |
|||
let arrn = arr.Length |
|||
foldArraySubRight f arr 0 (arrn - 1) acc |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduceBack f list = |
|||
match list with |
|||
| [] -> invalidArg "list" "the input list was Empty" |
|||
| _ -> |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let arr = to_array list |
|||
let arrn = arr.Length |
|||
foldArraySubRight f arr 0 (arrn - 2) arr.[arrn - 1] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scanArraySubRight<'a,'b> (f:OptimizedClosures.FastFunc2<'a,'b,'b>) (arr:_[]) start fin initState = |
|||
let mutable state = initState |
|||
let mutable res = [state] |
|||
for i = fin downto start do |
|||
state <- f.Invoke(arr.[i], state); |
|||
res <- state :: res |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scanBack f list s = |
|||
match list with |
|||
| [] -> [s] |
|||
| [h] -> |
|||
[f h s; s] |
|||
| _ -> |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
// It is faster to allocate and iterate an array than to create all those |
|||
// highly nested stacks. It also means we won't get stack overflows here. |
|||
let arr = to_array list |
|||
let arrn = arr.Length |
|||
scanArraySubRight f arr 0 (arrn - 1) s |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec foldBack2UsingArrays (f:OptimizedClosures.FastFunc3<_,_,_,_>) list1 list2 acc = |
|||
let arr1 = to_array list1 |
|||
let arr2 = to_array list2 |
|||
let n1 = arr1.Length |
|||
let n2 = arr2.Length |
|||
if n1 <> n2 then invalidArg "list2" "the input lists had different lengths"; |
|||
let mutable res = acc |
|||
for i = n1 - 1 downto 0 do |
|||
res <- f.Invoke(arr1.[i],arr2.[i],res) |
|||
res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec foldBack2 f list1 list2 acc = |
|||
match list1,list2 with |
|||
| [],[] -> acc |
|||
| h1::rest1, k1::rest2 -> |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
match rest1, rest2 with |
|||
| [],[] -> f.Invoke(h1,k1,acc) |
|||
| [h2],[k2] -> f.Invoke(h1,k1,f.Invoke(h2,k2,acc)) |
|||
| [h2;h3],[k2;k3] -> f.Invoke(h1,k1,f.Invoke(h2,k2,f.Invoke(h3,k3,acc))) |
|||
| [h2;h3;h4],[k2;k3;k4] -> f.Invoke(h1,k1,f.Invoke(h2,k2,f.Invoke(h3,k3,f.Invoke(h4,k4,acc)))) |
|||
| _ -> foldBack2UsingArrays f list1 list2 acc |
|||
| _ -> invalidArg "list2" "the input lists had different lengths" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec forall2aux (f:OptimizedClosures.FastFunc2<_,_,_>) list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> true |
|||
| (h1::t1),(h2::t2) -> f.Invoke(h1,h2) && forall2aux f t1 t2 |
|||
| _ -> invalidArg "list2" "the input lists had different lengths" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall2 f list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> true |
|||
| _ -> |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
forall2aux f list1 list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall f list1 = Microsoft.FSharp.Primitives.Basics.List.forall f list1 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists f list1 = Microsoft.FSharp.Primitives.Basics.List.exists f list1 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec exists2aux (f:OptimizedClosures.FastFunc2<_,_,_>) list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> false |
|||
| (h1::t1),(h2::t2) ->f.Invoke(h1,h2) || exists2aux f t1 t2 |
|||
| _ -> invalidArg "list2" "the input lists had different lengths" |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec exists2 f list1 list2 = |
|||
match list1,list2 with |
|||
| [],[] -> false |
|||
| _ -> |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
exists2aux f list1 list2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec find f list = match list with [] -> raise (System.Collections.Generic.KeyNotFoundException()) | h::t -> if f h then h else find f t |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec tryFind f list = match list with [] -> None | h::t -> if f h then Some h else tryFind f t |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec tryPick f list = match list with [] -> None | h::t -> match f h with None -> tryPick f t | r -> r |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let rec pick f list = match list with [] -> raise (System.Collections.Generic.KeyNotFoundException()) | h::t -> match f h with None -> pick f t | Some r -> r |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let filter f x = Microsoft.FSharp.Primitives.Basics.List.filter f x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition p x = Microsoft.FSharp.Primitives.Basics.List.partition p x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let unzip x = Microsoft.FSharp.Primitives.Basics.List.unzip x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let unzip3 x = Microsoft.FSharp.Primitives.Basics.List.unzip3 x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zip x1 x2 = Microsoft.FSharp.Primitives.Basics.List.zip x1 x2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let zip3 x1 x2 x3 = Microsoft.FSharp.Primitives.Basics.List.zip3 x1 x2 x3 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortWith cmp xs = Microsoft.FSharp.Primitives.Basics.List.sortWith cmp xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sortBy f list = sortWith (fun x y -> Operators.compare (f x) (f y)) list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sort list = sortWith Operators.compare list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_list list = Seq.of_list list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_seq ie = Seq.to_list ie |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_seq ie = Seq.of_list ie |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let findIndex f list = |
|||
let rec loop n = function[] -> raise (System.Collections.Generic.KeyNotFoundException()) | h::t -> if f h then n else loop (n+1) t |
|||
loop 0 list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryFindIndex f list = |
|||
let rec loop n = function[] -> None | h::t -> if f h then Some n else loop (n+1) t |
|||
loop 0 list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline sum (list:list<_>) = Seq.sum list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline sumBy f (list:list<_>) = Seq.sumBy f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let max (list:list<_>) = Seq.max list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let maxBy f (list:list<_>) = Seq.maxBy f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let min (list:list<_>) = Seq.min list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let minBy f (list:list<_>) = Seq.minBy f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline average (list:list<_>) = Seq.average list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline averageBy f (list:list<_>) = Seq.averageBy f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let collect f list = Microsoft.FSharp.Primitives.Basics.List.collect f list |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let permute indexMap list = list |> to_array |> Array.permute indexMap |> of_array |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let is_empty xs = isEmpty xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left f z xs = fold f z xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left2 f z xs1 xs2 = fold2 f z xs1 xs2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right f xs z = foldBack f xs z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right2 f xs1 xs2 z = foldBack2 f xs1 xs2 z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduce_left f xs = reduce f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let reduce_right f xs = reduceBack f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan_left f z xs = scan f z xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let scan_right f xs z = scanBack f xs z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all f xs = forall f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all2 f xs1 xs2 = forall2 f xs1 xs2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let first f xs = tryPick f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find_index f xs = findIndex f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind f xs = tryFind f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind_index f xs = tryFindIndex f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sort_by f xs = sortBy f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline sum_by f xs = sumBy f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline average_by f xs = averageBy f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let min_by f xs = minBy f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let max_by f xs = maxBy f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map_concat f xs = collect f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let stable_sort f xs = sortWith f xs |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let split x = unzip x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let combine x1 x2 = zip x1 x2 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find_all f x = filter f x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let flatten (list:seq<list<_>>) = concat list |
|||
|
|||
@ -1,372 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Collections.Generic |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
/// Basic operations on lists. |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module List = |
|||
|
|||
/// Return a new list that contains the elements of the first list |
|||
/// followed by elements of the second |
|||
val append: list1:'T list -> list2:'T list -> 'T list |
|||
|
|||
/// Return the average of the elements in the list. |
|||
/// If the list is empty an ArgumentException is thrown. |
|||
val inline average : list:^T list -> ^T |
|||
when ^T : (static member ( + ) : ^T * ^T -> ^T) |
|||
and ^T : (static member DivideByInt : ^T*int -> ^T) |
|||
and ^T : (static member Zero : ^T) |
|||
|
|||
/// Return the average of the elements generated by applying the function to each element of the list. |
|||
/// If the list is empty an ArgumentException is thrown. |
|||
val inline averageBy : projection:('T -> ^U) -> list:'T list -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member DivideByInt : ^U*int -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
/// Apply the given function to each element of the list. Return |
|||
/// the list comprised of the results <c>x</c> for each element where |
|||
/// the function returns Some(x) |
|||
val choose: chooser:('T -> 'U option) -> list:'T list -> 'U list |
|||
|
|||
/// For each element of the list, apply the given function. Concatenate all the results and return the combined list. |
|||
val collect: mapping:('T -> 'U list) -> list:'T list -> 'U list |
|||
|
|||
/// Return a new list that contains the elements of each the lists in order |
|||
val concat: lists:seq<'T list> -> 'T list |
|||
|
|||
/// Return an empty list of the given type |
|||
[<GeneralizableValue>] |
|||
val empty<'T> : 'T list |
|||
|
|||
/// Test if any element of the list satisfies the given predicate. |
|||
/// |
|||
/// The predicate is applied to the elements of the input list. If any application |
|||
/// returns true then the overall result is true and no further elements are tested. |
|||
/// Otherwise, false is returned. |
|||
val exists: predicate:('T -> bool) -> list:'T list -> bool |
|||
|
|||
/// Test if any pair of corresponding elements of the lists satisfies the given predicate. |
|||
/// |
|||
/// The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
/// two lengths of the collections. If any application returns true then the overall result is |
|||
/// true and no further elements are tested. Otherwise, if one collections is longer |
|||
/// than the other then the <c>ArgumentException</c> exception is raised. |
|||
/// Otherwise, false is returned. |
|||
val exists2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool |
|||
|
|||
/// Return the first element for which the given function returns <c>true</c>. |
|||
/// Raise <c>KeyNotFoundException</c> if no such element exists. |
|||
val find: predicate:('T -> bool) -> list:'T list -> 'T |
|||
|
|||
/// Return the index of the first element in the list |
|||
/// that satisfies the given predicate. |
|||
/// Raise <c>KeyNotFoundException</c> if no such element exists. |
|||
val findIndex: predicate:('T -> bool) -> list:'T list -> int |
|||
|
|||
/// Return a new collection containing only the elements of the collection |
|||
/// for which the given predicate returns "true" |
|||
val filter: predicate:('T -> bool) -> list:'T list -> 'T list |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. Take the second argument, and apply the function to it |
|||
/// and the first element of the list. Then feed this result into the function along |
|||
/// with the second element and so on. Return the final result. |
|||
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> then |
|||
/// computes <c>f (... (f s i0) i1 ...) iN</c> |
|||
val fold: folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State |
|||
|
|||
/// Apply a function to corresponding elements of two collections, threading an accumulator argument |
|||
/// through the computation. The collections must have identical sizes. |
|||
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and <c>j0...jN</c> |
|||
/// then computes <c>f (... (f s i0 j0)...) iN jN</c>. |
|||
val fold2: folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then |
|||
/// computes <c>f i0 (...(f iN s))</c>. |
|||
val foldBack: folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State |
|||
|
|||
/// Apply a function to corresponding elements of two collections, threading an accumulator argument |
|||
/// through the computation. The collections must have identical sizes. |
|||
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and <c>j0...jN</c> |
|||
/// then computes <c>f i0 j0 (...(f iN jN s))</c>. |
|||
val foldBack2: folder:('T1 -> 'T2 -> 'State -> 'State) -> list1:'T1 list -> list2:'T2 list -> state:'State -> 'State |
|||
|
|||
/// Test if all elements of the collection satisfy the given predicate. |
|||
/// |
|||
/// The predicate is applied to the elements of the input list. If any application |
|||
/// returns false then the overall result is false and no further elements are tested. |
|||
/// Otherwise, true is returned. |
|||
val forall: predicate:('T -> bool) -> list:'T list -> bool |
|||
|
|||
/// Test if all corresponding elements of the collection satisfy the given predicate pairwise. |
|||
/// |
|||
/// The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
/// two lengths of the collections. If any application returns false then the overall result is |
|||
/// false and no further elements are tested. Otherwise, if one collection is longer |
|||
/// than the other then the <c>ArgumentException</c> exception is raised. |
|||
/// Otherwise, true is returned. |
|||
val forall2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool |
|||
|
|||
/// Return the first element of the list. Raise (Invalid_argument "hd") if undefined. |
|||
val hd: list:'T list -> 'T |
|||
|
|||
/// Create a list by calling the given generator on each index |
|||
val init: length:int -> initializer:(int -> 'T) -> 'T list |
|||
|
|||
/// Return true if the list contains no elements, false otherwise |
|||
val isEmpty: list:'T list -> bool |
|||
|
|||
/// Apply the given function to each element of the collection. |
|||
val iter: action:('T -> unit) -> list:'T list -> unit |
|||
|
|||
/// Apply the given function to two collections simultaneously. The |
|||
/// collections must have identical size. |
|||
val iter2: action:('T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit |
|||
|
|||
/// Apply the given function to each element of the collection. The integer passed to the |
|||
/// function indicates the index of element. |
|||
val iteri: action:(int -> 'T -> unit) -> list:'T list -> unit |
|||
|
|||
/// Apply the given function to two collections simultaneously. The |
|||
/// collections must have identical size. The integer passed to the |
|||
/// function indicates the index of element. |
|||
val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit |
|||
|
|||
/// Return the length of the list |
|||
val length: list:'T list -> int |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to each of the elements of the collection. |
|||
val map: mapping:('T -> 'U) -> list:'T list -> 'U list |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to the corresponding elements of the two collections pairwise. |
|||
val map2: mapping:('T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to the corresponding elements of the three collections simultaneously. |
|||
val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> 'U list |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to each of the elements of the collection. The integer index passed to the |
|||
/// function indicates the index (from 0) of element being transformed. |
|||
val mapi: mapping:(int -> 'T -> 'U) -> list:'T list -> 'U list |
|||
|
|||
/// Like mapi, but mapping corresponding elements from two lists of equal length. |
|||
val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list |
|||
|
|||
/// Return the greatest of all elements of the list, compared via Operators.max |
|||
val max : list:'T list -> 'T |
|||
|
|||
/// Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
val maxBy : projection:('T -> 'U) -> list:'T list -> 'T |
|||
|
|||
/// Return the lowest of all elements of the list, compared via Operators.min |
|||
val min : list:'T list -> 'T |
|||
|
|||
/// Return the lowest of all elements of the array, compared via Operators.min on the function result |
|||
val minBy : projection:('T -> 'U) -> list:'T list -> 'T |
|||
|
|||
/// Index into the list. The first element has index 0. |
|||
val nth: list:'T list -> index:int -> 'T |
|||
|
|||
/// Build a collection from the given array |
|||
val of_array : array:'T array -> 'T list |
|||
|
|||
/// Build a new collection from the given enumerable object |
|||
val of_seq: elements:seq<'T> -> 'T list |
|||
|
|||
/// Split the collection into two collections, containing the |
|||
/// elements for which the given predicate returns <c>true</c> and <c>false</c> |
|||
/// respectively |
|||
val partition: predicate:('T -> bool) -> list:'T list -> ('T list * 'T list) |
|||
|
|||
/// Apply the given function to successive elements, returning the first |
|||
/// result where function returns <c>Some(x)</c> for some x. If no such |
|||
/// element exists then raise <c>System.Collections.Generic.KeyNotFoundException</c> |
|||
val pick: chooser:('T -> 'U option) -> list:'T list -> 'U |
|||
|
|||
/// Returns a list with all elements permuted according to the |
|||
/// specified permutation |
|||
val permute : indexMap:(int -> int) -> list:'T list -> 'T list |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. Apply the function to the first two elements of the list. |
|||
/// Then feed this result into the function along with the third element and so on. |
|||
/// Return the final result. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then computes |
|||
/// <c>f (... (f i0 i1) i2 ...) iN</c>. |
|||
/// Raises ArgumentException if the list has no elements. |
|||
val reduce: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then computes |
|||
/// <c>f i0 (...(f iN-1 iN))</c>. |
|||
/// Raises ArgumentException if the list has no elements. |
|||
val reduceBack: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T |
|||
|
|||
/// Create a list by calling the given generator on each index |
|||
val replicate: count:int -> initial:'T -> 'T list |
|||
|
|||
/// Return a new list with the elements in reverse order |
|||
val rev: list:'T list -> 'T list |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. Take the second argument, and apply the function to it |
|||
/// and the first element of the list. Then feed this result into the function along |
|||
/// with the second element and so on. Return the list of intermediate results and the final result. |
|||
val scan : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State list |
|||
|
|||
/// Like <c>foldBack</c>, but return both the intermediary and final results |
|||
val scanBack : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State list |
|||
|
|||
/// Sort the given list using the given comparison function |
|||
val sortWith: comparer:('T -> 'T -> int) -> list:'T list -> 'T list |
|||
|
|||
/// Sort the given list using keys given by the given projection. Keys are compared using Operators.compare. |
|||
val sortBy: projection:('T -> 'U) -> list:'T list -> 'T list |
|||
|
|||
/// Sort the given list using the given comparison function |
|||
val sort: list:'T list -> 'T list |
|||
|
|||
/// Return the sum of the elements in the list |
|||
val inline sum : list:^T list -> ^T |
|||
when ^T : (static member ( + ) : ^T * ^T -> ^T) |
|||
and ^T : (static member Zero : ^T) |
|||
|
|||
/// Return the sum of the results generated by applying the function to each element of the list. |
|||
val inline sumBy : projection:('T -> ^U) -> list:'T list -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
/// Return the tail of the list. Raise (Invalid_argument "tl") if undefined. |
|||
val tl: list:'T list -> 'T list |
|||
|
|||
/// Build an array from the given collection |
|||
val to_array: list:'T list -> 'T array |
|||
|
|||
/// Build a new collection from the given enumerable object |
|||
val to_seq: list:list<'T> -> seq<'T> |
|||
|
|||
/// Apply the given function to successive elements, returning <c>Some(x)</c> the first |
|||
/// result where function returns <c>Some(x)</c> for some x. If no such element |
|||
/// exists then return <c>None</c> |
|||
val tryPick: chooser:('T -> 'U option) -> list:'T list -> 'U option |
|||
|
|||
/// Return the first element for which the given function returns <c>true</c>. |
|||
/// Return <c>None</c> if no such element exists. |
|||
val tryFind: predicate:('T -> bool) -> list:'T list -> 'T option |
|||
|
|||
/// Return the index of the first element in the list |
|||
/// that satisfies the given predicate. |
|||
/// Return <c>None</c> if no such element exists. |
|||
val tryFindIndex: predicate:('T -> bool) -> list:'T list -> int option |
|||
|
|||
/// Split a list of pairs into two lists |
|||
val unzip: list:('T1 * 'T2) list -> ('T1 list * 'T2 list) |
|||
|
|||
/// Split a list of triples into three lists |
|||
val unzip3: list:('T1 * 'T2 * 'T3) list -> ('T1 list * 'T2 list * 'T3 list) |
|||
|
|||
/// Combine the two lists into a list of pairs. The two lists must have equal lengths. |
|||
val zip: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list |
|||
|
|||
/// Combine the three lists into a list of triples. The lists must have equal lengths. |
|||
val zip3: list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> ('T1 * 'T2 * 'T3) list |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'averageBy' instead")>] |
|||
val inline average_by : projection:('T -> ^U) -> list:'T list -> ^U when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member DivideByInt : ^U*int -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'collect' instead")>] |
|||
val map_concat: mapping:('T -> 'U list) -> list:'T list -> 'U list |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'concat' instead")>] |
|||
val flatten: lists:seq<'T list> -> 'T list |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'findIndex' instead")>] |
|||
val find_index: predicate:('T -> bool) -> list:'T list -> int |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'filter' instead")>] |
|||
val find_all: predicate:('T -> bool) -> list:'T list -> 'T list |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'fold2' instead")>] |
|||
val fold_left2: folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right: folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'foldBack2' instead")>] |
|||
val fold_right2: folder:('T1 -> 'T2 -> 'State -> 'State) -> list1:'T1 list -> list2:'T2 list -> state:'State -> 'State |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:('T -> bool) -> list:'T list -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall2' instead")>] |
|||
val for_all2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'isEmpty' instead")>] |
|||
val is_empty: list:'T list -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'maxBy' instead")>] |
|||
val max_by : projection:('T -> 'U) -> list:'T list -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'minBy' instead")>] |
|||
val min_by : projection:('T -> 'U) -> list:'T list -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'reduce' instead")>] |
|||
val reduce_left: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'reduceBack' instead")>] |
|||
val reduce_right: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'scan' instead")>] |
|||
val scan_left : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State list |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'scanBack' instead")>] |
|||
val scan_right : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State list |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'sortBy' instead")>] |
|||
val sort_by: projection:('T -> 'U) -> list:'T list -> 'T list |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'sortWith' instead")>] |
|||
val stable_sort: list: ('T -> 'T -> int) -> 'T list -> 'T list |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'sumBy' instead")>] |
|||
val inline sum_by : projection:('T -> ^U) -> list:'T list -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryPick' instead")>] |
|||
val first: chooser:('T -> 'U option) -> list:'T list -> 'U option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFind' instead")>] |
|||
val tryfind: predicate:('T -> bool) -> list:'T list -> 'T option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFindIndex' instead")>] |
|||
val tryfind_index: predicate:('T -> bool) -> list:'T list -> int option |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'unzip' instead")>] |
|||
val split: list:('T1 * 'T2) list -> ('T1 list * 'T2 list) |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'zip' instead")>] |
|||
val combine: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list |
|||
|
|||
#endif |
|||
|
|||
|
|||
@ -1,483 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Primitives.Basics |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core.Operators |
|||
open System.Diagnostics.CodeAnalysis |
|||
open System.Collections.Generic |
|||
open System.Runtime.InteropServices |
|||
|
|||
|
|||
module internal List = |
|||
|
|||
let arrayZeroCreate (n:int) = (# "newarr !0" type ('a) n : 'a array #) |
|||
|
|||
[<SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")>] |
|||
let nonempty x = match x with [] -> false | _ -> true |
|||
|
|||
let rec iter f x = match x with [] -> () | (h::t) -> f h; iter f t |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let inline setFreshConsTail cons t = cons.(::).1 <- t |
|||
let inline freshConsNoTail h = h :: (# "ldnull" : 'a list #) |
|||
|
|||
|
|||
let rec mapToFreshConsTail cons f x = |
|||
match x with |
|||
| [] -> |
|||
setFreshConsTail cons []; |
|||
| (h::t) -> |
|||
let cons2 = freshConsNoTail (f h) |
|||
setFreshConsTail cons cons2; |
|||
mapToFreshConsTail cons2 f t |
|||
|
|||
let map f x = |
|||
match x with |
|||
| [] -> [] |
|||
| [h] -> [f h] |
|||
| (h::t) -> |
|||
let cons = freshConsNoTail (f h) |
|||
mapToFreshConsTail cons f t |
|||
cons |
|||
|
|||
let rec mapiToFreshConsTail cons (f:OptimizedClosures.FastFunc2<_,_,_>) x i = |
|||
match x with |
|||
| [] -> |
|||
setFreshConsTail cons []; |
|||
| (h::t) -> |
|||
let cons2 = freshConsNoTail (f.Invoke(i,h)) |
|||
setFreshConsTail cons cons2; |
|||
mapiToFreshConsTail cons2 f t (i+1) |
|||
|
|||
let mapi f x = |
|||
match x with |
|||
| [] -> [] |
|||
| [h] -> [f 0 h] |
|||
| (h::t) -> |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let cons = freshConsNoTail (f.Invoke(0,h)) |
|||
mapiToFreshConsTail cons f t 1 |
|||
cons |
|||
|
|||
let rec map2ToFreshConsTail cons (f:OptimizedClosures.FastFunc2<_,_,_>) xs1 xs2 = |
|||
match xs1,xs2 with |
|||
| [],[] -> |
|||
setFreshConsTail cons []; |
|||
| (h1::t1),(h2::t2) -> |
|||
let cons2 = freshConsNoTail (f.Invoke(h1,h2)) |
|||
setFreshConsTail cons cons2; |
|||
map2ToFreshConsTail cons2 f t1 t2 |
|||
| _ -> invalidArg "xs2" "the lists had different lengths" |
|||
|
|||
let map2 f xs1 xs2 = |
|||
match xs1,xs2 with |
|||
| [],[] -> [] |
|||
| (h1::t1),(h2::t2) -> |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let cons = freshConsNoTail (f.Invoke(h1,h2)) |
|||
map2ToFreshConsTail cons f t1 t2 |
|||
cons |
|||
| _ -> invalidArg "xs2" "the lists had different lengths" |
|||
|
|||
let rec forall f xs1 = |
|||
match xs1 with |
|||
| [] -> true |
|||
| (h1::t1) -> f h1 && forall f t1 |
|||
|
|||
let rec exists f xs1 = |
|||
match xs1 with |
|||
| [] -> false |
|||
| (h1::t1) -> f h1 || exists f t1 |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec revAcc xs acc = |
|||
match xs with |
|||
| [] -> acc |
|||
| h::t -> revAcc t (h::acc) |
|||
|
|||
let rev xs = |
|||
match xs with |
|||
| [] -> xs |
|||
| [h] -> xs |
|||
| h1::h2::t -> revAcc t [h2;h1] |
|||
|
|||
// return the last cons it the chain |
|||
let rec appendToFreshConsTail cons xs = |
|||
match xs with |
|||
| [] -> |
|||
setFreshConsTail cons [] |
|||
cons |
|||
| h::t -> |
|||
let cons2 = freshConsNoTail h |
|||
setFreshConsTail cons cons2 |
|||
appendToFreshConsTail cons2 t |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec collectToFreshConsTail (f:'a -> 'b list) (list:'a list) cons = |
|||
match list with |
|||
| [] -> |
|||
setFreshConsTail cons [] |
|||
| h::t -> |
|||
collectToFreshConsTail f t (appendToFreshConsTail cons (f h)) |
|||
|
|||
let rec collect (f:'a -> 'b list) (list:'a list) = |
|||
match list with |
|||
| [] -> [] |
|||
| [h] -> f h |
|||
| _ -> |
|||
let cons = freshConsNoTail (Unchecked.defaultof<'b>) |
|||
collectToFreshConsTail f list cons |
|||
cons.Tail |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec filterToFreshConsTail cons f l = |
|||
match l with |
|||
| [] -> |
|||
setFreshConsTail cons []; |
|||
| h::t -> |
|||
if f h then |
|||
let cons2 = freshConsNoTail h |
|||
setFreshConsTail cons cons2; |
|||
filterToFreshConsTail cons2 f t |
|||
else |
|||
filterToFreshConsTail cons f t |
|||
|
|||
let rec filter f l = |
|||
match l with |
|||
| [] -> [] |
|||
| [h] -> if f h then l else [] |
|||
| h::t -> |
|||
if f h then |
|||
let cons = freshConsNoTail h |
|||
filterToFreshConsTail cons f t; |
|||
cons |
|||
else |
|||
filter f t |
|||
|
|||
let iteri f x = |
|||
let f = OptimizedClosures.FastFunc2<_,_,_>.Adapt(f) |
|||
let rec loop n x = match x with [] -> () | (h::t) -> f.Invoke(n,h); loop (n+1) t |
|||
loop 0 x |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec concatToFreshConsTail cons h1 l = |
|||
match l with |
|||
| [] -> setFreshConsTail cons h1 |
|||
| h2::t -> concatToFreshConsTail (appendToFreshConsTail cons h1) h2 t |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec concatToEmpty l = |
|||
match l with |
|||
| [] -> [] |
|||
| []::t -> concatToEmpty t |
|||
| (h::t1)::tt2 -> |
|||
let res = freshConsNoTail h |
|||
concatToFreshConsTail res t1 tt2; |
|||
res |
|||
|
|||
let seqToList (e : IEnumerable<'T>) = |
|||
match e with |
|||
| :? list<'T> as l -> l |
|||
| _ -> |
|||
use ie = e.GetEnumerator() |
|||
let mutable res = [] |
|||
while ie.MoveNext() do |
|||
res <- ie.Current :: res |
|||
rev res |
|||
|
|||
let concat (l : seq<_>) = |
|||
match seqToList l with |
|||
| [] -> [] |
|||
| [h] -> h |
|||
| [h1;h2] -> h1 @ h2 |
|||
| l -> concatToEmpty l |
|||
|
|||
let rec initToFreshConsTail cons i n f = |
|||
if i < n then |
|||
let cons2 = freshConsNoTail (f i) |
|||
setFreshConsTail cons cons2; |
|||
initToFreshConsTail cons2 (i+1) n f |
|||
else |
|||
setFreshConsTail cons [] |
|||
|
|||
|
|||
let init n f = |
|||
if n < 0 then invalidArg "n" "the length may not be negative" |
|||
if n = 0 then [] |
|||
else |
|||
let res = freshConsNoTail (f 0) |
|||
initToFreshConsTail res 1 n f |
|||
res |
|||
|
|||
|
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec partitionToFreshConsTails consL consR p l = |
|||
match l with |
|||
| [] -> |
|||
setFreshConsTail consL []; |
|||
setFreshConsTail consR []; |
|||
|
|||
| h::t -> |
|||
let cons' = freshConsNoTail h |
|||
if p h then |
|||
setFreshConsTail consL cons'; |
|||
partitionToFreshConsTails cons' consR p t |
|||
else |
|||
setFreshConsTail consR cons'; |
|||
partitionToFreshConsTails consL cons' p t |
|||
|
|||
let rec partitionToFreshConsTailLeft consL p l = |
|||
match l with |
|||
| [] -> |
|||
setFreshConsTail consL []; |
|||
[] |
|||
| h::t -> |
|||
let cons' = freshConsNoTail h |
|||
if p h then |
|||
setFreshConsTail consL cons'; |
|||
partitionToFreshConsTailLeft cons' p t |
|||
else |
|||
partitionToFreshConsTails consL cons' p t; |
|||
cons' |
|||
|
|||
let rec partitionToFreshConsTailRight consR p l = |
|||
match l with |
|||
| [] -> |
|||
setFreshConsTail consR []; |
|||
[] |
|||
| h::t -> |
|||
let cons' = freshConsNoTail h |
|||
if p h then |
|||
partitionToFreshConsTails cons' consR p t; |
|||
cons' |
|||
else |
|||
setFreshConsTail consR cons'; |
|||
partitionToFreshConsTailRight cons' p t |
|||
|
|||
let partition p l = |
|||
match l with |
|||
| [] -> [],[] |
|||
| [h] -> if p h then l,[] else [],l |
|||
| h::t -> |
|||
let cons = freshConsNoTail h |
|||
if p h |
|||
then cons, (partitionToFreshConsTailLeft cons p t) |
|||
else (partitionToFreshConsTailRight cons p t), cons |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec unzipToFreshConsTail cons1a cons1b x = |
|||
match x with |
|||
| [] -> |
|||
setFreshConsTail cons1a [] |
|||
setFreshConsTail cons1b [] |
|||
| ((h1,h2)::t) -> |
|||
let cons2a = freshConsNoTail h1 |
|||
let cons2b = freshConsNoTail h2 |
|||
setFreshConsTail cons1a cons2a; |
|||
setFreshConsTail cons1b cons2b; |
|||
unzipToFreshConsTail cons2a cons2b t |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let unzip x = |
|||
match x with |
|||
| [] -> |
|||
[],[] |
|||
| ((h1,h2)::t) -> |
|||
let res1a = freshConsNoTail h1 |
|||
let res1b = freshConsNoTail h2 |
|||
unzipToFreshConsTail res1a res1b t; |
|||
res1a,res1b |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec unzip3ToFreshConsTail cons1a cons1b cons1c x = |
|||
match x with |
|||
| [] -> |
|||
setFreshConsTail cons1a []; |
|||
setFreshConsTail cons1b []; |
|||
setFreshConsTail cons1c []; |
|||
| ((h1,h2,h3)::t) -> |
|||
let cons2a = freshConsNoTail h1 |
|||
let cons2b = freshConsNoTail h2 |
|||
let cons2c = freshConsNoTail h3 |
|||
setFreshConsTail cons1a cons2a; |
|||
setFreshConsTail cons1b cons2b; |
|||
setFreshConsTail cons1c cons2c; |
|||
unzip3ToFreshConsTail cons2a cons2b cons2c t |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let unzip3 x = |
|||
match x with |
|||
| [] -> |
|||
[],[],[] |
|||
| ((h1,h2,h3)::t) -> |
|||
let res1a = freshConsNoTail h1 |
|||
let res1b = freshConsNoTail h2 |
|||
let res1c = freshConsNoTail h3 |
|||
unzip3ToFreshConsTail res1a res1b res1c t; |
|||
res1a,res1b,res1c |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec zipToFreshConsTail cons xs1 xs2 = |
|||
match xs1,xs2 with |
|||
| [],[] -> |
|||
setFreshConsTail cons [] |
|||
| (h1::t1),(h2::t2) -> |
|||
let cons2 = freshConsNoTail (h1,h2) |
|||
setFreshConsTail cons cons2; |
|||
zipToFreshConsTail cons2 t1 t2 |
|||
| _ -> |
|||
invalidArg "xs2" "the input lists had different lengths" |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let zip xs1 xs2 = |
|||
match xs1,xs2 with |
|||
| [],[] -> [] |
|||
| (h1::t1),(h2::t2) -> |
|||
let res = freshConsNoTail (h1,h2) |
|||
zipToFreshConsTail res t1 t2; |
|||
res |
|||
| _ -> |
|||
invalidArg "xs2" "the input lists had different lengths" |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let rec zip3ToFreshConsTail cons xs1 xs2 xs3 = |
|||
match xs1,xs2,xs3 with |
|||
| [],[],[] -> |
|||
setFreshConsTail cons []; |
|||
| (h1::t1),(h2::t2),(h3::t3) -> |
|||
let cons2 = freshConsNoTail (h1,h2,h3) |
|||
setFreshConsTail cons cons2; |
|||
zip3ToFreshConsTail cons2 t1 t2 t3 |
|||
| _ -> |
|||
invalidArg "xs1" "the input lists had different lengths" |
|||
|
|||
// optimized mutation-based implementation. This code is only valid in fslib, where mutation of private |
|||
// tail cons cells is permitted in carefully written library code. |
|||
let zip3 xs1 xs2 xs3 = |
|||
match xs1,xs2,xs3 with |
|||
| [],[],[] -> |
|||
[] |
|||
| (h1::t1),(h2::t2),(h3::t3) -> |
|||
let res = freshConsNoTail (h1,h2,h3) |
|||
zip3ToFreshConsTail res t1 t2 t3; |
|||
res |
|||
| _ -> |
|||
invalidArg "xs1" "the input lists had different lengths" |
|||
|
|||
let to_array (l:'a list) = |
|||
let len = l.Length |
|||
let res = (arrayZeroCreate len : 'a array) |
|||
let mutable lref = l |
|||
for i = 0 to len - 1 do |
|||
res.[i] <- lref.(::).0; |
|||
lref <- lref.(::).1 |
|||
res |
|||
|
|||
let of_array (arr:'a array) = |
|||
let len = arr.Length |
|||
let mutable res = ([]: 'a list) |
|||
for i = len - 1 downto 0 do |
|||
res <- arr.[i] :: res |
|||
res |
|||
|
|||
module StableSortImplementation = |
|||
// Internal copy of stable sort |
|||
let rec revAppend xs1 xs2 = |
|||
match xs1 with |
|||
| [] -> xs2 |
|||
| h::t -> revAppend t (h::xs2) |
|||
let half x = x >>> 1 |
|||
|
|||
let rec merge cmp a b acc = |
|||
match a,b with |
|||
| [], a | a,[] -> revAppend acc a |
|||
| x::a', y::b' -> if cmp x y > 0 then merge cmp a b' (y::acc) else merge cmp a' b (x::acc) |
|||
|
|||
let sort2 cmp x y = |
|||
if cmp x y > 0 then [y;x] else [x;y] |
|||
|
|||
let sort3 cmp x y z = |
|||
let cxy = cmp x y |
|||
let cyz = cmp y z |
|||
if cxy > 0 && cyz < 0 then |
|||
if cmp x z > 0 then [y;z;x] else [y;x;z] |
|||
elif cxy < 0 && cyz > 0 then |
|||
if cmp x z > 0 then [z;x;y] else [x;z;y] |
|||
elif cxy > 0 then |
|||
if cyz > 0 then [z;y;x] |
|||
else [y;z;x] |
|||
else |
|||
if cyz > 0 then [z;x;y] |
|||
else [x;y;z] |
|||
|
|||
let trivial a = match a with [] | [_] -> true | _ -> false |
|||
|
|||
(* tail recursive using a ref *) |
|||
|
|||
let rec stableSortInner cmp la ar = |
|||
if la < 4 then (* sort two || three new entries *) |
|||
match !ar with |
|||
| x::y::b -> |
|||
if la = 2 then ( ar := b; sort2 cmp x y ) |
|||
else begin |
|||
match b with |
|||
| z::c -> ( ar := c; sort3 cmp x y z ) |
|||
| _ -> failwith "never" |
|||
end |
|||
| _ -> failwith "never" |
|||
else (* divide *) |
|||
let lb = half la |
|||
let sb = stableSortInner cmp lb ar |
|||
let sc = stableSortInner cmp (la - lb) ar |
|||
merge cmp sb sc [] |
|||
|
|||
let stableSort cmp (a: 'a list) = |
|||
if trivial a then a else |
|||
let ar = ref a |
|||
stableSortInner cmp a.Length ar |
|||
|
|||
let sortWith cmp a = StableSortImplementation.stableSort cmp a |
|||
|
|||
module internal Array = |
|||
|
|||
let inline zeroCreate (n:int) = (# "newarr !0" type ('a) n : 'a array #) |
|||
|
|||
let init (n:int) (f: int -> 'a) = |
|||
let arr = (zeroCreate n : 'a array) |
|||
for i = 0 to n - 1 do |
|||
arr.[i] <- f i |
|||
arr |
|||
|
|||
let permute indexMap (arr : _[]) = |
|||
let res = zeroCreate arr.Length |
|||
let inv = zeroCreate arr.Length |
|||
for i = 0 to arr.Length - 1 do |
|||
let j = indexMap i |
|||
if j < 0 or j >= arr.Length then invalidArg "indexMap" "the function did not compute a permutation" |
|||
res.[j] <- arr.[i] |
|||
inv.[j] <- 1uy |
|||
for i = 0 to arr.Length - 1 do |
|||
if inv.[i] <> 1uy then invalidArg "indexMap" "the function did not compute a permutation" |
|||
res |
|||
|
|||
|
|||
@ -1,38 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// Definitions internal for this library. |
|||
namespace Microsoft.FSharp.Primitives.Basics |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
module internal List = |
|||
val init : int -> (int -> 'a) -> 'a list |
|||
val iter : ('a -> unit) -> 'a list -> unit |
|||
val filter : predicate:('a -> bool) -> 'a list -> 'a list |
|||
val collect : ('a -> 'b list) -> 'a list -> 'b list |
|||
val partition : predicate:('a -> bool) -> 'a list -> 'a list * 'a list |
|||
val map : mapping:('a -> 'b) -> 'a list -> 'b list |
|||
val map2 : mapping:('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list |
|||
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list |
|||
val forall : predicate:('a -> bool) -> 'a list -> bool |
|||
val exists : predicate:('a -> bool) -> 'a list -> bool |
|||
val rev: 'a list -> 'a list |
|||
val concat : seq<'a list> -> 'a list |
|||
val iteri : action:(int -> 'a -> unit) -> 'a list -> unit |
|||
val unzip : ('a * 'b) list -> 'a list * 'b list |
|||
val unzip3 : ('a * 'b * 'c) list -> 'a list * 'b list * 'c list |
|||
val zip : 'a list -> 'b list -> ('a * 'b) list |
|||
val zip3 : 'a list -> 'b list -> 'c list -> ('a * 'b * 'c) list |
|||
val of_array : 'a[] -> 'a list |
|||
val to_array : 'a list -> 'a[] |
|||
val sortWith : ('a -> 'a -> int) -> 'a list -> 'a list |
|||
|
|||
module internal Array = |
|||
val inline zeroCreate : int -> 'a[] |
|||
val init : int -> (int -> 'a) -> 'a[] |
|||
val permute : indexMap:(int -> int) -> 'a[] -> 'a[] |
|||
|
|||
|
|||
@ -1,626 +0,0 @@ |
|||
// (c) Microsoft Corporation 2005-2008. |
|||
|
|||
#light |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Collections.Generic |
|||
open System.Diagnostics |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>] |
|||
type MapTree<'Key,'Value> = |
|||
| MapEmpty |
|||
| MapOne of 'Key * 'Value |
|||
| MapNode of 'Key * 'Value * MapTree<'Key,'Value> * MapTree<'Key,'Value> * int |
|||
// REVIEW: performance rumour has it that the data held in MapNode and MapOne should be |
|||
// exactly one cache line. It is currently ~7 and 4 words respectively. |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
module MapTree = |
|||
|
|||
let empty = MapEmpty |
|||
|
|||
let height = function |
|||
| MapEmpty -> 0 |
|||
| MapOne _ -> 1 |
|||
| MapNode(_,_,_,_,h) -> h |
|||
|
|||
let is_empty m = |
|||
match m with |
|||
| MapEmpty -> true |
|||
| _ -> false |
|||
|
|||
let mk l k v r = |
|||
match l,r with |
|||
| MapEmpty,MapEmpty -> MapOne(k,v) |
|||
| _ -> |
|||
let hl = height l |
|||
let hr = height r |
|||
let m = if hl < hr then hr else hl |
|||
MapNode(k,v,l,r,m+1) |
|||
|
|||
let rebalance t1 k v t2 = |
|||
let t1h = height t1 |
|||
let t2h = height t2 |
|||
if t2h > t1h + 2 then (* right is heavier than left *) |
|||
match t2 with |
|||
| MapNode(t2k,t2v,t2l,t2r,t2h) -> |
|||
(* one of the nodes must have height > height t1 + 1 *) |
|||
if height t2l > t1h + 1 then (* balance left: combination *) |
|||
match t2l with |
|||
| MapNode(t2lk,t2lv,t2ll,t2lr,t2lh) -> |
|||
mk (mk t1 k v t2ll) t2lk t2lv (mk t2lr t2k t2v t2r) |
|||
| _ -> failwith "rebalance" |
|||
else (* rotate left *) |
|||
mk (mk t1 k v t2l) t2k t2v t2r |
|||
| _ -> failwith "rebalance" |
|||
else |
|||
if t1h > t2h + 2 then (* left is heavier than right *) |
|||
match t1 with |
|||
| MapNode(t1k,t1v,t1l,t1r,t1h) -> |
|||
(* one of the nodes must have height > height t2 + 1 *) |
|||
if height t1r > t2h + 1 then |
|||
(* balance right: combination *) |
|||
match t1r with |
|||
| MapNode(t1rk,t1rv,t1rl,t1rr,t1rh) -> |
|||
mk (mk t1l t1k t1v t1rl) t1rk t1rv (mk t1rr k v t2) |
|||
| _ -> failwith "rebalance" |
|||
else |
|||
mk t1l t1k t1v (mk t1r k v t2) |
|||
| _ -> failwith "rebalance" |
|||
else mk t1 k v t2 |
|||
|
|||
let rec sizeAux acc m = |
|||
match m with |
|||
| MapEmpty -> acc |
|||
| MapOne _ -> acc + 1 |
|||
| MapNode(k2,v2,l,r,h) -> sizeAux (sizeAux (acc+1) l) r |
|||
|
|||
let size x = sizeAux 0 x |
|||
|
|||
let rec add (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) k v m = |
|||
match m with |
|||
| MapEmpty -> MapOne(k,v) |
|||
| MapOne(k2,v2) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then MapNode (k,v,MapEmpty,m,2) |
|||
elif c = 0 then MapOne(k,v) |
|||
else MapNode (k,v,m,MapEmpty,2) |
|||
| MapNode(k2,v2,l,r,h) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then rebalance (add comparer k v l) k2 v2 r |
|||
elif c = 0 then MapNode(k,v,l,r,h) |
|||
else rebalance l k2 v2 (add comparer k v r) |
|||
|
|||
let rec find (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) k m = |
|||
match m with |
|||
| MapEmpty -> raise (System.Collections.Generic.KeyNotFoundException()) |
|||
| MapOne(k2,v2) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c = 0 then v2 |
|||
else raise (System.Collections.Generic.KeyNotFoundException()) |
|||
| MapNode(k2,v2,l,r,_) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then find comparer k l |
|||
elif c = 0 then v2 |
|||
else find comparer k r |
|||
|
|||
let rec tryfind (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) k m = |
|||
match m with |
|||
| MapEmpty -> None |
|||
| MapOne(k2,v2) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c = 0 then Some v2 |
|||
else None |
|||
| MapNode(k2,v2,l,r,_) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then tryfind comparer k l |
|||
elif c = 0 then Some v2 |
|||
else tryfind comparer k r |
|||
|
|||
let partition1 (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) f k v (acc1,acc2) = |
|||
if f k v then (add comparer k v acc1,acc2) else (acc1,add comparer k v acc2) |
|||
|
|||
let rec partitionAux (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) f s acc = |
|||
match s with |
|||
| MapEmpty -> acc |
|||
| MapOne(k,v) -> partition1 comparer f k v acc |
|||
| MapNode(k,v,l,r,_) -> |
|||
let acc = partitionAux comparer f r acc |
|||
let acc = partition1 comparer f k v acc |
|||
partitionAux comparer f l acc |
|||
|
|||
let partition (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) f s = partitionAux comparer f s (empty,empty) |
|||
|
|||
let filter1 (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) f k v acc = if f k v then add comparer k v acc else acc |
|||
|
|||
let rec filterAux (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) f s acc = |
|||
match s with |
|||
| MapEmpty -> acc |
|||
| MapOne(k,v) -> filter1 comparer f k v acc |
|||
| MapNode(k,v,l,r,_) -> |
|||
let acc = filterAux comparer f l acc |
|||
let acc = filter1 comparer f k v acc |
|||
filterAux comparer f r acc |
|||
|
|||
let filter (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) f s = filterAux comparer f s empty |
|||
|
|||
let rec spliceOutSuccessor m = |
|||
match m with |
|||
| MapEmpty -> failwith "internal error: Map.splice_out_succ_or_pred" |
|||
| MapOne(k2,v2) -> k2,v2,MapEmpty |
|||
| MapNode(k2,v2,l,r,_) -> |
|||
match l with |
|||
| MapEmpty -> k2,v2,r |
|||
| _ -> let k3,v3,l' = spliceOutSuccessor l in k3,v3,mk l' k2 v2 r |
|||
|
|||
let rec remove (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) k m = |
|||
match m with |
|||
| MapEmpty -> empty |
|||
| MapOne(k2,v2) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c = 0 then MapEmpty else m |
|||
| MapNode(k2,v2,l,r,_) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then rebalance (remove comparer k l) k2 v2 r |
|||
elif c = 0 then |
|||
match l,r with |
|||
| MapEmpty,_ -> r |
|||
| _,MapEmpty -> l |
|||
| _ -> |
|||
let sk,sv,r' = spliceOutSuccessor r |
|||
mk l sk sv r' |
|||
else rebalance l k2 v2 (remove comparer k r) |
|||
|
|||
let rec mem (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) k m = |
|||
match m with |
|||
| MapEmpty -> false |
|||
| MapOne(k2,v2) -> (comparer.Invoke(k,k2) = 0) |
|||
| MapNode(k2,v2,l,r,_) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then mem comparer k l |
|||
else (c = 0 || mem comparer k r) |
|||
|
|||
let rec iter f m = |
|||
match m with |
|||
| MapEmpty -> () |
|||
| MapOne(k2,v2) -> f k2 v2 |
|||
| MapNode(k2,v2,l,r,_) -> iter f l; f k2 v2; iter f r |
|||
|
|||
let rec tryPick f m = |
|||
match m with |
|||
| MapEmpty -> None |
|||
| MapOne(k2,v2) -> f k2 v2 |
|||
| MapNode(k2,v2,l,r,_) -> |
|||
match tryPick f l with |
|||
| Some x as res -> res |
|||
| None -> |
|||
match f k2 v2 with |
|||
| Some x as res -> res |
|||
| None -> |
|||
tryPick f r |
|||
|
|||
let rec exists f m = |
|||
match m with |
|||
| MapEmpty -> false |
|||
| MapOne(k2,v2) -> f k2 v2 |
|||
| MapNode(k2,v2,l,r,_) -> exists f l || f k2 v2 || exists f r |
|||
|
|||
let rec for_all f m = |
|||
match m with |
|||
| MapEmpty -> true |
|||
| MapOne(k2,v2) -> f k2 v2 |
|||
| MapNode(k2,v2,l,r,_) -> for_all f l && f k2 v2 && for_all f r |
|||
|
|||
let rec map f m = |
|||
match m with |
|||
| MapEmpty -> empty |
|||
| MapOne(k,v) -> MapOne(k,f v) |
|||
| MapNode(k,v,l,r,h) -> |
|||
let l2 = map f l |
|||
let v2 = f v |
|||
let r2 = map f r |
|||
MapNode(k,v2,l2, r2,h) |
|||
|
|||
let rec mapi f m = |
|||
match m with |
|||
| MapEmpty -> empty |
|||
| MapOne(k,v) -> MapOne(k,f k v) |
|||
| MapNode(k,v,l,r,h) -> |
|||
let l2 = mapi f l |
|||
let v2 = f k v |
|||
let r2 = mapi f r |
|||
MapNode(k,v2, l2, r2,h) |
|||
|
|||
let rec foldBack (f:OptimizedClosures.FastFunc3<_,_,_,_>) m x = |
|||
match m with |
|||
| MapEmpty -> x |
|||
| MapOne(k,v) -> f.Invoke(k,v,x) |
|||
| MapNode(k,v,l,r,h) -> |
|||
let x = foldBack f r x |
|||
let x = f.Invoke(k,v,x) |
|||
foldBack f l x |
|||
|
|||
let rec fold (f:OptimizedClosures.FastFunc3<_,_,_,_>) x m = |
|||
match m with |
|||
| MapEmpty -> x |
|||
| MapOne(k,v) -> f.Invoke(x,k,v) |
|||
| MapNode(k,v,l,r,h) -> |
|||
let x = fold f x l |
|||
let x = f.Invoke(x,k,v) |
|||
fold f x r |
|||
|
|||
let foldSection (comparer: OptimizedClosures.FastFunc2<'Value,'Value,int>) lo hi f m x = |
|||
let rec fold_from_to f m x = |
|||
match m with |
|||
| MapEmpty -> x |
|||
| MapOne(k,v) -> |
|||
let clo_k = comparer.Invoke(lo,k) |
|||
let ck_hi = comparer.Invoke(k,hi) |
|||
let x = if clo_k <= 0 && ck_hi <= 0 then f k v x else x |
|||
x |
|||
| MapNode(k,v,l,r,h) -> |
|||
let clo_k = comparer.Invoke(lo,k) |
|||
let ck_hi = comparer.Invoke(k,hi) |
|||
let x = if clo_k < 0 then fold_from_to f l x else x |
|||
let x = if clo_k <= 0 && ck_hi <= 0 then f k v x else x |
|||
let x = if ck_hi < 0 then fold_from_to f r x else x |
|||
x |
|||
|
|||
if comparer.Invoke(lo,hi) = 1 then x else fold_from_to f m x |
|||
|
|||
|
|||
let to_list m = |
|||
let rec loop m acc = |
|||
match m with |
|||
| MapEmpty -> acc |
|||
| MapOne(k,v) -> (k,v)::acc |
|||
| MapNode(k,v,l,r,h) -> loop l ((k,v)::loop r acc) |
|||
loop m [] |
|||
let to_array m = m |> to_list |> Array.of_list |
|||
let of_list comparer l = List.fold (fun acc (k,v) -> add comparer k v acc) empty l |
|||
|
|||
let rec mkFromEnumerator comparer acc (e : IEnumerator<_>) = |
|||
if e.MoveNext() then |
|||
let (x,y) = e.Current |
|||
mkFromEnumerator comparer (add comparer x y acc) e |
|||
else acc |
|||
|
|||
let of_seq comparer (c : seq<_>) = |
|||
use ie = c.GetEnumerator() |
|||
mkFromEnumerator comparer empty ie |
|||
|
|||
let copyToArray s (arr: _[]) i = |
|||
let j = ref i |
|||
s |> iter (fun x y -> arr.[!j] <- KeyValuePair(x,y); j := !j + 1) |
|||
|
|||
|
|||
/// Imperative left-to-right iterators. |
|||
[<StructuralEquality(false); StructuralComparison(false)>] |
|||
type iterator<'Key,'Value> = |
|||
{ /// invariant: always collapseLHS result |
|||
mutable stack: MapTree<'Key,'Value> list; |
|||
/// true when MoveNext has been called |
|||
mutable started : bool } |
|||
|
|||
// collapseLHS: |
|||
// a) Always returns either [] or a list starting with SetOne. |
|||
// b) The "fringe" of the set stack is unchanged. |
|||
let rec collapseLHS stack = |
|||
match stack with |
|||
| [] -> [] |
|||
| MapEmpty :: rest -> collapseLHS rest |
|||
| MapOne (k,v) :: rest -> stack |
|||
| (MapNode(k,v,l,r,h)) :: rest -> collapseLHS (l :: MapOne (k,v) :: r :: rest) |
|||
|
|||
let mkIterator s = { stack = collapseLHS [s]; started = false } |
|||
|
|||
let not_started() = raise (new System.InvalidOperationException("Enumeration has not started. Call MoveNext.")) |
|||
let already_finished() = raise (new System.InvalidOperationException("Enumeration already finished.")) |
|||
|
|||
let current i = |
|||
if i.started then |
|||
match i.stack with |
|||
| MapOne (k,v) :: _ -> new KeyValuePair<_,_>(k,v) |
|||
| [] -> already_finished() |
|||
| _ -> failwith "Please report error: Map iterator, unexpected stack for current" |
|||
else |
|||
not_started() |
|||
|
|||
let rec moveNext i = |
|||
if i.started then |
|||
match i.stack with |
|||
| MapOne _ :: rest -> i.stack <- collapseLHS rest; |
|||
i.stack <> [] |
|||
| [] -> false |
|||
| _ -> failwith "Please report error: Map iterator, unexpected stack for moveNext" |
|||
else |
|||
i.started <- true; (* The first call to MoveNext "starts" the enumeration. *) |
|||
i.stack <> [] |
|||
|
|||
let mkIEnumerator s = |
|||
let i = ref (mkIterator s) |
|||
{ new IEnumerator<_> with |
|||
member self.Current = current !i |
|||
interface System.Collections.IEnumerator with |
|||
member self.Current = box (current !i) |
|||
member self.MoveNext() = moveNext !i |
|||
member self.Reset() = i := mkIterator s |
|||
interface System.IDisposable with |
|||
member self.Dispose() = ()} |
|||
|
|||
|
|||
|
|||
#if FX_NO_DEBUG_PROXIES |
|||
#else |
|||
[<System.Diagnostics.DebuggerTypeProxy(typedefof<MapDebugView<_,_>>)>] |
|||
#endif |
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<System.Diagnostics.DebuggerDisplay("Count = {Count}")>] |
|||
#endif |
|||
[<Sealed>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")>] |
|||
type Map<'Key,'Value>(comparer: OptimizedClosures.FastFunc2<'Key,'Key,int>, tree: MapTree<'Key,'Value>) = |
|||
|
|||
static let empty = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'Key>() |
|||
new Map<'Key,'Value>(comparer,MapTree<_,_>.MapEmpty) |
|||
|
|||
static member Empty : Map<'Key,'Value> = empty |
|||
|
|||
static member Create(ie : IEnumerable<_>) : Map<'Key,'Value> = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'Key>() |
|||
Map<_,_>(comparer,MapTree.of_seq comparer ie) |
|||
|
|||
static member Create() : Map<'Key,'Value> = empty |
|||
|
|||
new(ie : seq<_>) = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'Key>() |
|||
Map<_,_>(comparer,MapTree.of_seq comparer ie) |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member internal m.Comparer = comparer |
|||
//[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
member internal m.Tree = tree |
|||
member m.Add(k,v) : Map<'Key,'Value> = Map<'Key,'Value>(comparer,MapTree.add comparer k v tree) |
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member m.IsEmpty = MapTree.is_empty tree |
|||
member m.Item with get(k : 'Key) = MapTree.find comparer k tree |
|||
member m.TryPick(f) = MapTree.tryPick f tree |
|||
member m.Exists(f) = MapTree.exists f tree |
|||
member m.Filter(f) : Map<'Key,'Value> = Map<'Key,'Value>(comparer ,MapTree.filter comparer f tree) |
|||
member m.ForAll(f) = MapTree.for_all f tree |
|||
member m.Fold f acc = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
MapTree.foldBack f tree acc |
|||
member m.FoldSection (lo:'Key) (hi:'Key) f (acc:'z) = MapTree.foldSection comparer lo hi f tree acc |
|||
member m.Iterate f = MapTree.iter f tree |
|||
member m.MapRange f = Map<'Key,'b>(comparer,MapTree.map f tree) |
|||
member m.Map f = Map<'Key,'b>(comparer,MapTree.mapi f tree) |
|||
member m.Partition(f) : Map<'Key,'Value> * Map<'Key,'Value> = |
|||
let r1,r2 = MapTree.partition comparer f tree in |
|||
Map<'Key,'Value>(comparer,r1), Map<'Key,'Value>(comparer,r2) |
|||
member m.Count = MapTree.size tree |
|||
member m.ContainsKey(k) = MapTree.mem comparer k tree |
|||
member m.Remove(k) : Map<'Key,'Value> = Map<'Key,'Value>(comparer,MapTree.remove comparer k tree) |
|||
member m.TryFind(k) = MapTree.tryfind comparer k tree |
|||
member m.ToList() = MapTree.to_list tree |
|||
member m.ToArray() = MapTree.to_array tree |
|||
|
|||
static member of_list(l) : Map<'Key,'Value> = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'Key>() |
|||
Map<_,_>(comparer,MapTree.of_list comparer l) |
|||
|
|||
member this.ComputeHashCode() = |
|||
let combineHash x y = (x <<< 1) + y + 631 |
|||
let mutable res = 0 |
|||
for (KeyValue(x,y)) in this do |
|||
res <- combineHash res (hash x) |
|||
res <- combineHash res (hash y) |
|||
abs res |
|||
|
|||
override this.Equals(that) = |
|||
match that with |
|||
| :? Map<'Key,'Value> -> |
|||
((this :> System.IComparable).CompareTo(that) = 0) |
|||
| _ -> false |
|||
|
|||
override this.GetHashCode() = this.ComputeHashCode() |
|||
|
|||
interface IEnumerable<KeyValuePair<'Key, 'Value>> with |
|||
member s.GetEnumerator() = MapTree.mkIEnumerator tree |
|||
|
|||
interface System.Collections.IEnumerable with |
|||
member s.GetEnumerator() = (MapTree.mkIEnumerator tree :> System.Collections.IEnumerator) |
|||
|
|||
interface IDictionary<'Key, 'Value> with |
|||
member s.Item |
|||
with get x = s.[x] |
|||
and set x v = raise (NotSupportedException("Map values may not be mutated")) |
|||
|
|||
// REVIEW: this implementation could avoid copying the Values to an array |
|||
member s.Keys = ([| for kvp in s -> kvp.Key |] :> ICollection<'Key>) |
|||
|
|||
// REVIEW: this implementation could avoid copying the Values to an array |
|||
member s.Values = ([| for kvp in s -> kvp.Value |] :> ICollection<'Value>) |
|||
|
|||
member s.Add(k,v) = raise (NotSupportedException("Map values may not be mutated")) |
|||
member s.ContainsKey(k) = s.ContainsKey(k) |
|||
member s.TryGetValue(k,r) = if s.ContainsKey(k) then (r <- s.[k]; true) else false |
|||
member s.Remove(k : 'Key) = (raise (NotSupportedException("Map values may not be mutated")) : bool) |
|||
|
|||
interface ICollection<KeyValuePair<'Key, 'Value>> with |
|||
member s.Add(x) = raise (NotSupportedException("Map values may not be mutated")); |
|||
member s.Clear() = raise (NotSupportedException("Map values may not be mutated")); |
|||
member s.Remove(x) = raise (NotSupportedException("Map values may not be mutated")); |
|||
member s.Contains(x) = s.ContainsKey(x.Key) && s.[x.Key] = x.Value |
|||
member s.CopyTo(arr,i) = MapTree.copyToArray tree arr i |
|||
member s.IsReadOnly = true |
|||
member s.Count = s.Count |
|||
|
|||
interface System.IComparable with |
|||
member m.CompareTo(obj: obj) = |
|||
match obj with |
|||
| :? Map<'Key,'Value> as m2-> |
|||
Seq.compare |
|||
(fun (kvp1 : KeyValuePair<_,_>) (kvp2 : KeyValuePair<_,_>)-> |
|||
let c = comparer.Invoke(kvp1.Key,kvp2.Key) in |
|||
if c <> 0 then c else Operators.compare kvp1.Value kvp2.Value) |
|||
m m2 |
|||
| _ -> |
|||
invalidArg "obj" "the two obejcts have different types and are not comparable" |
|||
#if FX_NO_DEBUG_PROXIES |
|||
#else |
|||
and |
|||
[<Sealed>] |
|||
MapDebugView<'Key,'Value>(v: Map<'Key,'Value>) = |
|||
|
|||
[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)>] |
|||
member x.Items = v |> Seq.truncate 1000 |> Seq.map (fun kvp -> { key = kvp.Key; value=kvp.Value}) |> Seq.to_array |
|||
|
|||
and |
|||
[<DebuggerDisplay("{value}", Name="[{key}]", Type="")>] |
|||
MapDebugViewKeyValuePair = { key:obj; value:obj } |
|||
|
|||
#endif |
|||
|
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Diagnostics |
|||
open System.Collections.Generic |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Map = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let isEmpty (m:Map<_,_>) = m.IsEmpty |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let is_empty (m:Map<_,_>) = m.IsEmpty |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let add k v (m:Map<_,_>) = m.Add(k,v) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find k (m:Map<_,_>) = m.[k] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryFind k (m:Map<_,_>) = m.TryFind(k) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind k (m:Map<_,_>) = m.TryFind(k) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let remove k (m:Map<_,_>) = m.Remove(k) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let contains k (m:Map<_,_>) = m.ContainsKey(k) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f (m:Map<_,_>) = m.Iterate(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryPick f (m:Map<_,_>) = m.TryPick(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let first f (m:Map<_,_>) = m.TryPick(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let pick f (m:Map<_,_>) = match tryPick f m with None -> raise (System.Collections.Generic.KeyNotFoundException()) | Some res -> res |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists f (m:Map<_,_>) = m.Exists(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let filter f (m:Map<_,_>) = m.Filter(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition f (m:Map<_,_>) = m.Partition(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall f (m:Map<_,_>) = m.ForAll(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all f m = forall f m |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapRange f (m:Map<_,_>) = m.MapRange(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi f (m:Map<_,_>) = m.Map(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f (m:Map<_,_>) = m.Map(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold f z (m:Map<_,_>) = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
MapTree.fold f z m.Tree |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left f z m = fold f z m |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldBack f (m:Map<_,_>) z = |
|||
let f = OptimizedClosures.FastFunc3<_,_,_,_>.Adapt(f) |
|||
MapTree.foldBack f m.Tree z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right f m z = foldBack f m z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_seq (m:Map<_,_>) = m |> Seq.map (fun kvp -> kvp.Key, kvp.Value) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let findIndex f (m : Map<_,_>) = m |> to_seq |> Seq.pick (fun (k,v) -> if f k v then Some(k) else None) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let find_index f m = findIndex f m |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryFindIndex f (m : Map<_,_>) = m |> to_seq |> Seq.tryPick (fun (k,v) -> if f k v then Some(k) else None) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let tryfind_index f m = tryFindIndex f m |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_list (l: ('Key * 'Value) list) = Map<_,_>.of_list(l) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_seq l = Map<_,_>.Create(l) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_array (l: ('Key * 'Value) array) = of_seq l |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_list (m:Map<_,_>) = m.ToList() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_array (m:Map<_,_>) = m.ToArray() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let empty<'Key,'Value> = Map<'Key,'Value>.Empty |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mem k (m:Map<_,_>) = m.ContainsKey(k) |
|||
|
|||
@ -1,186 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Collections.Generic |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
/// Immutable maps. Keys are ordered by F# generic comparison. |
|||
/// |
|||
/// <performance> |
|||
/// Maps based on generic comparison are efficient for small keys. They are not a suitable choice if keys are recursive data structures |
|||
/// or if keys require bespoke comparison semantics. |
|||
/// </performance> |
|||
[<Sealed>] |
|||
type Map<'Key,'Value> = |
|||
/// Return a new map with the binding added to the given map. |
|||
member Add: key:'Key * value:'Value -> Map<'Key,'Value> |
|||
|
|||
/// Return true if there are no bindings in the map. |
|||
member IsEmpty: bool |
|||
|
|||
/// Build a map that contains the bindings of the given IEnumerable |
|||
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value> |
|||
|
|||
/// The empty map |
|||
static member Empty: Map<'Key,'Value> |
|||
|
|||
/// Test if an element is in the domain of the map |
|||
member ContainsKey: key:'Key -> bool |
|||
|
|||
/// The number of bindings in the map |
|||
member Count: int |
|||
|
|||
/// Lookup an element in the map. Raise <c>KeyNotFoundException</c> if no binding |
|||
/// exists in the map. |
|||
member Item : key:'Key -> 'Value with get |
|||
|
|||
/// Remove an element from the domain of the map. No exception is raised if the element is not present. |
|||
member Remove: key:'Key -> Map<'Key,'Value> |
|||
|
|||
/// Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain |
|||
/// of the map and <c>None</c> if not. |
|||
member TryFind: key:'Key -> 'Value option |
|||
|
|||
interface IDictionary<'Key, 'Value> |
|||
interface ICollection<KeyValuePair<'Key, 'Value>> |
|||
interface IEnumerable<KeyValuePair<'Key, 'Value>> |
|||
interface System.IComparable |
|||
interface System.Collections.IEnumerable |
|||
override Equals : obj -> bool |
|||
|
|||
/// Functional programming operators related to the <c>Map<_,_></c> type. |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Map = |
|||
|
|||
/// Return a new map with the binding added to the given map. |
|||
val add: key:'Key -> value:'T -> table:Map<'Key,'T> -> Map<'Key,'T> |
|||
|
|||
/// Return a new map made from the given bindings |
|||
val of_list: elements:('Key * 'T) list -> Map<'Key,'T> |
|||
|
|||
/// Return a new map made from the given bindings |
|||
val of_array: elements:('Key * 'T) array -> Map<'Key,'T> |
|||
|
|||
/// Return a new map made from the given bindings |
|||
val of_seq: elements:seq<'Key * 'T> -> Map<'Key,'T> |
|||
|
|||
/// View the collection as an enumerable sequence. This collection |
|||
/// type is also directly compatible with 'seq<KeyValuePair<_,_> >'. |
|||
/// |
|||
/// Note this function returns a sequence of tuples, whereas the collection |
|||
/// itself is compatible with the logically equivalent sequence of KeyValuePairs. |
|||
/// Using sequences of tuples tends to be more convenient in F#, however the |
|||
/// collection itself must enumerate KeyValuePairs to conform to the .NET |
|||
/// design guidelines and the IDictionary interface. |
|||
val to_seq: table:Map<'Key,'T> -> seq<'Key * 'T> |
|||
|
|||
/// Returns a list of all key-value pairs in the mappinng |
|||
val to_list: table:Map<'Key,'T> -> list<'Key * 'T> |
|||
|
|||
/// Returns an array of all key-value pairs in the mappinng |
|||
val to_array: table:Map<'Key,'T> -> ('Key * 'T) array |
|||
|
|||
/// Is the map empty? |
|||
val isEmpty: table:Map<'Key,'T> -> bool |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'isEmpty' instead")>] |
|||
val is_empty: table:Map<'Key,'T> -> bool |
|||
|
|||
/// The empty map |
|||
[<GeneralizableValueAttribute>] |
|||
val empty<'Key,'T> : Map<'Key,'T> |
|||
|
|||
/// Lookup an element in the map, raising <c>KeyNotFoundException</c> if no binding |
|||
/// exists in the map. |
|||
val find: key:'Key -> table:Map<'Key,'T> -> 'T |
|||
|
|||
/// Search the map looking for the first element where the given function returns a <c>Some</c> value |
|||
val tryPick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U option |
|||
|
|||
/// Search the map looking for the first element where the given function returns a <c>Some</c> value |
|||
val pick: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U |
|||
|
|||
/// Fold over the bindings in the map |
|||
val foldBack: folder:('Key -> 'T -> 'State -> 'State) -> table:Map<'Key,'T> -> state:'State -> 'State |
|||
|
|||
/// Fold over the bindings in the map |
|||
val fold: folder:('State -> 'Key -> 'T -> 'State) -> state:'State -> table:Map<'Key,'T> -> 'State |
|||
|
|||
/// Apply the given function to each binding in the dictionary |
|||
val iter: action:('Key -> 'T -> unit) -> table:Map<'Key,'T> -> unit |
|||
|
|||
/// Return true if the given predicate returns true for one of the |
|||
/// bindings in the map. |
|||
val exists: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool |
|||
|
|||
/// Build a new map containing only the bindings for which the given predicate returns 'true' |
|||
val filter: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> |
|||
|
|||
/// Return true if the given predicate returns true for all of the |
|||
/// bindings in the map. |
|||
val forall: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to each of the elements of the collection. The index passed to the |
|||
/// function indicates the index of element being transformed. |
|||
val map: mapping:('Key -> 'T -> 'U) -> table:Map<'Key,'T> -> Map<'Key,'U> |
|||
|
|||
/// Test is an element is in the domain of the map |
|||
val contains: key:'Key -> table:Map<'Key,'T> -> bool |
|||
|
|||
/// Build two new maps, one containing the bindings for which the given predicate returns 'true', |
|||
/// and the other the remaining bindings. |
|||
val partition: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> Map<'Key, 'T> * Map<'Key, 'T> |
|||
|
|||
/// Remove an element from the domain of the map. No exception is raised if the element is not present. |
|||
val remove: key:'Key -> table:Map<'Key,'T> -> Map<'Key,'T> |
|||
|
|||
/// Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain |
|||
/// of the map and <c>None</c> if not. |
|||
val tryFind: key:'Key -> table:Map<'Key,'T> -> 'T option |
|||
|
|||
/// Evaluates the function on each mapping in the collection. Returns the key for the first mapping |
|||
/// where the function returns 'true'. Raise <c>KeyNotFoundException</c> if no such element exists. |
|||
val findIndex: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key |
|||
|
|||
/// Return the key of the first mapping in the collection that satisfies the given predicate. |
|||
/// Return 'None' if no such element exists. |
|||
val tryFindIndex: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key option |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
/// Search the map looking for the first element where the given function returns a <c>Some</c> value |
|||
[<Obsolete("This F# library function has been renamed. Use 'tryPick' instead")>] |
|||
val first: chooser:('Key -> 'T -> 'U option) -> table:Map<'Key,'T> -> 'U option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right: folder:('Key -> 'T -> 'State -> 'State) -> table:Map<'Key,'T> -> state:'State -> 'State |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left: folder:('State -> 'Key -> 'T -> 'State) -> state:'State -> table:Map<'Key,'T> -> 'State |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:('Key -> 'T -> bool) -> table:Map<'Key, 'T> -> bool |
|||
|
|||
[<Obsolete("This has been renamed to 'map'")>] |
|||
val mapi: mapping:('Key -> 'T -> 'U) -> table:Map<'Key,'T> -> Map<'Key,'U> |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'contains' instead")>] |
|||
val mem: key:'Key -> table:Map<'Key,'T> -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFind' instead")>] |
|||
val tryfind: key:'Key -> table:Map<'Key,'T> -> 'T option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'findIndex' instead")>] |
|||
val find_index: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFindIndex' instead")>] |
|||
val tryfind_index: predicate:('Key -> 'T -> bool) -> table:Map<'Key,'T> -> 'Key option |
|||
|
|||
#endif |
|||
File diff suppressed because it is too large
@ -1,61 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Math |
|||
|
|||
#if FX_ATLEAST_40 |
|||
#else |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
|
|||
/// Abstract internal type |
|||
type internal BigNat |
|||
|
|||
module internal BigNatModule = |
|||
|
|||
val zero : BigNat |
|||
val one : BigNat |
|||
val two : BigNat |
|||
|
|||
val add : BigNat -> BigNat -> BigNat |
|||
val sub : BigNat -> BigNat -> BigNat |
|||
val mul : BigNat -> BigNat -> BigNat |
|||
val divmod : BigNat -> BigNat -> BigNat * BigNat |
|||
val div : BigNat -> BigNat -> BigNat |
|||
val rem : BigNat -> BigNat -> BigNat |
|||
val hcf : BigNat -> BigNat -> BigNat |
|||
|
|||
val min : BigNat -> BigNat -> BigNat |
|||
val max : BigNat -> BigNat -> BigNat |
|||
val scale : int -> BigNat -> BigNat |
|||
val powi : BigNat -> int -> BigNat |
|||
val pow : BigNat -> BigNat -> BigNat |
|||
|
|||
val IsZero : BigNat -> bool |
|||
val isZero : BigNat -> bool |
|||
val isOne : BigNat -> bool |
|||
val equal : BigNat -> BigNat -> bool |
|||
val compare : BigNat -> BigNat -> int |
|||
val lt : BigNat -> BigNat -> bool |
|||
val gt : BigNat -> BigNat -> bool |
|||
val lte : BigNat -> BigNat -> bool |
|||
val gte : BigNat -> BigNat -> bool |
|||
|
|||
val hash : BigNat -> int |
|||
val to_float : BigNat -> float |
|||
val of_int : int -> BigNat |
|||
val of_int64 : int64 -> BigNat |
|||
val to_string : BigNat -> string |
|||
val of_string : string -> BigNat |
|||
|
|||
val to_uint32 : BigNat -> uint32 |
|||
val to_uint64 : BigNat -> uint64 |
|||
|
|||
val factorial : BigNat -> BigNat |
|||
// val randomBits : int -> BigNat |
|||
val bits : BigNat -> int |
|||
val is_small : BigNat -> bool (* will fit in int32 (but not nec all int32) *) |
|||
val get_small : BigNat -> int32 (* get the value, if it satisfies is_small *) |
|||
|
|||
#endif |
|||
@ -1,433 +0,0 @@ |
|||
// (c) Microsoft Corporation. All rights reserved |
|||
|
|||
#nowarn "44" // This construct is deprecated. This function is for use by compiled F# code and should not be used directly |
|||
|
|||
namespace Microsoft.FSharp.Math |
|||
|
|||
#if FX_ATLEAST_40 |
|||
type BigInt = System.Numerics.BigInteger |
|||
type bigint = System.Numerics.BigInteger |
|||
#else |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
open Microsoft.FSharp.Math |
|||
open System |
|||
open System.Globalization |
|||
|
|||
|
|||
// INVARIANT: signInt = 1 or -1 |
|||
// value(z) = signInt * v |
|||
// NOTE: 0 has two repns (+1,0) or (-1,0). |
|||
[<Struct>] |
|||
[<StructuralEquality(false); StructuralComparison(false)>] |
|||
[<StructuredFormatDisplay("{StructuredDisplayString}I")>] |
|||
type BigInt(signInt:int, v : BigNat) = |
|||
|
|||
//new() = new BigInt(0,0) |
|||
|
|||
static let smallLim = 4096 |
|||
static let smallPosTab = Array.init smallLim BigNatModule.of_int |
|||
static let one = BigInt(1) |
|||
static let zero = BigInt(0) |
|||
|
|||
static member internal nat n = |
|||
if BigNatModule.is_small n && BigNatModule.get_small n < smallLim |
|||
then smallPosTab.[BigNatModule.get_small n] |
|||
else n |
|||
static member internal create (s,n) = BigInt(s,BigInt.nat n) |
|||
static member internal posn n = BigInt(1,BigInt.nat n) |
|||
static member internal negn n = BigInt(-1,BigInt.nat n) |
|||
|
|||
|
|||
member x.Sign = if x.IsZero then 0 else signInt |
|||
member x.SignInt = signInt |
|||
member internal x.V = v |
|||
|
|||
static member op_Equality (x:BigInt, y:BigInt) = |
|||
//System.Console.WriteLine("x = {0}",box x) |
|||
//System.Console.WriteLine("y = {0}",box y) |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigNatModule.equal x.V y.V // +1.xv = +1.yv iff xv = yv |
|||
| -1, -1 -> BigNatModule.equal x.V y.V // -1.xv = -1.yv iff xv = yv |
|||
| 1,-1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V // 1.xv = -1.yv iff xv=0 and yv=0 |
|||
| -1, 1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V // -1.xv = 1.yv iff xv=0 and yv=0 |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member op_Inequality (x:BigInt, y:BigInt) = not (BigInt.op_Equality(x,y)) // CA2226: OperatorsShouldHaveSymmetricalOverloads |
|||
|
|||
static member op_LessThan (x:BigInt, y:BigInt) = |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigNatModule.lt x.V y.V // 1.xv < 1.yv iff xv < yv |
|||
| -1,-1 -> BigNatModule.lt y.V x.V // -1.xv < -1.yv iff yv < xv |
|||
| 1,-1 -> false // 1.xv < -1.yv iff 0 <= 1.xv < -1.yv <= 0 iff false |
|||
| -1, 1 -> not (BigNatModule.isZero x.V) || not (BigNatModule.isZero y.V) |
|||
// -1.xv < 1.yv |
|||
// (a) xv=0 and yv=0, then false |
|||
// (b) xv<>0, -1.xv < 0 <= 1.yv, so true |
|||
// (c) yv<>0, -1.xv <= 0 < 1.yv, so true |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member op_GreaterThan (x:BigInt, y:BigInt) = // Follow lt by +/- symmetry |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigNatModule.gt x.V y.V |
|||
| -1,-1 -> BigNatModule.gt y.V x.V |
|||
| 1,-1 -> not (BigNatModule.isZero x.V) || not (BigNatModule.isZero y.V) |
|||
| -1, 1 -> false |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member internal compare(n,nn) = if BigInt.op_LessThan(n,nn) then -1 elif BigInt.op_Equality(n,nn) then 0 else 1 |
|||
static member internal hash (z:BigInt) = z.SignInt + BigNatModule.hash(z.V) |
|||
|
|||
override x.ToString() = |
|||
match x.SignInt with |
|||
| 1 -> BigNatModule.to_string x.V // positive |
|||
| -1 -> |
|||
if BigNatModule.isZero x.V |
|||
then "0" // not negative infact, but zero. |
|||
else "-" + BigNatModule.to_string x.V // negative |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
member x.StructuredDisplayString = x.ToString() |
|||
|
|||
interface System.IComparable with |
|||
member this.CompareTo(obj:obj) = |
|||
match obj with |
|||
| :? BigInt as that -> BigInt.compare(this,that) |
|||
| _ -> invalidArg "obj" "the objects are not comparable" |
|||
|
|||
override this.Equals(obj) = |
|||
match obj with |
|||
| :? BigInt as that -> BigInt.op_Equality(this, that) |
|||
| _ -> false |
|||
|
|||
override x.GetHashCode() = BigInt.hash(x) |
|||
|
|||
|
|||
[<OverloadID("new_int")>] |
|||
new (n:int) = |
|||
if n>=0 |
|||
then BigInt (1,BigInt.nat(BigNatModule.of_int n)) |
|||
elif (n = System.Int32.MinValue) |
|||
then BigInt(-1,BigInt.nat(BigNatModule.of_int64 (-(int64 n)))) |
|||
else BigInt(-1,BigInt.nat(BigNatModule.of_int (-n))) |
|||
|
|||
static member ToInt32(z:BigInt) = |
|||
let u = BigNatModule.to_uint32 z.V |
|||
if u <= uint32 System.Int32.MaxValue then |
|||
(* Handle range [-MaxValue,MaxValue] *) |
|||
z.SignInt * int32 u |
|||
elif z.SignInt = -1 && u = uint32 (System.Int32.MaxValue + 1) then |
|||
//assert(System.Int32.MinValue = 0 - System.Int32.MaxValue - 1) |
|||
(* Handle MinValue = -(MaxValue+1) special case not covered by the above *) |
|||
System.Int32.MinValue |
|||
else |
|||
raise (System.OverflowException()) |
|||
|
|||
[<OverloadID("new_int64")>] |
|||
new (n:int64) = |
|||
if n>=0L |
|||
then BigInt(1,BigInt.nat (BigNatModule.of_int64 n)) |
|||
elif (n = System.Int64.MinValue) |
|||
then BigInt(-1,BigInt.nat (BigNatModule.add (BigNatModule.of_int64 System.Int64.MaxValue) BigNatModule.one) ) |
|||
else BigInt(-1,BigInt.nat (BigNatModule.of_int64 (-n))) |
|||
|
|||
static member ToInt64(z:BigInt) = |
|||
let u = BigNatModule.to_uint64 z.V |
|||
if u <= uint64 System.Int64.MaxValue then |
|||
(* Handle range [-MaxValue,MaxValue] *) |
|||
int64 z.SignInt * int64 u |
|||
elif z.SignInt = -1 && u = uint64 (System.Int64.MaxValue + 1L) then |
|||
//assert(System.Int64.MinValue = 0 - System.Int64.MaxValue - 1L) |
|||
(* Handle MinValue = -(MaxValue+1) special case not covered by the above *) |
|||
System.Int64.MinValue |
|||
else |
|||
raise (System.OverflowException()) |
|||
|
|||
static member One = one |
|||
static member Zero = zero |
|||
static member (~-) (z:BigInt) = BigInt.create(-1 * z.SignInt,z.V) |
|||
static member Scale(k,z:BigInt) = |
|||
if k<0 |
|||
then BigInt.create(-z.SignInt, (BigNatModule.scale (-k) z.V)) // k.zsign.zv = -zsign.(-k.zv) |
|||
else BigInt.create(z.SignInt, (BigNatModule.scale k z.V)) // k.zsign.zv = zsign.k.zv |
|||
|
|||
// Result: 1.nx - 1.ny (integer subtraction) |
|||
static member internal subnn (nx,ny) = |
|||
if BigNatModule.gte nx ny |
|||
then BigInt.posn (BigNatModule.sub nx ny) // nx >= ny, result +ve, +1.(nx - ny) |
|||
else BigInt.negn (BigNatModule.sub ny nx) // nx < ny, result -ve, -1.(ny - nx) |
|||
|
|||
static member internal addnn (nx,ny) = |
|||
BigInt.posn (BigNatModule.add nx ny) // Compute "nx + ny" to be integer |
|||
|
|||
member x.IsZero = BigNatModule.isZero x.V // signx.xv = 0 iff xv=0, since signx is +1,-1 |
|||
member x.IsOne = (x.SignInt = 1) && BigNatModule.isOne x.V // signx.xv = 1 iff signx = +1 and xv = 1 |
|||
static member (+) (x:BigInt,y:BigInt) = |
|||
if y.IsZero then x else |
|||
if x.IsZero then y else |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigInt.addnn(x.V,y.V) // 1.xv + 1.yv = (xv + yv) |
|||
| -1,-1 -> -(BigInt.addnn(x.V,y.V)) // -1.xv + -1.yv = -(xv + yv) |
|||
| 1,-1 -> BigInt.subnn (x.V,y.V) // 1.xv + -1.yv = (xv - yv) |
|||
| -1, 1 -> BigInt.subnn(y.V,x.V) // -1.xv + 1.yv = (yv - xv) |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member (-) (x:BigInt,y:BigInt) = |
|||
if y.IsZero then x else |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigInt.subnn(x.V,y.V) // 1.xv - 1.yv = (xv - yv) |
|||
| -1,-1 -> BigInt.subnn(y.V,x.V) // -1.xv - -1.yv = (yv - xv) |
|||
| 1,-1 -> BigInt.addnn(x.V,y.V) // 1.xv - -1.yv = (xv + yv) |
|||
| -1, 1 -> -(BigInt.addnn(x.V,y.V)) // -1.xv - 1.yv = -(xv + yv) |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member ( * ) (x:BigInt,y:BigInt) = |
|||
if x.IsZero then x |
|||
elif y.IsZero then y |
|||
elif x.IsOne then y |
|||
elif y.IsOne then x |
|||
else |
|||
let m = (BigNatModule.mul x.V y.V) |
|||
// sample "smallMulResult" (BigNatModule.is_small m) smallMulResult |
|||
BigInt.create (x.SignInt * y.SignInt,m) // xsign.xv * ysign.yv = (xsign.ysign).(xv.yv) |
|||
|
|||
static member DivRem (x:BigInt,y:BigInt) = |
|||
let d,r = BigNatModule.divmod x.V y.V |
|||
// HAVE: |x| = d.|y| + r and 0 <= r < |y| |
|||
// HAVE: xv = d.yv + r and 0 <= r < yv |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigInt.posn d,BigInt.posn r // 1.xv = 1.d.( 1.yv) + ( 1.r) |
|||
| -1,-1 -> BigInt.posn d,BigInt.negn r // -1.xv = 1.d.(-1.yv) + (-1.r) |
|||
| 1,-1 -> BigInt.negn d,BigInt.posn r // 1.xv = -1.d.(-1.yv) + ( 1.r) |
|||
| -1, 1 -> BigInt.negn d,BigInt.negn r // -1.xv = -1.d.( 1.yv) + (-1.r) |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member (/) (x:BigInt,y:BigInt) = fst (BigInt.DivRem(x,y)) |
|||
static member (%) (x:BigInt,y:BigInt) = snd (BigInt.DivRem(x,y)) |
|||
static member Gcd (x:BigInt,y:BigInt) = BigInt.posn (BigNatModule.hcf x.V y.V) // hcf (xsign.xv,ysign.yv) = hcf (xv,yv) |
|||
|
|||
(* |
|||
let min (x:BigInt) (y:BigInt) = |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> if BigNatModule.lte(x.V,y.V) then x else y // if xv <= yv then 1.xv <= 1.yv |
|||
| -1,-1 -> if BigNatModule.lte(x.V,y.V) then y else x // if xv <= yv then -1.yv <= -1.xv |
|||
| 1,-1 -> y // -1.yv <= 1.xv |
|||
| -1, 1 -> x // -1.xv <= 1.yv |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
let max (x:BigInt) (y:BigInt) = |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> if BigNatModule.gte(x.V,y.V) then x else y // if xv >= yv then 1.xv >= 1.yv |
|||
| -1,-1 -> if BigNatModule.gte(x.V,y.V) then y else x // if xv >= yv then -1.yv >= -1.xv |
|||
| 1,-1 -> x // 1.xv >= -1.yv |
|||
| -1, 1 -> y // 1.yv >= -1.xv |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
*) |
|||
member x.IsNegative = x.SignInt = -1 && not (x.IsZero) // signx.xv < 0 iff signx = -1 and xv<>0 |
|||
member x.IsPositive = x.SignInt = 1 && not (x.IsZero) // signx.xv > 0 iff signx = +1 and xv<>0 |
|||
static member Abs (x:BigInt) = if x.SignInt = -1 then -x else x |
|||
|
|||
static member op_LessThanOrEqual (x:BigInt,y:BigInt) = |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigNatModule.lte x.V y.V // 1.xv <= 1.yv iff xv <= yv |
|||
| -1,-1 -> BigNatModule.lte y.V x.V // -1.xv <= -1.yv iff yv <= xv |
|||
| 1,-1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V // 1.xv <= -1.yv, |
|||
// (a) if xv=0 and yv=0 then true |
|||
// (b) otherwise false, only meet at zero. |
|||
|
|||
| -1, 1 -> true // -1.xv <= 1.yv, true |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member op_GreaterThanOrEqual (x:BigInt,y:BigInt) = // Follow lte by +/- symmetry |
|||
match x.SignInt,y.SignInt with |
|||
| 1, 1 -> BigNatModule.gte x.V y.V |
|||
| -1,-1 -> BigNatModule.gte y.V x.V |
|||
| 1,-1 -> true |
|||
| -1, 1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member internal powi (z:BigInt,i) = |
|||
if i>=0 then |
|||
// (signz.zv)^i = (signz^i) .(zv^i) |
|||
// = (signz^(i mod 2)).(zv^i) since signInt is 1,-1 |
|||
// = either 1.zv^i when i mod 2 = 0 (even power kills signInt) |
|||
// or signz.zv^i when i mod 2 = 1 (odd power keeps signInt) |
|||
|
|||
BigInt.create ((if i % 2 = 0 then 1 else z.SignInt), BigNatModule.powi z.V i) |
|||
else |
|||
invalidArg "i" "unexpected negative exponent" |
|||
|
|||
static member Pow (z:BigInt,i:BigInt) = |
|||
if not i.IsNegative then |
|||
BigInt.create ((if BigNatModule.isZero (BigNatModule.rem i.V BigNatModule.two) then 1 else z.SignInt), BigNatModule.pow z.V i.V) |
|||
else |
|||
invalidArg "i" "unexpected negative exponent" |
|||
|
|||
static member ToDouble(x:BigInt) = |
|||
match x.SignInt with |
|||
| 1 -> BigNatModule.to_float x.V // float (1.xv) = float (xv) |
|||
| -1 -> - (BigNatModule.to_float x.V) // float (-1.xv) = - float (xv) |
|||
| _ -> invalidArg "x" "signs should be +/- 1" |
|||
|
|||
static member Parse(str:string) = |
|||
let len = str.Length |
|||
if len = 0 then invalidArg "str" "empty string"; |
|||
if str.[0..0] = "-" then |
|||
BigInt.negn (BigNatModule.of_string str.[1..len-1]) |
|||
else |
|||
BigInt.posn (BigNatModule.of_string str) |
|||
|
|||
member internal x.IsSmall = BigNatModule.is_small (x.V) |
|||
static member Factorial (x:BigInt) = |
|||
if x.IsNegative then invalidArg "x" "the input was negative" |
|||
elif x.IsPositive then BigInt.posn (BigNatModule.factorial x.V) |
|||
else BigInt.One |
|||
|
|||
static member ( ~+ )(n1:BigInt) = n1 |
|||
static member (..) (n1:BigInt,n2:BigInt) = OperatorIntrinsics.RangeStepGeneric(BigInt.Zero,(+),n1,BigInt.One,n2) |
|||
static member (.. ..) (n1:BigInt,step:BigInt,n2:BigInt) = OperatorIntrinsics.RangeStepGeneric(BigInt.Zero,(+),n1,step,n2) |
|||
|
|||
static member FromInt64(x:int64) = new BigInt(x) |
|||
static member FromInt32(x:int32) = new BigInt(x) |
|||
|
|||
type bigint = BigInt |
|||
|
|||
namespace Microsoft.FSharp.Core |
|||
|
|||
#if FX_ATLEAST_40 |
|||
// The "bigint" type alias is not defined in the FSharp.Core namespace in Dev10. |
|||
type bigint = |
|||
| NotDefined |
|||
#else |
|||
type bigint = Microsoft.FSharp.Math.BigInt |
|||
#endif |
|||
open System |
|||
open System.Diagnostics.CodeAnalysis |
|||
open System.Globalization |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Math |
|||
|
|||
#if FX_ATLEAST_40 |
|||
// No need for FxCop suppressions on Dev10 |
|||
#else |
|||
// FxCop suppressions |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_Addition(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_Division(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_GreaterThan(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_GreaterThanOrEqual(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_LessThan(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_LessThanOrEqual(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_Modulus(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_Multiply(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_Subtraction(Microsoft.FSharp.Math.BigInt,Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_UnaryNegation(Microsoft.FSharp.Math.BigInt)")>] |
|||
[<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigInt.#op_UnaryPlus(Microsoft.FSharp.Math.BigInt)")>] |
|||
do() |
|||
#endif |
|||
|
|||
[<AutoOpen>] |
|||
module NumericLiterals = |
|||
|
|||
#if FX_ATLEAST_40 |
|||
module NumericLiteralI = |
|||
let numTy = System.Reflection.Assembly.Load("System").GetType("System.Numerics.BigInteger") |
|||
let meth64 = numTy.GetConstructor([|typeof<int64>|]) |
|||
let methString = numTy.GetMethod("Parse",[|typeof<string>; typeof<System.Globalization.NumberStyles>; typeof<System.IFormatProvider> |]) |
|||
|
|||
let tab64 = new System.Collections.Generic.Dictionary<int64,obj>() |
|||
let tabParse = new System.Collections.Generic.Dictionary<string,obj>() |
|||
let FromInt64Dynamic (x64:int64) : obj = |
|||
lock tab64 (fun () -> |
|||
let mutable res = Unchecked.defaultof<_> |
|||
let ok = tab64.TryGetValue(x64,&res) |
|||
if ok then res else |
|||
res <- meth64.Invoke [| box x64 |] |
|||
tab64.[x64] <- res |
|||
res) |
|||
|
|||
let inline get32 (x32:int32) = FromInt64Dynamic (int64 x32) |
|||
|
|||
let inline isOX s = not (System.String.IsNullOrEmpty(s)) && s.Length > 2 && s.[0] = '0' && s.[1] = 'x' |
|||
|
|||
let FromStringDynamic (s:string) : obj = |
|||
lock tabParse (fun () -> |
|||
let mutable res = Unchecked.defaultof<_> |
|||
let ok = tabParse.TryGetValue(s,&res) |
|||
if ok then res else |
|||
res <- |
|||
if isOX s then |
|||
methString.Invoke(null,[| box s; box NumberStyles.AllowHexSpecifier; box CultureInfo.InvariantCulture |] ) |
|||
else |
|||
methString.Invoke(null,[| box s; box NumberStyles.AllowLeadingSign; box CultureInfo.InvariantCulture |] ) |
|||
|
|||
tabParse.[s] <- res |
|||
res) |
|||
|
|||
let inline FromZero () : 'T = |
|||
(get32 0 :?> 'T) |
|||
when 'T : bigint = BigInt.Zero |
|||
|
|||
let inline FromOne () : 'T = |
|||
(get32 1 :?> 'T) |
|||
when 'T : bigint = BigInt.One |
|||
|
|||
let inline FromInt32 (i:int32): 'T = |
|||
(get32 i :?> 'T) |
|||
when 'T : bigint = new BigInt(i) |
|||
|
|||
let inline FromInt64 (i:int64): 'T = |
|||
(FromInt64Dynamic i :?> 'T) |
|||
when 'T : bigint = new BigInt(i) |
|||
|
|||
let inline FromString (s:string) : 'T = |
|||
(FromStringDynamic s :?> 'T) |
|||
when 'T : bigint = |
|||
if isOX s then |
|||
BigInt.Parse (s.[2..],NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture) |
|||
else |
|||
BigInt.Parse (s,NumberStyles.AllowLeadingSign,CultureInfo.InvariantCulture) |
|||
|
|||
#else |
|||
module NumericLiteralI = |
|||
let tab64 = new System.Collections.Generic.Dictionary<int64,bigint>() |
|||
let get64 (x64:int64) = |
|||
lock tab64 (fun () -> |
|||
let mutable res = Unchecked.defaultof<_> |
|||
let ok = tab64.TryGetValue(x64,&res) |
|||
if ok then res else |
|||
res <- BigInt.FromInt64 x64 |
|||
tab64.[x64] <- res |
|||
res) |
|||
|
|||
let get32 (x32:int32) = get64 (int64 x32) |
|||
|
|||
let tabParse = new System.Collections.Generic.Dictionary<string,bigint>() |
|||
let getParse s = |
|||
lock tabParse (fun () -> |
|||
let mutable res = Unchecked.defaultof<_> |
|||
let ok = tabParse.TryGetValue(s,&res) |
|||
if ok then res else |
|||
res <- BigInt.Parse s |
|||
tabParse.[s] <- res |
|||
res) |
|||
|
|||
let FromZero () = BigInt.Zero |
|||
let FromOne () = BigInt.One |
|||
let FromInt32 i = get32 i |
|||
let FromInt64 i = get64 i |
|||
let FromString s = getParse s |
|||
|
|||
module NumericLiteralN = |
|||
let FromZero () = failwith "this code should not be reachable" |
|||
let FromOne () = failwith "this code should not be reachable" |
|||
let FromInt32 (i:int32) = failwith "this code should not be reachable" |
|||
let FromInt64 (i64:int64) = failwith "this code should not be reachable" |
|||
let FromString (s:string) = failwith "this code should not be reachable" |
|||
#endif // FX_ATLEAST_40 |
|||
|
|||
#endif |
|||
|
|||
@ -1,158 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// This namespace contains numerical and mathematical types such as arbitrarily sized integers |
|||
namespace Microsoft.FSharp.Math |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core |
|||
|
|||
#if FX_ATLEAST_40 |
|||
type BigInt = System.Numerics.BigInteger |
|||
type bigint = System.Numerics.BigInteger |
|||
#else |
|||
/// The type of arbitrary-sized integers |
|||
[<Struct>] |
|||
[<StructuralEquality(false); StructuralComparison(false)>] |
|||
type BigInt = |
|||
/// Return the sum of two big integers |
|||
static member ( + ) : x:BigInt * y:BigInt -> BigInt |
|||
/// Return the modulus of big integers |
|||
static member ( % ) : x:BigInt * y:BigInt -> BigInt |
|||
/// Return the product of big integers |
|||
static member ( * ) : x:BigInt * y:BigInt -> BigInt |
|||
/// Return the difference of big integers |
|||
static member ( - ) : x:BigInt * y:BigInt -> BigInt |
|||
/// Return the ratio of big integers |
|||
static member ( / ) : x:BigInt * y:BigInt -> BigInt |
|||
/// Return the negation of a big integer |
|||
static member (~-) : x:BigInt -> BigInt |
|||
/// Return the given big integer |
|||
static member (~+) : x:BigInt -> BigInt |
|||
/// Generate a range of big integers |
|||
static member (..) : start:BigInt * finish:BigInt -> seq<BigInt> |
|||
/// Generate a range of big integers, with a step |
|||
static member (.. ..) : start:BigInt * step:BigInt * finish:BigInt -> seq<BigInt> |
|||
/// Convert a big integer to a floating point number |
|||
static member ToDouble : x:BigInt -> float |
|||
/// Convert a big integer to a 64-bit signed integer |
|||
static member ToInt64 : x:BigInt -> int64 |
|||
/// Convert a big integer to a 32-bit signed integer |
|||
static member ToInt32 : x:BigInt -> int32 |
|||
/// Parse a big integer from a string format |
|||
static member Parse : text:string -> BigInt |
|||
/// Return the sign of a big integer: 0, +1 or -1 |
|||
member Sign : int |
|||
/// Compute the factorial function as a big integer |
|||
static member Factorial : x:BigInt -> BigInt |
|||
/// Compute the ratio and remainder of two big integers |
|||
static member DivRem : x:BigInt * y:BigInt -> BigInt * BigInt |
|||
|
|||
/// This operator is for use from other .NET languages |
|||
static member op_LessThan : x:BigInt * y:BigInt -> bool |
|||
/// This operator is for use from other .NET languages |
|||
static member op_LessThanOrEqual : x:BigInt * y:BigInt -> bool |
|||
/// This operator is for use from other .NET languages |
|||
static member op_GreaterThan : x:BigInt * y:BigInt -> bool |
|||
/// This operator is for use from other .NET languages |
|||
static member op_GreaterThanOrEqual : x:BigInt * y:BigInt -> bool |
|||
/// This operator is for use from other .NET languages |
|||
static member op_Equality : x:BigInt * y:BigInt -> bool |
|||
/// This operator is for use from other .NET languages |
|||
static member op_Inequality : x:BigInt * y:BigInt -> bool |
|||
|
|||
/// Return the greatest common divisor of two big integers |
|||
static member Gcd : x:BigInt * y:BigInt -> BigInt |
|||
/// Return n^m for two big integers |
|||
static member Pow : x:BigInt * y:BigInt -> BigInt |
|||
/// Compute the absolute value of a big integer |
|||
static member Abs : x:BigInt -> BigInt |
|||
/// Get the big integer for zero |
|||
static member Zero : BigInt |
|||
/// Get the big integer for one |
|||
static member One : BigInt |
|||
|
|||
|
|||
/// Return true if a big integer is 'zero' |
|||
member IsZero : bool |
|||
/// Return true if a big integer is 'one' |
|||
member IsOne : bool |
|||
interface System.IComparable |
|||
override Equals : obj -> bool |
|||
override GetHashCode : unit -> int |
|||
override ToString : unit -> string |
|||
|
|||
[<OverloadID("new_int")>] |
|||
/// Construct a BigInt value for the given integer |
|||
new : x:int -> BigInt |
|||
[<OverloadID("new_int64")>] |
|||
/// Construct a BigInt value for the given 64-bit integer |
|||
new : x:int64 -> BigInt |
|||
|
|||
type bigint = BigInt |
|||
|
|||
namespace Microsoft.FSharp.Core |
|||
|
|||
open Microsoft.FSharp.Math |
|||
|
|||
#if FX_ATLEAST_40 |
|||
[<System.Obsolete("The 'bigint' type abbreviation has been moved to 'Microsoft.FSharp.Math'. Please use 'open Microsoft.FSharp.Math' to use this abbreviation and ensure you reference 'System.dll'",true)>] |
|||
type bigint |
|||
#else |
|||
/// An abbreviation for the type <c>Microsoft.FSharp.Math.BigInt</c> |
|||
[<System.Obsolete("The 'bigint' type abbreviation has been moved to 'Microsoft.FSharp.Math'. Please use 'open Microsoft.FSharp.Math' to use this abbreviation")>] |
|||
type bigint = Microsoft.FSharp.Math.BigInt |
|||
#endif |
|||
|
|||
[<AutoOpen>] |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
module NumericLiterals = |
|||
|
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
module NumericLiteralI = |
|||
#if FX_ATLEAST_40 |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val inline FromZero : value:unit -> 'T |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val inline FromOne : value:unit -> 'T |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val inline FromInt32 : value:int32 -> 'T |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val inline FromInt64 : value:int64 -> 'T |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val inline FromString : text:string -> 'T |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromInt64Dynamic : value:int64 -> obj |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromStringDynamic : text:string -> obj |
|||
#else |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromZero : unit -> bigint |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromOne : unit -> bigint |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromInt32 : value:int32 -> bigint |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromInt64 : value:int64 -> bigint |
|||
/// Provides a default implementations of F# numeric literal syntax for literals fo the form 'dddI' |
|||
val FromString : text:string -> bigint |
|||
|
|||
|
|||
/// Provide a default implementation of the F# numeric literal syntax 'dddN' |
|||
module NumericLiteralN = |
|||
[<System.Obsolete("Numeric literals of the form dddN are now only supported by an explicit definition of a NumericLiteralN module containing FromZero, FromOne, FromInt32, FromInt64 and FromString methods for an appropriate numeric type. One such implementation can be found in the FSharp.PowerPack.dll",true)>] |
|||
val FromZero : unit -> 'a |
|||
[<System.Obsolete("Numeric literals of the form dddN are now only supported by an explicit definition of a NumericLiteralN module containing FromZero, FromOne, FromInt32, FromInt64 and FromString methods for an appropriate numeric type. One such implementation can be found in the FSharp.PowerPack.dll",true)>] |
|||
val FromOne : unit -> 'a |
|||
[<System.Obsolete("Numeric literals of the form dddN are now only supported by an explicit definition of a NumericLiteralN module containing FromZero, FromOne, FromInt32, FromInt64 and FromString methods for an appropriate numeric type. One such implementation can be found in the FSharp.PowerPack.dll",true)>] |
|||
val FromInt32 : int32 -> 'a |
|||
[<System.Obsolete("Numeric literals of the form dddN are now only supported by an explicit definition of a NumericLiteralN module containing FromZero, FromOne, FromInt32, FromInt64 and FromString methods for an appropriate numeric type. One such implementation can be found in the FSharp.PowerPack.dll",true)>] |
|||
val FromInt64 : int64 -> 'a |
|||
[<System.Obsolete("Numeric literals of the form dddN are now only supported by an explicit definition of a NumericLiteralN module containing FromZero, FromOne, FromInt32, FromInt64 and FromString methods for an appropriate numeric type. One such implementation can be found in the FSharp.PowerPack.dll",true)>] |
|||
val FromString : string -> 'a |
|||
#endif |
|||
|
|||
#endif |
|||
|
|||
@ -1,57 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.NativeInterop |
|||
|
|||
#nowarn "44";; |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
open Microsoft.FSharp.Core.Operators |
|||
|
|||
open System |
|||
open System.Diagnostics |
|||
open System.Runtime.InteropServices |
|||
|
|||
[<RequireQualifiedAccess>] |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
module NativePtr = |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline of_nativeint (x:nativeint) = (# "" x : nativeptr<'T> #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline to_nativeint (x: nativeptr<'T>) = (# "" x : nativeint #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline add (x : nativeptr<'T>) (n:int) : nativeptr<'T> = to_nativeint x + nativeint n * (# "sizeof !0" type('T) : nativeint #) |> of_nativeint |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline get (p : nativeptr<'T>) n = (# "ldobj !0" type ('T) (add p n) : 'T #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline set (p : nativeptr<'T>) n (x : 'T) = (# "stobj !0" type ('T) (add p n) x #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline read (p : nativeptr<'T>) = (# "ldobj !0" type ('T) p : 'T #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline write (p : nativeptr<'T>) (x : 'T) = (# "stobj !0" type ('T) p x #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline of_array (arr: 'T[]) (m:int) : nativeptr<'T> = (# "ldelema !0" type('T) arr m : nativeptr<'T> #) |
|||
|
|||
[<NoDynamicInvocation>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let inline of_array2 (arr: 'T[,]) (n:int) (m:int) : nativeptr<'T> = (# "ldelema.multi 2 !0" type('T) arr n m : nativeptr<'T> #) |
|||
|
|||
@ -1,63 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
|
|||
namespace Microsoft.FSharp.NativeInterop |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
[<RequireQualifiedAccess>] |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
/// Contains operations on native pointers. Use of these operators may |
|||
/// result in the generation of unverifiable code. |
|||
module NativePtr = |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Return a typed native pointer for a given machine address |
|||
val inline of_nativeint : address:nativeint -> nativeptr<'T> |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Return a machine address for a given typed native pointer |
|||
val inline to_nativeint : address:nativeptr<'T> -> nativeint |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Return a typed native pointer by adding index * sizeof<'T> to the |
|||
/// given input pointer |
|||
val inline add : address:nativeptr<'T> -> index:int -> nativeptr<'T> |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Dereference the typed native pointer computed by adding index * sizeof<'T> to the |
|||
/// given input pointer |
|||
val inline get : address:nativeptr<'T> -> index:int -> 'T |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Dereference the given typed native pointer |
|||
val inline read : address:nativeptr<'T> -> 'T |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Assign the <c>value</c> into the memory location referenced by the given typed native pointer |
|||
val inline write : address:nativeptr<'T> -> value:'T -> unit |
|||
|
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
/// Assign the <c>value</c> into the memory location referenced by the typed native |
|||
/// pointer computed by adding index * sizeof<'T> to the given input pointer |
|||
val inline set : address:nativeptr<'T> -> index:int -> value:'T -> unit |
|||
|
|||
/// Get the address of an element of a pinned array |
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
val inline of_array: array:'T[] -> index:int -> nativeptr<'T> |
|||
|
|||
/// Get the address of an element of a pinned 2-dimensional array |
|||
[<Unverifiable>] |
|||
[<NoDynamicInvocation>] |
|||
val inline of_array2 : array:'T[,] -> index1:int -> index2:int -> nativeptr<'T> |
|||
@ -1,79 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
|
|||
namespace Microsoft.FSharp.Core |
|||
|
|||
open System.Diagnostics |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core.Operators |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
module Option = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let get option = match option with None -> invalidArg "option" "The option value was None" | Some x -> x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let isSome option = match option with None -> false | Some _ -> true |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let is_some option = match option with None -> false | Some _ -> true |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let isNone option = match option with None -> true | Some _ -> false |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let is_none option = match option with None -> true | Some _ -> false |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let count option = match option with None -> 0 | Some _ -> 1 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold f s inp = match inp with None -> s | Some x -> f s x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldBack f inp s = match inp with None -> s | Some x -> f x s |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left f s inp = match inp with None -> s | Some x -> f s x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right f inp s = match inp with None -> s | Some x -> f x s |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists p inp = match inp with None -> false | Some x -> p x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall p inp = match inp with None -> true | Some x -> p x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let filter p inp = match inp with None -> None | Some x -> if p x then inp else None |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition p inp = match inp with None -> None,None | Some x -> if p x then inp,None else None,inp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f inp = match inp with None -> () | Some x -> f x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f inp = match inp with None -> None | Some x -> Some (f x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let bind f inp = match inp with None -> None | Some x -> f x |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_array option = match option with None -> [| |] | Some x -> [| x |] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_list option = match option with None -> [ ] | Some x -> [ x ] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length option = match option with None -> 0 | Some _ -> 1 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all p inp = match inp with None -> true | Some x -> p x |
|||
|
|||
@ -1,87 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Core |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
/// Basic operations on options. |
|||
module Option = |
|||
|
|||
/// Returns true if the option is not None |
|||
val isSome: option:'T option -> bool |
|||
|
|||
/// Returns true if the option is None |
|||
val isNone: option:'T option -> bool |
|||
|
|||
/// Gets the value associated with the option. If the option is None then |
|||
/// raises ArgumentException |
|||
val get: option:'T option -> 'T |
|||
|
|||
/// <c>length inp</c> evaluates to <c>match inp with None -> 0 | Some _ -> 1</c> |
|||
val count: option:'T option -> int |
|||
|
|||
/// <c>fold_left f s inp</c> evaluates to <c>match inp with None -> s | Some x -> f s x</c> |
|||
val fold: folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State |
|||
|
|||
/// <c>fold_right f inp s</c> evaluates to "match inp with None -> s | Some x -> f x s" |
|||
val foldBack: folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State |
|||
|
|||
/// <c>exists p inp</c> evaluates to <c>match inp with None -> false | Some x -> p x</c> |
|||
val exists: predicate:('T -> bool) -> option:'T option -> bool |
|||
|
|||
/// <c>forall p inp" evaluates to "match inp with None -> true | Some x -> p x</c> |
|||
val forall: predicate:('T -> bool) -> option:'T option -> bool |
|||
|
|||
/// <c>iter f inp</c> executes <c>match inp with None -> () | Some x -> f x</c> |
|||
val iter: action:('T -> unit) -> option:'T option -> unit |
|||
|
|||
/// <c>map f inp</c> evaluates to <c>match inp with None -> None | Some x -> Some (f x)</c> |
|||
val map: mapping:('T -> 'U) -> option:'T option -> 'U option |
|||
|
|||
/// <c>bind f inp</c> evaluates to <c>match inp with None -> None | Some x -> f x</c> |
|||
val bind: binder:('T -> 'U option) -> option:'T option -> 'U option |
|||
|
|||
/// Convert the option to an array of length 0 or 1 |
|||
val to_array: option:'T option -> 'T array |
|||
|
|||
/// Convert the option to a list of length 0 or 1 |
|||
val to_list: option:'T option -> 'T list |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'isSome' instead")>] |
|||
val is_some: option:'T option -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'isNone' instead")>] |
|||
val is_none: option:'T option -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right: folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:('T -> bool) -> option:'T option -> bool |
|||
|
|||
/// <c>filter p inp</c> evaluates to <c>match inp with None -> None | Some x -> if p x then inp else None</c> |
|||
[<Obsolete("This function will be removed from the F# library in a future release, as it is rarely used")>] |
|||
val filter: predicate:('T -> bool) -> option:'T option -> 'T option |
|||
|
|||
/// <c>filter p inp</c> evaluates to <c>match inp with None -> None | Some x -> if p x then inp else None</c> |
|||
[<Obsolete("This function will be removed from the F# library in a future release, as it is rarely used")>] |
|||
val length: option:'T option -> int |
|||
|
|||
/// <c>partition p inp</c> evaluates to |
|||
/// <c>match inp with None -> None,None | Some x -> if p x then inp,None else None,inp</c> |
|||
[<Obsolete("This function will be removed from the F# library in a future release, as it is rarely used")>] |
|||
val partition: predicate:('T -> bool) -> option:'T option -> ('T option * 'T option) |
|||
|
|||
#endif |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,630 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Text |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Text |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Reflection |
|||
open Microsoft.FSharp.Text.StructuredPrintfImpl |
|||
open System.Globalization |
|||
open System.IO |
|||
open System.Text |
|||
|
|||
type PrintfFormat<'printer,'state,'residue,'result>(value:string) = |
|||
member x.Value = value |
|||
|
|||
type PrintfFormat<'printer,'state,'residue,'result,'tuple>(value:string) = |
|||
inherit PrintfFormat<'printer,'state,'residue,'result>(value) |
|||
|
|||
type Format<'printer,'state,'residue,'result> = PrintfFormat<'printer,'state,'residue,'result> |
|||
type Format<'printer,'state,'residue,'result,'tuple> = PrintfFormat<'printer,'state,'residue,'result,'tuple> |
|||
|
|||
module PrintfImpl = |
|||
|
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Reflection |
|||
open System.Reflection |
|||
|
|||
type buf = System.Text.StringBuilder |
|||
|
|||
let string_of_char (c:char) = System.Char.ToString(c) |
|||
let string_of_int (i:int) = i.ToString() |
|||
|
|||
type info = |
|||
{ mutable leftJustify : bool; |
|||
mutable numPrefixIfPos : char option; |
|||
mutable addZeros : bool; } |
|||
|
|||
let outputSignAndLeftSpace(outputChar,info,pos,width,numDigits) = |
|||
let used = |
|||
if pos then |
|||
match info.numPrefixIfPos with |
|||
| None -> 0 |
|||
| Some _ -> 1 |
|||
else 1 |
|||
let len = numDigits + used |
|||
if not info.leftJustify && not info.addZeros then |
|||
match width with |
|||
| None -> () |
|||
| Some w -> |
|||
for i = 1 to (w - len) do |
|||
outputChar ' '; |
|||
begin |
|||
if pos then |
|||
match info.numPrefixIfPos with |
|||
| None -> () |
|||
| Some c -> outputChar c |
|||
else outputChar '-'; |
|||
end; |
|||
if not info.leftJustify && info.addZeros then |
|||
match width with |
|||
| None -> () |
|||
| Some w -> |
|||
for i = 1 to (w - len) do |
|||
outputChar (if info.addZeros then '0' else ' '); |
|||
used |
|||
|
|||
let decode (c:char) = System.Convert.ToInt32(c) |
|||
let encode (x:int) = System.Convert.ToChar(x) |
|||
|
|||
let outputDigit(outputChar,intFormatChar,digit) = |
|||
let digitc = |
|||
if digit < 10 |
|||
then decode '0' + digit |
|||
else decode (if intFormatChar = 'x' then 'a' else 'A') + (digit - 10) |
|||
outputChar (encode digitc) |
|||
|
|||
let outputSpace(outputChar,width,len) = |
|||
match width with |
|||
| None -> () |
|||
| Some width -> |
|||
for i = 1 to (width - len) do |
|||
outputChar ' '; |
|||
|
|||
let outputZeros(outputChar,width,len) = |
|||
match width with |
|||
| None -> () |
|||
| Some width -> |
|||
for i = 1 to (width - len) do |
|||
outputChar '0' |
|||
|
|||
let outputRightSpace(outputChar,leftJustify,width,len) = |
|||
if leftJustify then outputSpace(outputChar,width,len) |
|||
|
|||
let outputUInt64(outputChar,intFormatChar,width,info,(n:uint64)) = |
|||
let nbase = match intFormatChar with 'o' -> 8uL | 'x' | 'X' -> 16uL | _ -> 10uL |
|||
let numDigits = |
|||
let mutable numDigits = 1 |
|||
let mutable nval = n / nbase |
|||
while nval > 0UL do |
|||
numDigits <- numDigits + 1; |
|||
nval <- nval / nbase; |
|||
numDigits |
|||
let topdiv = |
|||
let mutable topdiv = 1UL |
|||
for i = 1 to numDigits - 1 do |
|||
topdiv <- topdiv * nbase; |
|||
topdiv |
|||
|
|||
let len = numDigits + (outputSignAndLeftSpace(outputChar,info,true,width,numDigits)) |
|||
|
|||
let mutable residue = n |
|||
let mutable divisor = topdiv |
|||
while divisor > 0UL do |
|||
let digit = residue / divisor |
|||
outputDigit(outputChar,intFormatChar, int32(int64 digit)); |
|||
residue <- residue % divisor; |
|||
divisor <- divisor / nbase; |
|||
outputRightSpace(outputChar,info.leftJustify,width,len) |
|||
|
|||
let outputInt64(outputChar,intFormatChar,width,info,(n:int64)) = |
|||
let nbase = match intFormatChar with 'o' -> 8L | 'x' | 'X' -> 16L | _ -> 10L |
|||
let numDigits = |
|||
let mutable numDigits = 1 |
|||
let mutable nval = if n >= 0L then n / nbase else - (n / nbase) |
|||
while nval > 0L do |
|||
numDigits <- numDigits + 1; |
|||
nval <- nval / nbase; |
|||
numDigits |
|||
let topdiv = |
|||
let mutable topdiv = 1L |
|||
for i = 1 to numDigits - 1 do |
|||
topdiv <- topdiv * nbase; |
|||
topdiv |
|||
|
|||
let len = numDigits + (outputSignAndLeftSpace(outputChar,info,(n >= 0L),width,numDigits) ) |
|||
|
|||
let mutable residue = |
|||
if n = System.Int64.MinValue then System.Int64.MaxValue |
|||
elif n < 0L then - n |
|||
else n |
|||
let mutable divisor = topdiv |
|||
while divisor > 0L do |
|||
let digit = |
|||
if n = System.Int64.MinValue && divisor = 1L |
|||
then (match intFormatChar with 'd' | 'i' -> 8L | _ -> 100L) // nb. special case for min_int |
|||
else residue / divisor |
|||
outputDigit(outputChar,intFormatChar,int32(digit)); |
|||
residue <- residue % divisor; |
|||
divisor <- divisor / nbase; |
|||
outputRightSpace(outputChar,info.leftJustify,width,len) |
|||
|
|||
// The general technique used this file is to interpret |
|||
// a format string and use reflection to construct a function value that matches |
|||
// the specification of the format string. |
|||
// |
|||
// Generics add some serious complications here - we have to generate |
|||
// a function value of exactly the right runtime type, though the most |
|||
// natural scheme is to produce one of type 'obj -> obj'. We get around |
|||
// this by using a semi-reflective approach to creating and invoking |
|||
// function values of the right type. This comes with some |
|||
// overheads (though they are not too bad) and thus could and should be |
|||
// optimized in some special cases, e.g. where a format string |
|||
// just contains a single simple format specifier such as '%x' |
|||
//type DynamicFunction<'a,'b> = |
|||
// static member Make(impl : obj -> obj) : obj = |
|||
// box (fun (inp:'a) -> (unbox (impl (box (inp : 'a))) : 'b)) |
|||
|
|||
//let dynCloMakerTy = typeof<DynamicFunction<obj,obj>>.GetGenericTypeDefinition() |
|||
let staticInvokeFlags = BindingFlags.Public ||| BindingFlags.InvokeMethod ||| BindingFlags.Static |
|||
let mkFunctionValue (tys: System.Type[]) (impl:obj->obj) = |
|||
//let saverTy = dynCloMakerTy.MakeGenericType(tys) |
|||
FSharpValue.MakeFunction(FSharpType.MakeFunctionType(tys.[0],tys.[1]), impl) |
|||
//saverTy.InvokeMember("Make",staticInvokeFlags,null,null,[| box impl |]) |
|||
|
|||
let funTyC = typeof<(obj -> obj)>.GetGenericTypeDefinition() |
|||
let mkFunTy a b = funTyC.MakeGenericType([| a;b |]) |
|||
|
|||
let isNamedType(ty:System.Type) = not (ty.IsArray || ty.IsByRef || ty.IsPointer) |
|||
let isFunctionType (ty1:System.Type) = |
|||
isNamedType(ty1) && ty1.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(funTyC) |
|||
|
|||
let rec destFunTy (ty:System.Type) = |
|||
if isFunctionType ty then |
|||
ty, ty.GetGenericArguments() |
|||
else |
|||
match ty.BaseType with |
|||
| null -> failwith "destFunTy: not a function type" |
|||
| b -> destFunTy b |
|||
|
|||
let instanceInvokeFlags = BindingFlags.Public ||| BindingFlags.InvokeMethod ||| BindingFlags.Instance |
|||
let invokeFunctionValue (f:obj) (x:obj) = |
|||
let fTy,_ = destFunTy (f.GetType()) |
|||
#if FX_NO_CULTURE_INFO_ARGS |
|||
fTy.InvokeMember("Invoke",instanceInvokeFlags,(null:Binder),f,[| x |]) |
|||
#else |
|||
fTy.InvokeMember("Invoke",instanceInvokeFlags,(null:Binder),f,[| x |],CultureInfo.InvariantCulture(*FxCop:1304*)) |
|||
#endif |
|||
|
|||
let buildFunctionForOneArgPat (ty: System.Type) impl = |
|||
let _,tys = destFunTy ty |
|||
let dty = tys.[0] |
|||
let rty = tys.[1] |
|||
// PERF: this technique is a bit slow (e.g. in simple cases, like 'sprintf "%x"') |
|||
mkFunctionValue tys (fun inp -> impl rty inp) |
|||
|
|||
let buildFunctionForTwoArgPat args ty i go = |
|||
let _,tys1 = destFunTy ty |
|||
let rty1 = tys1.[1] |
|||
let _,tys2 = destFunTy rty1 |
|||
let rty2 = tys2.[1] |
|||
mkFunctionValue tys1 (fun inpf -> |
|||
mkFunctionValue tys2 (fun inpx -> |
|||
go (inpx::inpf::args) rty2 (i+1))) |
|||
|
|||
let buildFunctionForOneFunArgPat args ty i go = |
|||
let _,tys1 = destFunTy ty |
|||
let rty1 = tys1.[1] |
|||
mkFunctionValue tys1 (fun inpf -> go (inpf::args) rty1 (i+1)) |
|||
|
|||
let isDigit c = ('0' <= c && c <= '9') |
|||
let rec parseFlags info (fmt:string) i = |
|||
if i >= fmt.Length then failwith "missing format specifier"; |
|||
match fmt.[i] with |
|||
| '-' -> info.leftJustify <- true; parseFlags info fmt (i+1) |
|||
| '+' -> info.numPrefixIfPos <- Some '+'; parseFlags info fmt (i+1) |
|||
| '0' -> info.addZeros <- true; parseFlags info fmt (i+1) |
|||
| ' ' -> info.numPrefixIfPos <- Some ' '; parseFlags info fmt (i+1) |
|||
| '#' -> failwith "The # formatting modifier is invalid in F#"; |
|||
| _ -> i |
|||
|
|||
let rec parseDigitsPrecision (fmt:string) len i = |
|||
if i >= len then failwith "bad format specifier (precision)"; |
|||
match fmt.[i] with |
|||
| c when isDigit c -> parseDigitsPrecision fmt len (i+1) |
|||
| _ -> i |
|||
|
|||
let parsePrecision (fmt:string) len i = |
|||
if i >= len then failwith "bad format specifier (precision)"; |
|||
match fmt.[i] with |
|||
| c when isDigit c -> false,parseDigitsPrecision fmt len (i+1) |
|||
| '*' -> true,(i+1) |
|||
| _ -> false,i |
|||
|
|||
let rec parseSliceDotAndPrecision (fmt:string) len i = |
|||
match fmt.[i] with |
|||
| '.' -> |
|||
let w1 = i |
|||
let precisionArg,i = parsePrecision fmt len (i+1) |
|||
w1,Some (precisionArg,i),i |
|||
| _ -> i,None,i |
|||
|
|||
let rec parseSliceWidthAndPrecision (fmt:string) len i = |
|||
if i >= len then failwith "bad format specifier (width)"; |
|||
match fmt.[i] with |
|||
| c when isDigit c -> parseSliceWidthAndPrecision fmt len (i+1) |
|||
| '*' -> true,parseSliceDotAndPrecision fmt len (i+1) |
|||
| _ -> false,parseSliceDotAndPrecision fmt len i |
|||
|
|||
let invariantCulture = System.Globalization.CultureInfo.InvariantCulture |
|||
let parseWidthAndPrecision fmt len i = |
|||
let w0 = i |
|||
let widthArg,(w1,w2,i) = parseSliceWidthAndPrecision fmt len i |
|||
let width = |
|||
if (w0 = w1) then None |
|||
elif widthArg then Some(None) |
|||
else Some (Some(System.Int32.Parse (fmt.[w0..w1-1],invariantCulture)) ) |
|||
let precision = |
|||
match w2 with |
|||
| None -> None |
|||
| Some (precisionArg,w2') -> |
|||
if precisionArg then Some(None) |
|||
else Some (Some(System.Int32.Parse (fmt.[w1+1..w2'-1],invariantCulture)) ) |
|||
width,precision,i |
|||
|
|||
let newInfo ()= |
|||
{ leftJustify = false; |
|||
numPrefixIfPos = None; |
|||
addZeros = false; } |
|||
|
|||
let defaultInfo = newInfo() |
|||
|
|||
let formatString outputChar info width (s:string) isNum = |
|||
match s with |
|||
| null -> outputSpace(outputChar,width,0) |
|||
| _ -> |
|||
if not info.leftJustify then |
|||
if isNum && info.addZeros then outputZeros(outputChar,width,s.Length) |
|||
else outputSpace(outputChar,width,s.Length); |
|||
s |> String.iter outputChar; |
|||
if info.leftJustify then |
|||
if isNum && info.addZeros then outputZeros(outputChar,width,s.Length) |
|||
else outputSpace(outputChar,width,s.Length) |
|||
|
|||
let capture1 (fmt:string) i args ty (go : obj list -> System.Type -> int -> obj) : obj = |
|||
let info = newInfo() |
|||
let len = fmt.Length |
|||
let i = parseFlags info fmt i |
|||
let width,precision,i = parseWidthAndPrecision fmt len i |
|||
let intFormatChar = fmt.[i] |
|||
|
|||
let captureCoreArgs args ty = |
|||
match intFormatChar with |
|||
| '%' -> go args ty (i+1) |
|||
| 'd' | 'i' | 'o' | 'u' | 'x' | 'X' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 'l' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+2)) |
|||
| 'n' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+2)) |
|||
| 'L' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+2)) |
|||
|
|||
| 'U' -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' | 'o' | 'u' | 'x' | 'X' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 'l' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+2)) |
|||
| 'n' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+2)) |
|||
| 'L' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+2)) |
|||
| _ -> failwith "bad format specifier (after U)" |
|||
|
|||
| 'f' | 'F' | 'e' | 'E' | 'g' | 'G' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 'M' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 's' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 'c' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 'b' -> buildFunctionForOneArgPat ty (fun rty n -> go (n::args) rty (i+1)) |
|||
| 'O' -> buildFunctionForOneArgPat ty (fun rty xobj -> go (xobj::args) rty (i+1)) |
|||
| 'A' -> buildFunctionForOneArgPat ty (fun rty xobj -> go (xobj::args) rty (i+1)) |
|||
| 'a' -> buildFunctionForTwoArgPat args ty i go |
|||
| 't' -> buildFunctionForOneFunArgPat args ty i go |
|||
| _ -> failwith "bad format specifier" |
|||
let capturePrecisionArg args ty = |
|||
match precision with |
|||
| None | Some(Some _) -> captureCoreArgs args ty |
|||
| Some(None) -> buildFunctionForOneArgPat ty (fun rty n -> captureCoreArgs (n :: args) rty) |
|||
let captureWidthArg args ty = |
|||
match width with |
|||
| None | Some(Some _) -> capturePrecisionArg args ty |
|||
| Some(None) -> buildFunctionForOneArgPat ty (fun rty n -> capturePrecisionArg (n :: args) rty) |
|||
captureWidthArg args ty |
|||
|
|||
|
|||
let unboxAsInt64 (n:obj) = |
|||
match n with |
|||
| :? sbyte as x -> x |> int64 |
|||
| :? int16 as x -> x |> int64 |
|||
| :? int32 as x -> x |> int64 |
|||
| :? nativeint as x -> x |> int64 |
|||
| :? int64 as x -> x |
|||
| :? byte as x -> x |> uint64 |> int64 |
|||
| :? uint16 as x -> x |> uint64 |> int64 |
|||
| :? uint32 as x -> x |> uint64 |> int64 |
|||
| :? uint64 as x -> x |> int64 |
|||
| :? unativeint as x -> x |> uint64 |> int64 |
|||
| _ -> failwith "bad integer supplied to dynamic formatter" |
|||
|
|||
let unboxAsUInt64 (n:obj) = |
|||
let unsigned = |
|||
match n with |
|||
| :? sbyte as x -> x |> byte |> box |
|||
| :? int16 as x -> x |> uint16 |> box |
|||
| :? int32 as x -> x |> uint32 |> box |
|||
| :? int64 as x -> x |> uint64 |> box |
|||
| :? nativeint as x -> x |> unativeint |> box |
|||
| _ -> n |
|||
unboxAsInt64 unsigned |> uint64 |
|||
|
|||
let format_one (outa: 'c -> unit) (outputChar: char -> unit) (os : 'b) (fmt:string) i args : (int * obj list) = |
|||
let info = newInfo() |
|||
let len = fmt.Length |
|||
let i = parseFlags info fmt i |
|||
let width,precision,i = parseWidthAndPrecision fmt len i |
|||
let intFormatChar = fmt.[i] |
|||
|
|||
let width,args = |
|||
match width,args with |
|||
| None,args -> None,args |
|||
| Some(Some w),args -> Some w,args |
|||
| Some(None),n::args -> Some (unbox n), args |
|||
| _ -> failwith "expected a width argument" |
|||
|
|||
let precision,args = |
|||
match precision,args with |
|||
| None,args -> None,args |
|||
| Some(Some w),args -> Some w,args |
|||
| Some(None),n::args -> Some (unbox n), args |
|||
| _ -> failwith "expected a precision argument" |
|||
|
|||
match intFormatChar,args with |
|||
| '%',args -> |
|||
outputChar intFormatChar; i+1, args |
|||
| ('d' | 'i'),n::args -> |
|||
match n with |
|||
| (:? byte | :? uint16 | :? uint32 | :? uint64 | :? unativeint) -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
| _ -> |
|||
outputInt64(outputChar,intFormatChar,width,info,(unboxAsInt64 n)); |
|||
i+1,args |
|||
| ('o' | 'u' | 'x' | 'X'),n::args -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| ('l' | 'L'),n::args -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' -> |
|||
outputInt64(outputChar,intFormatChar,width,info,(unboxAsInt64 n)); |
|||
i+1,args |
|||
| 'o' | 'u' | 'x' | 'X' -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| _ -> failwith "bad format specifier (after n)" |
|||
| 'n',n::args -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' -> |
|||
outputInt64(outputChar,intFormatChar,width,info,(unboxAsInt64 n)); |
|||
i+1,args |
|||
| 'o' | 'u' | 'x' | 'X' -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| _ -> failwith "bad format specifier (after l)" |
|||
| 'U',n::args -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' | 'o' | 'u' | 'x' | 'X' -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| 'l' -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' | 'o' | 'u' | 'x' | 'X' -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| _ -> failwith "bad format specifier (after Ul)" |
|||
| 'n' -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' | 'o' | 'u' | 'x' | 'X' -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| _ -> failwith "bad format specifier (after Un)" |
|||
| 'L' -> |
|||
let i = i+1 |
|||
let intFormatChar = fmt.[i] |
|||
match intFormatChar with |
|||
| 'd' | 'i' | 'o' | 'u' | 'x' | 'X' -> |
|||
outputUInt64(outputChar,intFormatChar,width,info,(unboxAsUInt64 n)); |
|||
i+1,args |
|||
| _ -> failwith "bad format specifier (after UL)" |
|||
| _ -> failwith "bad format specifier (after U)" |
|||
|
|||
| ('f' | 'F' | 'e' | 'E' | 'g' | 'G'),n::args -> |
|||
let s, number, positive = |
|||
match n with |
|||
| :? float as f -> f.ToString(string_of_char intFormatChar + (match precision with None -> "6" | Some n -> string_of_int (max (min n 99) 0)),invariantCulture), not (f = infinity || f = -infinity || System.Double.IsNaN f), f >= 0. |
|||
| :? float32 as f -> f.ToString(string_of_char intFormatChar + (match precision with None -> "6" | Some n -> string_of_int (max (min n 99) 0)),invariantCulture), not (f = infinityf || f = -infinityf || System.Single.IsNaN f), f >= 0.f |
|||
| :? decimal as f -> f.ToString(string_of_char intFormatChar + (match precision with None -> "6" | Some n -> string_of_int (max (min n 99) 0)),invariantCulture), true, f >= 0M |
|||
| _ -> failwith "bad float value" |
|||
|
|||
let s = match info.numPrefixIfPos with Some c when positive -> string_of_char c + s | _ -> s |
|||
formatString outputChar info width s number; |
|||
i+1,args |
|||
| 'M',n::args -> |
|||
let d = (unbox n : System.Decimal) |
|||
let s = d.ToString("G",invariantCulture) |
|||
let s = match info.numPrefixIfPos with Some c when d >= 0M -> string_of_char c + s | _ -> s |
|||
formatString outputChar info width s true; |
|||
i+1,args |
|||
| 's',nobj::args -> formatString outputChar info width (unbox nobj) false; i+1,args |
|||
| 'c',nobj::args -> outputChar (unbox nobj); i+1,args |
|||
| 'b',nobj::args -> formatString outputChar info width (if (unbox nobj) then "true" else "false") false; i+1,args |
|||
| 'O',xobj::args -> formatString outputChar info width (match xobj with null -> "<null>" | _ -> xobj.ToString()) false; i+1,args |
|||
| 'A',xobj::args -> |
|||
let bindingFlags = |
|||
match info.numPrefixIfPos with |
|||
| None -> BindingFlags.Public // Default see Public only |
|||
| Some '+' -> BindingFlags.Public ||| BindingFlags.NonPublic // %+A, sees anything possible |
|||
| Some c -> failwith ("internal: %A has an unexpected numeric prefix '" ^ string c ^ "'") |
|||
let opts = FormatOptions.Default |
|||
let opts = match width with None -> opts | Some w -> { opts with PrintWidth = w } |
|||
// printfn %0A is considered to mean 'print width zero' |
|||
let opts = if info.addZeros then { opts with PrintWidth = 0 } else opts |
|||
|
|||
let opts = match precision with None -> opts | Some w -> { opts with PrintSize = w } |
|||
let txt = |
|||
match xobj with |
|||
| null -> "<null>" |
|||
| _ -> |
|||
Display.printf_any_to_string opts bindingFlags xobj |
|||
|
|||
txt |> String.iter outputChar; |
|||
i+1,args |
|||
| 'a',fobj::xobj::args -> |
|||
outa (unbox (invokeFunctionValue (invokeFunctionValue fobj (box os)) xobj)); |
|||
i+1,args |
|||
| 't',f::args -> outa ((unbox f) os); i+1,args |
|||
| _ -> failwith "bad format specifier" |
|||
|
|||
|
|||
let gprintf (initialize : unit -> 'b * ('c -> unit) * (char -> unit) * (unit -> 'd)) (fmt : PrintfFormat<'a,'b,'c,'d>) : 'a = |
|||
let fmt = fmt.Value |
|||
match fmt with |
|||
// optimize some common cases |
|||
| "%s" -> unbox (box (fun (s:string) -> let os,outa,outputChar,finalize = initialize() in formatString outputChar defaultInfo None s false; finalize())) |
|||
// | "%x" -> unbox (box (fun (n:int) -> let os,outa,outputChar,finalize = initialize() in outputUInt64 outputChar 'x' None defaultInfo (int32_to_uint64 n); finalize())) |
|||
// | "%d" -> unbox (box (fun (n:int) -> let os,outa,outputChar,finalize = initialize() in outputInt64 outputChar 'd' None defaultInfo (int32_to_int64 n); finalize())) |
|||
| _ -> |
|||
let len = fmt.Length |
|||
|
|||
/// After all arguments are captures we reinterpret and execute the actions |
|||
let run args = |
|||
let os,outa,outputChar,finalize = initialize() |
|||
let rec go args i = |
|||
if i >= len || (fmt.[i] = '%' && i+1 >= len) then (box (finalize())) |
|||
elif System.Char.IsSurrogatePair(fmt,i) then |
|||
outputChar fmt.[i]; |
|||
outputChar fmt.[i+1]; |
|||
go args (i+2) |
|||
else |
|||
|
|||
match fmt.[i] with |
|||
| '%' -> |
|||
let i,args = format_one outa outputChar os fmt (i+1) args |
|||
go args i |
|||
| c -> |
|||
outputChar c; go args (i+1) |
|||
go args 0 |
|||
|
|||
/// Function to capture the arguments and then run. |
|||
let rec capture args ty i = |
|||
if i >= len || (fmt.[i] = '%' && i+1 >= len) then |
|||
run (List.rev args) |
|||
elif System.Char.IsSurrogatePair(fmt,i) then |
|||
capture args ty (i+2) |
|||
else |
|||
match fmt.[i] with |
|||
| '%' -> |
|||
let i = i+1 |
|||
capture1 fmt i args ty capture |
|||
| c -> |
|||
capture args ty (i+1) |
|||
|
|||
(unbox (capture [] (typeof<'a>) 0) : 'a) |
|||
|
|||
module Printf = |
|||
|
|||
open System.Text |
|||
open System.Diagnostics |
|||
open PrintfImpl |
|||
|
|||
// These indicate the final type returned |
|||
type BuilderFormat<'a,'d> = Format<'a, StringBuilder, unit, 'd> |
|||
type StringFormat<'a,'d> = Format<'a, unit, string, 'd> |
|||
type TextWriterFormat<'a,'d> = Format<'a, TextWriter, unit, 'd> |
|||
|
|||
// These fix the final type returned |
|||
type BuilderFormat<'a> = BuilderFormat<'a,unit> |
|||
type StringFormat<'a> = StringFormat<'a,string> |
|||
type TextWriterFormat<'a> = TextWriterFormat<'a,unit> |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let ksprintf (f : string -> 'd) (fp : StringFormat<'a,'d>) = |
|||
let init () = |
|||
let buf = new StringBuilder() |
|||
let outputChar (c:char) = ignore (buf.Append(c)) |
|||
let outa (s:string) = ignore (buf.Append(s)) |
|||
let finish () = f (buf.ToString()) |
|||
(),outa,outputChar,finish |
|||
PrintfImpl.gprintf init fp |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let kprintf f fmt = ksprintf f fmt |
|||
|
|||
let kprintf_imperative f handle outputChar fmt = |
|||
let init () = |
|||
let outa () = () |
|||
handle,outa,outputChar,f |
|||
PrintfImpl.gprintf init fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let kbprintf f (buf: StringBuilder) fmt = kprintf_imperative f buf (fun c -> ignore (buf.Append(c))) fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let ktwprintf f os fmt = kprintf_imperative f (os :> TextWriter) (fun c -> ignore (os.Write(c))) fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let kfprintf f (os:TextWriter) fmt = ktwprintf f os fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let sprintf fmt = ksprintf (fun x -> x) fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let failwithf fmt = ksprintf failwith fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let bprintf buf fmt = kbprintf (fun _ -> ()) buf fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fprintf (os: TextWriter) fmt = kfprintf (fun _ -> ()) os fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fprintfn (os: TextWriter) fmt = kfprintf (fun _ -> os.WriteLine()) os fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let twprintf os fmt = ktwprintf (fun _ -> ()) os fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let twprintfn (os : TextWriter) fmt = ktwprintf (fun _ -> os.WriteLine()) os fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let printf fmt = fprintf System.Console.Out fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let eprintf fmt = fprintf System.Console.Error fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let printfn fmt = fprintfn System.Console.Out fmt |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let eprintfn fmt = fprintfn System.Console.Error fmt |
|||
|
|||
// FxCop suppressions (pending) |
|||
do() |
|||
@ -1,220 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// This namespace contains types and modules for generating and formatting text with F# |
|||
namespace Microsoft.FSharp.Text |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open System.IO |
|||
open System.Text |
|||
|
|||
/// Type of a formatting expression. |
|||
/// 'Printer : function type generated by printf |
|||
/// 'State: type argument passed to %a formatters |
|||
/// 'Residue: value generated by the overall printf action (e.g. sprint generates a string) |
|||
/// 'Result: value generated after post processing (e.g. failwithf generates a string internally then raises an exception) |
|||
type PrintfFormat<'Printer,'State,'Residue,'Result> = |
|||
/// Construct a format string |
|||
new : value:string -> PrintfFormat<'Printer,'State,'Residue,'Result> |
|||
/// The raw text of the format string |
|||
member Value : string |
|||
|
|||
/// Type of a formatting expression. |
|||
/// 'Printer : function type generated by printf |
|||
/// 'State: type argument passed to %a formatters |
|||
/// 'Residue: value generated by the overall printf action (e.g. sprint generates a string) |
|||
/// 'Result: value generated after post processing (e.g. failwithf generates a string internally then raises an exception) |
|||
/// 'Tuple: tuple of values generated by scan or match |
|||
type PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> = |
|||
inherit PrintfFormat<'Printer,'State,'Residue,'Result> |
|||
/// Construct a format string |
|||
new: value:string -> PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> |
|||
|
|||
/// Type of a formatting expression |
|||
/// 'Printer : function type generated by printf |
|||
/// 'State: type argument passed to %a formatters |
|||
/// 'Residue: value generated by the overall printf action (e.g. sprint generates a string) |
|||
/// 'Result: value generated after post processing (e.g. failwithf generates a string internally then raises an exception) |
|||
type Format<'Printer,'State,'Residue,'Result> = PrintfFormat<'Printer,'State,'Residue,'Result> |
|||
|
|||
/// Type of a formatting expression |
|||
/// 'Printer : function type generated by printf |
|||
/// 'State: type argument passed to %a formatters |
|||
/// 'Residue: value generated by the overall printf action (e.g. sprint generates a string) |
|||
/// 'Result: value generated after post processing (e.g. failwithf generates a string internally then raises an exception) |
|||
/// 'Tuple: tuple of values generated by scan or match |
|||
type Format<'Printer,'State,'Residue,'Result,'Tuple> = PrintfFormat<'Printer,'State,'Residue,'Result,'Tuple> |
|||
|
|||
/// Extensible printf-style formatting for numbers and other datatypes |
|||
/// |
|||
/// Format specifications are strings with "%" markers indicating format |
|||
/// placeholders. Format placeholders consist of: |
|||
/// <c> |
|||
/// %[flags][width][.precision][type] |
|||
/// </c> |
|||
/// where the type is interpreted as follows: |
|||
/// <c> |
|||
/// %b: bool, formatted as "true" or "false" |
|||
/// %s: string, formatted as its unescaped contents |
|||
/// %d, %i: any basic integer type formatted as a decimal integer, signed if the basic integer type is signed. |
|||
/// %u: any basic integer type formatted as an unsigned decimal integer |
|||
/// %x, %X, %o: any basic integer type formatted as an unsigned hexadecimal |
|||
/// (a-f)/Hexadecimal (A-F)/Octal integer |
|||
/// |
|||
/// %e, %E, %f, %F, %g, %G: |
|||
/// any basic floating point type (float,float32) formatted |
|||
/// using a C-style floating point format specifications, i.e |
|||
/// |
|||
/// %e, %E: Signed value having the form [-]d.dddde[sign]ddd where |
|||
/// d is a single decimal digit, dddd is one or more decimal |
|||
/// digits, ddd is exactly three decimal digits, and sign |
|||
/// is + or - |
|||
/// |
|||
/// %f: Signed value having the form [-]dddd.dddd, where dddd is one |
|||
/// or more decimal digits. The number of digits before the |
|||
/// decimal point depends on the magnitude of the number, and |
|||
/// the number of digits after the decimal point depends on |
|||
/// the requested precision. |
|||
/// |
|||
/// %g, %G: Signed value printed in f or e format, whichever is |
|||
/// more compact for the given value and precision. |
|||
/// |
|||
/// |
|||
/// %M: System.Decimal value |
|||
/// |
|||
/// %O: Any value, printed by boxing the object and using it's ToString method(s) |
|||
/// |
|||
/// %A: Any value, printed by using Microsoft.FSharp.Text.StructuredPrintfImpl.Display.any_to_string with the default layout settings |
|||
/// |
|||
/// %a: A general format specifier, requires two arguments: |
|||
/// (1) a function which accepts two arguments: |
|||
/// (a) a context parameter of the appropriate type for the |
|||
/// given formatting function (e.g. an #System.IO.TextWriter) |
|||
/// (b) a value to print |
|||
/// and which either outputs or returns appropriate text. |
|||
/// |
|||
/// (2) the particular value to print |
|||
/// |
|||
/// |
|||
/// %t: A general format specifier, requires one argument: |
|||
/// (1) a function which accepts a context parameter of the |
|||
/// appropriate type for the given formatting function (e.g. |
|||
/// an System.IO.TextWriter)and which either outputs or returns |
|||
/// appropriate text. |
|||
/// |
|||
/// Basic integer types are: |
|||
/// byte,sbyte,int16,uint16,int32,uint32,int64,uint64,nativeint,unativeint |
|||
/// Basic floating point types are: |
|||
/// float, float32 |
|||
/// |
|||
/// The following format patterns are accepted but a warning is printed: |
|||
/// |
|||
/// %h(d|u|x|X|o) |
|||
/// %l(d|u|x|X|o) |
|||
/// |
|||
/// The following format patterns are now deprecated: |
|||
/// |
|||
/// %Ld, %Li, %Lu, %Lx, %LX, %Lo: same, but an int64 |
|||
/// %nd, %ni, %nu, %nx, %nX, %no: same, but a nativeint |
|||
/// %Ud, %Ui, %Uu, %Ux, %UX, %Uo: same, but an unsigned int32 (uint32) |
|||
/// %ULd, %ULi, %ULu, %ULx, %ULX, %ULo: same, but an unsigned int64 (uint64) |
|||
/// %Und, %Uni, %Unu, %Unx, %UnX, %Uno: same, but an unsigned nativeint (unativeint) |
|||
/// </c> |
|||
/// The optional width is an integer indicating the minimal width of the |
|||
/// result. For instance, %6d prints an integer, prefixing it with spaces |
|||
/// to fill at least 6 characters. If width is '*', then an extra integer |
|||
/// argument is taken to specify the corresponding width. |
|||
/// <c> |
|||
/// any number |
|||
/// '*': |
|||
/// </c> |
|||
/// Valid flags are: |
|||
/// <c> |
|||
/// 0: add zeros instead of spaces to make up the required width |
|||
/// '-': left justify the result within the width specified |
|||
/// '+': add a '+' character if the number is positive (to match a '-' sign |
|||
/// for negatives) |
|||
/// ' ': add an extra space if the number is positive (to match a '-' |
|||
/// sign for negatives) |
|||
/// </c> |
|||
/// The printf '#' flag is invalid and a compile-time error will be reported if it is used. |
|||
module Printf = |
|||
|
|||
/// Represents a statically-analyzed format associated with writing to a <c>System.Text.StringBuilder</c>. The first type parameter indicates the |
|||
/// arguments of the format operation and the last the overall return type. |
|||
type BuilderFormat<'T,'Result> = Format<'T, StringBuilder, unit, 'Result> |
|||
/// Represents a statically-analyzed format when formatting builds a string. The first type parameter indicates the |
|||
/// arguments of the format operation and the last the overall return type. |
|||
type StringFormat<'T,'Result> = Format<'T, unit, string, 'Result> |
|||
/// Represents a statically-analyzed format associated with writing to a <c>System.IO.TextWriter</c>. The first type parameter indicates the |
|||
/// arguments of the format operation and the last the overall return type. |
|||
type TextWriterFormat<'T,'Result> = Format<'T, TextWriter, unit, 'Result> |
|||
|
|||
/// Represents a statically-analyzed format associated with writing to a <c>System.Text.StringBuilder</c>. The type parameter indicates the |
|||
/// arguments and return type of the format operation. |
|||
type BuilderFormat<'T> = BuilderFormat<'T,unit> |
|||
/// Represents a statically-analyzed format when formatting builds a string. The type parameter indicates the |
|||
/// arguments and return type of the format operation. |
|||
type StringFormat<'T> = StringFormat<'T,string> |
|||
/// Represents a statically-analyzed format associated with writing to a <c>System.IO.TextWriter</c>. The type parameter indicates the |
|||
/// arguments and return type of the format operation. |
|||
type TextWriterFormat<'T> = TextWriterFormat<'T,unit> |
|||
|
|||
/// Print to a <c>System.Text.StringBuilder</c> |
|||
val bprintf : builder:StringBuilder -> format:BuilderFormat<'T> -> 'T |
|||
|
|||
/// Print to a text writer or an OCaml-compatible channel |
|||
val fprintf : textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Print to a text writer or an OCaml-compatible channel, adding a newline |
|||
val fprintfn : textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Print to any subtype of the .NET type System.IO.TextWriter |
|||
val twprintf : textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Print to any subtype of the .NET type System.IO.TextWriter, and add a newline |
|||
val twprintfn : textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Formatted printing to stderr |
|||
val eprintf : format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Formatted printing to stderr, adding a newline |
|||
val eprintfn : format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Formatted printing to stdout |
|||
val printf : format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Formatted printing to stdout, adding a newline |
|||
val printfn : format:TextWriterFormat<'T> -> 'T |
|||
|
|||
/// Print to a string via an internal string buffer and return |
|||
/// the result as a string. Helper printers must return strings. |
|||
val sprintf : format:StringFormat<'T> -> 'T |
|||
|
|||
/// bprintf, but call the given 'final' function to generate the result. |
|||
/// See <c>kprintf</c>. |
|||
val kbprintf : continutation:(unit -> 'Result) -> builder:StringBuilder -> format:BuilderFormat<'T,'Result> -> 'T |
|||
|
|||
/// fprintf, but call the given 'final' function to generate the result. |
|||
/// See <c>kprintf</c>. |
|||
val kfprintf : continutation:(unit -> 'Result) -> textWriter:TextWriter -> format:TextWriterFormat<'T,'Result> -> 'T |
|||
|
|||
/// printf, but call the given 'final' function to generate the result. |
|||
/// For example, these let the printing force a flush after all output has |
|||
/// been entered onto the channel, but not before. |
|||
val kprintf : continutation:(string -> 'Result) -> format:StringFormat<'T,'Result> -> 'T |
|||
|
|||
/// twprintf, but call the given 'final' function to generate the result. |
|||
/// See <c>kprintf</c>. |
|||
val ktwprintf : continutation:(unit -> 'Result) -> textWriter:TextWriter -> format:TextWriterFormat<'T,'Result> -> 'T |
|||
|
|||
/// sprintf, but call the given 'final' function to generate the result. |
|||
/// See <c>kprintf</c>. |
|||
val ksprintf : continutation:(string -> 'Result) -> format:StringFormat<'T,'Result> -> 'T |
|||
|
|||
/// Print to a string buffer and raise an exception with the given |
|||
/// result. Helper printers must return strings. |
|||
val failwithf: format:StringFormat<'T,'Result> -> 'T |
|||
|
|||
File diff suppressed because it is too large
@ -1,350 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// Types and functions related to expression quotations |
|||
namespace Microsoft.FSharp.Quotations |
|||
|
|||
#if FX_MINIMAL_REFLECTION // not on Compact Framework |
|||
#else |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Reflection |
|||
open System |
|||
open System.Reflection |
|||
|
|||
[<Sealed>] |
|||
/// Information at the binding site of a variable |
|||
type Var = |
|||
/// The type associated with the variable |
|||
member Type : Type |
|||
/// The declared name of the variable |
|||
member Name : string |
|||
/// Indicates if the variable represents a mutable storage location |
|||
member IsMutable: bool |
|||
/// Create a new variable with the given name, type and mutability |
|||
new : name:string * typ:Type * ?isMutable : bool -> Var |
|||
/// Fetch or create a new variable with the given name and type from a global pool of shared variables |
|||
/// indexed by name and type |
|||
static member Global : name:string * typ:Type -> Var |
|||
|
|||
interface System.IComparable |
|||
|
|||
/// Quoted expressions annotated with System.Type values. |
|||
[<Class>] |
|||
type Expr = |
|||
|
|||
/// Substitute through the given expression using the given functions |
|||
/// to map variables to new values. The functions must give consistent results |
|||
/// at each application. Variable renaming may occur on the target expression |
|||
/// if variable capture occurs. |
|||
member Substitute : substitution:(Var -> Expr option) -> Expr |
|||
|
|||
/// Get the free expression variables of an expression as a list |
|||
member GetFreeVars : unit -> seq<Var> |
|||
|
|||
/// Returns type of an expression |
|||
member Type : Type |
|||
|
|||
/// Returns the custom attributes of an expression |
|||
member CustomAttributes : Expr list |
|||
|
|||
override Equals : obj:obj -> bool |
|||
|
|||
/// Build an expression that represents getting the address of a value |
|||
static member AddressOf : target:Expr -> Expr |
|||
|
|||
/// Build an expression that represents setting the value held at a particular address |
|||
static member AddressSet : target:Expr * value:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the application of a first class function value to a single argument |
|||
static member Application: functionExpr:Expr * argument:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the application of a first class function value to multiple arguments |
|||
static member Applications: functionExpr:Expr * arguments:list<list<Expr>> -> Expr |
|||
|
|||
/// Build an expression that represents a call to an static method or module-bound function |
|||
static member Call : methodInfo:MethodInfo * arguments:list<Expr> -> Expr |
|||
|
|||
/// Build an expression that represents a call to an instance method associated with an object |
|||
static member Call : obj:Expr * methodInfo:MethodInfo * arguments:list<Expr> -> Expr |
|||
|
|||
/// Build an expression that represents the coercion of an expression to a type |
|||
static member Coerce : source:Expr * target:Type -> Expr |
|||
|
|||
/// Build 'if ... then ... else' expressions |
|||
static member IfThenElse : guard:Expr * thenExpr:Expr * elseExpr:Expr -> Expr |
|||
|
|||
/// Build a 'for i = ... to ... do ...' expression that represent loops over integer ranges |
|||
static member ForIntegerRangeLoop: loopVariable:Var * start:Expr * endExpr:Expr * body:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the access of a static field |
|||
static member FieldGet: fieldInfo:FieldInfo -> Expr |
|||
|
|||
/// Build an expression that represents the access of a field of an object |
|||
static member FieldGet: obj:Expr * fieldInfo:FieldInfo -> Expr |
|||
|
|||
/// Build an expression that represents writing to a static field |
|||
static member FieldSet: fieldInfo:FieldInfo * value:Expr -> Expr |
|||
|
|||
/// Build an expression that represents writing to a field of an object |
|||
static member FieldSet: obj:Expr * fieldInfo:FieldInfo * value:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the constrution of an F# function value |
|||
static member Lambda : parameter:Var * body:Expr -> Expr |
|||
|
|||
/// Build expressions associated with 'let' constructs |
|||
static member Let : letVariable:Var * letExpr:Expr * body:Expr -> Expr |
|||
|
|||
/// Build recursives expressions associated with 'let rec' constructs |
|||
static member LetRec : bindings:(Var * Expr) list * body:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the invocation of an object constructor |
|||
static member NewObject: constructorInfo:ConstructorInfo * arguments:Expr list -> Expr |
|||
|
|||
|
|||
/// Build an expression that represents the invocation of a default object constructor |
|||
static member DefaultValue: expressionType:Type -> Expr |
|||
|
|||
|
|||
/// Build an expression that represents the creation of an F# tuple value |
|||
static member NewTuple: elements:Expr list -> Expr |
|||
|
|||
/// Build record-construction expressions |
|||
static member NewRecord: recordType:Type * elements:Expr list -> Expr |
|||
|
|||
/// Build an expression that represents the creation of an array value initialized with the given elements |
|||
static member NewArray: elementType:Type * elements:Expr list -> Expr |
|||
|
|||
/// Build an expression that represents the creation of a delegate value for the given type |
|||
static member NewDelegate: delegateType:Type * parameters:Var list * body:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the creation of a union case value |
|||
static member NewUnionCase: unionCase:UnionCaseInfo * arguments:Expr list -> Expr |
|||
|
|||
/// Build an expression that represents reading a property of an object |
|||
static member PropGet: obj:Expr * property:PropertyInfo * ?indexerArgs: Expr list -> Expr |
|||
|
|||
/// Build an expression that represents reading a static property |
|||
static member PropGet: property:PropertyInfo * ?indexerArgs: Expr list -> Expr |
|||
|
|||
/// Build an expression that represents writing to a property of an object |
|||
static member PropSet: obj:Expr * property:PropertyInfo * value:Expr * ?indexerArgs: Expr list -> Expr |
|||
|
|||
/// Build an expression that represents writing to a static property |
|||
static member PropSet: property:PropertyInfo * value:Expr * ?indexerArgs: Expr list -> Expr |
|||
|
|||
/// Build an expression that represents a nested quotation literal |
|||
static member Quote: inner:Expr -> Expr |
|||
|
|||
/// Build an expression that represents the sequential execution of one expression followed by another |
|||
static member Sequential: first:Expr * second:Expr -> Expr |
|||
|
|||
/// Build an expression that represents a try/with construct for exception filtering and catching |
|||
static member TryWith: body:Expr * filterVar:Var * filterBody:Expr * catchVar:Var * catchBody:Expr -> Expr |
|||
|
|||
/// Build an expression that represents a try/finally construct |
|||
static member TryFinally: body:Expr * compensation:Expr -> Expr |
|||
|
|||
/// Build an expression that represents getting a field of a tuple |
|||
static member TupleGet: tuple:Expr * index:int -> Expr |
|||
|
|||
|
|||
/// Build an expression that represents a type test |
|||
static member TypeTest: source:Expr * target:Type -> Expr |
|||
|
|||
/// Build an expression that represents a test of a value is of a particular union case |
|||
static member UnionCaseTest: source:Expr * unionCase:UnionCaseInfo -> Expr |
|||
|
|||
/// Build an expression that represents a constant value of a particular type |
|||
static member Value : value:obj * expressionType:Type -> Expr |
|||
|
|||
/// Build an expression that represents a constant value |
|||
static member Value : value:'T -> Expr |
|||
|
|||
/// Build an expression that represents a variable |
|||
static member Var : variable:Var -> Expr |
|||
|
|||
/// Build an expression that represents setting a mutable variable |
|||
static member VarSet : variable:Var * value:Expr -> Expr |
|||
|
|||
/// Build an expression that represents a while loop |
|||
static member WhileLoop : guard:Expr * body:Expr -> Expr |
|||
|
|||
//---------------- |
|||
|
|||
|
|||
/// Return a new typed expression given an underlying runtime-typed expression. |
|||
/// A type annotation is usually required to use this function, and |
|||
/// using an incorrect type annotation may result in a later runtime exception. |
|||
static member Cast : source:Expr -> Expr<'T> |
|||
|
|||
/// Try and find a stored reflection definition for the given method. Stored reflection |
|||
/// definitions are added to an F# assembly through the use of the [<ReflectedDefinition>] attribute. |
|||
static member TryGetReflectedDefinition : methodBase:MethodBase -> Expr option |
|||
|
|||
/// This function is called automatically when quotation syntax (<@ @>) and related typed-expression |
|||
/// quotations are used. The bytes are a pickled binary representation of an unlinked form of the qutoed expression, |
|||
/// and the System.Type argument is any type in the assembly where the quoted |
|||
/// expression occurs, i.e. it helps scope the interpretation of the cross-assembly |
|||
/// references in the bytes. |
|||
static member Deserialize : qualifyingType:System.Type * spliceTypes:list<System.Type> * spliceExprs:list<Expr> * value:byte[] -> Expr |
|||
|
|||
/// Permit interactive environments such as F# Interactive |
|||
/// to explicitly register new pickled resources that represent persisted |
|||
/// top level definitions. The string indicates a unique name for the resources |
|||
/// being added. The format for the bytes is the encoding generated by the F# compiler. |
|||
static member RegisterReflectedDefinitions: assembly:Assembly * resource:string * serializedValue:byte[] -> unit |
|||
|
|||
/// Fetch or create a new variable with the given name and type from a global pool of shared variables |
|||
/// indexed by name and type. The type is given by the expicit or inferred type parameter |
|||
static member GlobalVar<'T> : name:string -> Expr<'T> |
|||
|
|||
|
|||
/// Type-carrying quoted expressions. Expressions are generated either |
|||
/// by quotations in source text or programatically |
|||
and |
|||
[<Class>] |
|||
Expr<'T> = |
|||
inherit Expr |
|||
/// Get the raw expression associated with this type-carrying expression |
|||
member Raw : Expr |
|||
|
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
/// Contains a set of primitive F# active patterns to analyze F# expression objects |
|||
module Patterns = |
|||
|
|||
/// An active pattern to recognize expressions that represent getting the address of a value |
|||
val (|AddressOf|_|) : input:Expr -> Expr option |
|||
/// An active pattern to recognize expressions that represent setting the value held at an address |
|||
val (|AddressSet|_|) : input:Expr -> (Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent applications of first class function values |
|||
val (|Application|_|) : input:Expr -> (Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent calls to static and instance methods, and functions defined in modules |
|||
val (|Call|_|) : input:Expr -> (Expr option * MethodInfo * Expr list) option |
|||
/// An active pattern to recognize expressions that represent coercions from one type to another |
|||
val (|Coerce|_|) : input:Expr -> (Expr * Type) option |
|||
/// An active pattern to recognize expressions that represent getting a static or instance field |
|||
val (|FieldGet|_|) : input:Expr -> (Expr option * FieldInfo) option |
|||
/// An active pattern to recognize expressions that represent setting a static or instance field |
|||
val (|FieldSet|_|) : input:Expr -> (Expr option * FieldInfo * Expr) option |
|||
/// An active pattern to recognize expressions that represent loops over integer ranges |
|||
val (|ForIntegerRangeLoop|_|) : input:Expr -> (Var * Expr * Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent while loops |
|||
val (|WhileLoop|_|) : input:Expr -> (Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent conditionals |
|||
val (|IfThenElse|_|) : input:Expr -> (Expr * Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent first class function values |
|||
val (|Lambda|_|) : input:Expr -> (Var * Expr) option |
|||
/// An active pattern to recognize expressions that represent let bindings |
|||
val (|Let|_|) : input:Expr -> (Var * Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent recursive let bindings of one or more variables |
|||
val (|LetRec|_|) : input:Expr -> ((Var * Expr) list * Expr) option |
|||
/// An active pattern to recognize expressions that represent the construction of arrays |
|||
val (|NewArray|_|) : input:Expr -> (Type * Expr list) option |
|||
/// An active pattern to recognize expressions that represent invocations of a default constructor of a struct |
|||
val (|DefaultValue|_|) : input:Expr -> Type option |
|||
/// An active pattern to recognize expressions that represent construction of delegate values |
|||
val (|NewDelegate|_|) : input:Expr -> (Type * Var list * Expr) option |
|||
/// An active pattern to recognize expressions that represent invocation of object constructors |
|||
val (|NewObject|_|) : input:Expr -> (ConstructorInfo * Expr list) option |
|||
/// An active pattern to recognize expressions that represent construction of record values |
|||
val (|NewRecord|_|) : input:Expr -> (Type * Expr list) option |
|||
/// An active pattern to recognize expressions that represent construction of particular union case values |
|||
val (|NewUnionCase|_|) : input:Expr -> (UnionCaseInfo * Expr list) option |
|||
/// An active pattern to recognize expressions that represent construction of tuple values |
|||
val (|NewTuple|_|) : input:Expr -> (Expr list) option |
|||
/// An active pattern to recognize expressions that represent the read of a static or instance property, or a non-function value declared in a module |
|||
val (|PropGet|_|) : input:Expr -> (Expr option * PropertyInfo * Expr list) option |
|||
/// An active pattern to recognize expressions that represent setting a static or instance property, or a non-function value declared in a module |
|||
val (|PropSet|_|) : input:Expr -> (Expr option * PropertyInfo * Expr list * Expr) option |
|||
/// An active pattern to recognize expressions that represent a nested quotation literal |
|||
val (|Quote|_|) : input:Expr -> Expr option |
|||
/// An active pattern to recognize expressions that represent sequential exeuction of one expression followed by another |
|||
val (|Sequential|_|) : input:Expr -> (Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent a try/with construct for exception filtering and catching |
|||
val (|TryWith|_|) : input:Expr -> (Expr * Var * Expr * Var * Expr) option |
|||
/// An active pattern to recognize expressions that represent a try/finally construct |
|||
val (|TryFinally|_|) : input:Expr -> (Expr * Expr) option |
|||
/// An active pattern to recognize expressions that represent getting a tuple field |
|||
val (|TupleGet|_|) : input:Expr -> (Expr * int) option |
|||
/// An active pattern to recognize expressions that represent a dynamic type test |
|||
val (|TypeTest|_|) : input:Expr -> (Expr * Type) option |
|||
/// An active pattern to recognize expressions that represent a test if a value is of a particular union case |
|||
val (|UnionCaseTest|_|) : input:Expr -> (Expr * UnionCaseInfo) option |
|||
/// An active pattern to recognize expressions that represent a constant value |
|||
val (|Value|_|) : input:Expr -> (obj * Type) option |
|||
/// An active pattern to recognize expressions that represent a variable |
|||
val (|Var|_|) : input:Expr -> Var option |
|||
/// An active pattern to recognize expressions that represent setting a mutable variable |
|||
val (|VarSet|_|) : input:Expr -> (Var * Expr) option |
|||
|
|||
//---------------------------------------------------------------- |
|||
// Helpers |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
/// Contains a set of derived F# active patterns to analyze F# expression objects |
|||
module DerivedPatterns = |
|||
//val (|NewList|_|) : input:Expr -> Expr list option |
|||
/// An active pattern to recognize expressions that represent a (possibly curried or tupled) first class function value |
|||
val (|Lambdas|_|) : input:Expr -> (Var list list * Expr) option |
|||
/// An active pattern to recognize expressions that represent the application of a (possibly curried or tupled) first class function value |
|||
val (|Applications|_|) : input:Expr -> (Expr * Expr list list) option |
|||
/// An active pattern to recognize expressions of the form <c>a && b</c> |
|||
val (|AndAlso|_|) : input:Expr -> (Expr * Expr) option |
|||
/// An active pattern to recognize expressions of the form <c>a || b</c> |
|||
val (|OrElse|_|) : input:Expr -> (Expr * Expr) option |
|||
|
|||
/// An active pattern to recognize <c>()</c> constant expressions |
|||
val (|Unit|_|) : input:Expr -> unit option |
|||
/// An active pattern to recognize constant boolean expressions |
|||
val (|Bool|_|) : input:Expr -> bool option |
|||
/// An active pattern to recognize constant string expressions |
|||
val (|String|_|) : input:Expr -> string option |
|||
/// An active pattern to recognize constant 32-bit floating point number expressions |
|||
val (|Single|_|) : input:Expr -> float32 option |
|||
/// An active pattern to recognize constant 64-bit floating point number expressions |
|||
val (|Double|_|) : input:Expr -> float option |
|||
/// An active pattern to recognize constant unicode character expressions |
|||
val (|Char|_|) : input:Expr -> char option |
|||
/// An active pattern to recognize constant signed byte expressions |
|||
val (|SByte|_|) : input:Expr -> sbyte option |
|||
/// An active pattern to recognize constant byte expressions |
|||
val (|Byte|_|) : input:Expr -> byte option |
|||
/// An active pattern to recognize constant int16 expressions |
|||
val (|Int16|_|) : input:Expr -> int16 option |
|||
/// An active pattern to recognize constant unsigned int16 expressions |
|||
val (|UInt16|_|) : input:Expr -> uint16 option |
|||
/// An active pattern to recognize constant int32 expressions |
|||
val (|Int32|_|) : input:Expr -> int32 option |
|||
/// An active pattern to recognize constant unsigned int32 expressions |
|||
val (|UInt32|_|) : input:Expr -> uint32 option |
|||
/// An active pattern to recognize constant int64 expressions |
|||
val (|Int64|_|) : input:Expr -> int64 option |
|||
/// An active pattern to recognize constant unsigned int64 expressions |
|||
val (|UInt64|_|) : input:Expr -> uint64 option |
|||
/// A parameterized active pattern to recognize calls to a specified function or method |
|||
val (|SpecificCall|_|) : templateParameter:Expr -> (Expr -> (list<Type> * list<Expr>) option) |
|||
|
|||
/// An active pattern to recognize methods that have an associated ReflectedDefinition |
|||
val (|MethodWithReflectedDefinition|_|) : methodBase:MethodBase -> Expr option |
|||
|
|||
/// An active pattern to recognize property getters or values in modules that have an associated ReflectedDefinition |
|||
val (|PropertyGetterWithReflectedDefinition|_|) : propertyInfo:PropertyInfo -> Expr option |
|||
/// An active pattern to recognize property setters that have an associated ReflectedDefinition |
|||
val (|PropertySetterWithReflectedDefinition|_|) : propertyInfo:PropertyInfo -> Expr option |
|||
|
|||
/// Active patterns for traversing, visiting, rebuilding and tranforming expressions in a generic way |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
module ExprShape = |
|||
/// An active pattern that performs a complete decomposition viewing the expression tree as a binding structure |
|||
val (|ShapeVar|ShapeLambda|ShapeCombination|) : |
|||
input:Expr -> Choice<Var, // Var |
|||
(Var * Expr), // Lambda |
|||
(obj * list<Expr>)> // ConstApp |
|||
/// Re-build combination expressions. The first parameter should be an object |
|||
/// returned by the <c>ShapeCombination</c> case of the active pattern in this module. |
|||
val RebuildShapeCombination : shape:obj * arguments:list<Expr> -> Expr |
|||
|
|||
#endif |
|||
@ -1,709 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
// |
|||
// Reflection on F# values. Analyze an object to see if it the representation |
|||
// of an F# value. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Reflection |
|||
|
|||
open System |
|||
open System.Globalization |
|||
open System.Reflection |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
module internal Impl = |
|||
|
|||
let debug = false |
|||
|
|||
let inline checkNonNull argName (v: 'T) = |
|||
match box v with |
|||
| null -> nullArg argName |
|||
| _ -> () |
|||
|
|||
let emptyArray arr = (Array.length arr = 0) |
|||
let nonEmptyArray arr = Array.length arr > 0 |
|||
|
|||
let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer) |
|||
|
|||
let equivHeadTypes (ty1:Type) (ty2:Type) = |
|||
isNamedType(ty1) && |
|||
if ty1.IsGenericType then |
|||
ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition()) |
|||
else |
|||
ty1.Equals(ty2) |
|||
|
|||
let option = typedefof<obj option> |
|||
let func = typedefof<(obj -> obj)> |
|||
|
|||
let isOptionType typ = equivHeadTypes typ (typeof<int option>) |
|||
let isFunctionType typ = equivHeadTypes typ (typeof<(int -> int)>) |
|||
let isUnitType typ = equivHeadTypes typ (typeof<unit>) |
|||
let isListType typ = equivHeadTypes typ (typeof<int list>) |
|||
|
|||
let tuple1 = typedefof<Tuple<obj>> |
|||
let tuple2 = typedefof<obj * obj> |
|||
let tuple3 = typedefof<obj * obj * obj> |
|||
let tuple4 = typedefof<obj * obj * obj * obj> |
|||
let tuple5 = typedefof<obj * obj * obj * obj * obj> |
|||
let tuple6 = typedefof<obj * obj * obj * obj * obj * obj> |
|||
let tuple7 = typedefof<obj * obj * obj * obj * obj * obj * obj> |
|||
let tuple8 = typedefof<obj * obj * obj * obj * obj * obj * obj * obj> |
|||
|
|||
let isTuple1Type typ = equivHeadTypes typ tuple1 |
|||
let isTuple2Type typ = equivHeadTypes typ tuple2 |
|||
let isTuple3Type typ = equivHeadTypes typ tuple3 |
|||
let isTuple4Type typ = equivHeadTypes typ tuple4 |
|||
let isTuple5Type typ = equivHeadTypes typ tuple5 |
|||
let isTuple6Type typ = equivHeadTypes typ tuple6 |
|||
let isTuple7Type typ = equivHeadTypes typ tuple7 |
|||
let isTuple8Type typ = equivHeadTypes typ tuple8 |
|||
|
|||
let isTupleType typ = |
|||
isTuple1Type typ |
|||
|| isTuple2Type typ |
|||
|| isTuple3Type typ |
|||
|| isTuple4Type typ |
|||
|| isTuple5Type typ |
|||
|| isTuple6Type typ |
|||
|| isTuple7Type typ |
|||
|| isTuple8Type typ |
|||
|
|||
let maxTuple = 8 |
|||
// Which field holds the nested tuple? |
|||
let tupleEncField = maxTuple-1 |
|||
|
|||
let rec mkTupleType (tys: Type[]) = |
|||
match tys.Length with |
|||
| 1 -> tuple1.MakeGenericType(tys) |
|||
| 2 -> tuple2.MakeGenericType(tys) |
|||
| 3 -> tuple3.MakeGenericType(tys) |
|||
| 4 -> tuple4.MakeGenericType(tys) |
|||
| 5 -> tuple5.MakeGenericType(tys) |
|||
| 6 -> tuple6.MakeGenericType(tys) |
|||
| 7 -> tuple7.MakeGenericType(tys) |
|||
| n when n >= maxTuple -> |
|||
let tysA = tys.[0..tupleEncField-1] |
|||
let tysB = tys.[maxTuple-1..] |
|||
let tyB = mkTupleType tysB |
|||
tuple8.MakeGenericType(Array.append tysA [| tyB |]) |
|||
| _ -> invalidArg "tys" "this is not a valid tuple type for the F# reflection library" |
|||
|
|||
let instancePropertyFlags = BindingFlags.GetProperty ||| BindingFlags.Instance |
|||
let staticGetFieldFlags = BindingFlags.GetField ||| BindingFlags.Static |
|||
let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly |
|||
|
|||
let getPropertyInfo (typ: Type,propName,bindingFlags) = typ.GetProperty(propName,instancePropertyFlags ||| bindingFlags) |
|||
let getPropertyInfos (typ,names,bindingFlags) = names |> Array.map (fun nm -> getPropertyInfo (typ,nm,bindingFlags)) |
|||
|
|||
let tryFindMemberCompilationMappingAttribute (info: MemberInfo) = |
|||
match info.GetCustomAttributes (typeof<CompilationMappingAttribute>, false) with |
|||
| null | [| |] -> None |
|||
| res -> Some (res.[0] :?> CompilationMappingAttribute) |
|||
|
|||
let findMemberCompilationMappingAttribute (info: MemberInfo) = |
|||
match info.GetCustomAttributes (typeof<CompilationMappingAttribute>, false) with |
|||
| null | [| |] -> failwith "the member did not have a compilation mapping attribute" |
|||
| res -> (res.[0] :?> CompilationMappingAttribute) |
|||
|
|||
let sequenceNumberOfMember (x: MemberInfo) = (findMemberCompilationMappingAttribute x).SequenceNumber |
|||
let variantNumberOfMember (x: MemberInfo) = (findMemberCompilationMappingAttribute x).VariantNumber |
|||
|
|||
let sortFreshArray f arr = Array.sortInPlaceWith f arr; arr |
|||
|
|||
let isFieldProperty (prop : PropertyInfo) = |
|||
match tryFindMemberCompilationMappingAttribute(prop) with |
|||
| None -> false |
|||
| Some attr -> (attr.SourceConstructFlags &&& SourceConstructFlags.KindMask) = SourceConstructFlags.Field |
|||
|
|||
let fieldsPropsOfUnionCase((typ:Type), (tag:int),bindingFlags) = |
|||
if isOptionType typ then |
|||
match tag with |
|||
| 0 (* None *) -> getPropertyInfos (typ,[| |],bindingFlags) |
|||
| 1 (* Some *) -> getPropertyInfos (typ,[| "Value" |] ,bindingFlags) |
|||
| _ -> failwith "fieldsPropsOfUnionCase" |
|||
elif isListType typ then |
|||
match tag with |
|||
| 0 (* Nil *) -> getPropertyInfos (typ,[| |],bindingFlags) |
|||
| 1 (* Cons *) -> getPropertyInfos (typ,[| "Head"; "Tail" |],bindingFlags) |
|||
| _ -> failwith "fieldsPropsOfUnionCase" |
|||
else |
|||
typ.GetProperties(instancePropertyFlags ||| bindingFlags) |
|||
|> Array.filter isFieldProperty |
|||
|> Array.filter (fun prop -> variantNumberOfMember prop = tag) |
|||
|> sortFreshArray (fun p1 p2 -> compare (sequenceNumberOfMember p1) (sequenceNumberOfMember p2)) |
|||
|
|||
let emptyObjArray : obj[] = [| |] |
|||
|
|||
let callStaticMethod (typ:Type,name,args,bindingFlags) = |
|||
#if FX_NO_CULTURE_INFO_ARGS |
|||
typ.InvokeMember(name, BindingFlags.Static ||| BindingFlags.InvokeMethod ||| bindingFlags, null, null,args) |
|||
#else |
|||
typ.InvokeMember(name, BindingFlags.Static ||| BindingFlags.InvokeMethod ||| bindingFlags, null, null,args,CultureInfo.InvariantCulture(*FxCop:1304*)) |
|||
#endif |
|||
|
|||
let tryFindCompilationMappingAttribute (typ:Type) = |
|||
match typ.GetCustomAttributes (typeof<CompilationMappingAttribute>, false) with |
|||
| null | [| |] -> None |
|||
| res -> Some(res.[0] :?> CompilationMappingAttribute) |
|||
|
|||
let tryFindSourceConstructFlagsOfType (typ:Type) = |
|||
match tryFindCompilationMappingAttribute typ with |
|||
| None -> None |
|||
| Some attr -> Some attr.SourceConstructFlags |
|||
|
|||
let rec getTupleTypeInfo (typ:Type) = |
|||
if not (isTupleType (typ) ) then invalidArg "typ" "the type is not a tuple type"; |
|||
let tyargs = typ.GetGenericArguments() |
|||
if tyargs.Length = maxTuple then |
|||
let tysA = tyargs.[0..tupleEncField-1] |
|||
let tyB = tyargs.[tupleEncField] |
|||
Array.append tysA (getTupleTypeInfo tyB) |
|||
else |
|||
tyargs |
|||
|
|||
|
|||
let getFunctionTypeInfo (typ:Type) = |
|||
if not (isFunctionType typ) then invalidArg "typ" "not a function type" |
|||
let tyargs = typ.GetGenericArguments() |
|||
tyargs.[0], tyargs.[1] |
|||
|
|||
let isUnionType (typ:Type,bindingFlags:BindingFlags) = |
|||
isOptionType typ || |
|||
isListType typ || |
|||
match tryFindSourceConstructFlagsOfType(typ) with |
|||
| None -> false |
|||
| Some(flags) -> |
|||
(flags &&& SourceConstructFlags.KindMask) = SourceConstructFlags.SumType && |
|||
// We see private representations only if BindingFlags.NonPublic is set |
|||
(if (flags &&& SourceConstructFlags.NonpublicRepresentation) <> enum(0) then |
|||
(bindingFlags &&& BindingFlags.NonPublic) <> enum(0) |
|||
else |
|||
true) |
|||
|
|||
let isRecordType (typ:Type,bindingFlags:BindingFlags) = |
|||
match tryFindSourceConstructFlagsOfType(typ) with |
|||
| None -> false |
|||
| Some(flags) -> |
|||
(flags &&& SourceConstructFlags.KindMask) = SourceConstructFlags.RecordType && |
|||
// We see private representations only if BindingFlags.NonPublic is set |
|||
(if (flags &&& SourceConstructFlags.NonpublicRepresentation) <> enum(0) then |
|||
(bindingFlags &&& BindingFlags.NonPublic) <> enum(0) |
|||
else |
|||
true) && |
|||
not (isTupleType typ) |
|||
|
|||
let isModuleType (typ:Type) = |
|||
match tryFindSourceConstructFlagsOfType(typ) with |
|||
| None -> false |
|||
| Some(flags) -> |
|||
(flags &&& SourceConstructFlags.KindMask) = SourceConstructFlags.Module |
|||
|
|||
let fieldPropsOfRecordType(typ:Type,bindingFlags) = |
|||
typ.GetProperties(instancePropertyFlags ||| bindingFlags) |
|||
|> Array.filter isFieldProperty |
|||
|> sortFreshArray (fun p1 p2 -> compare (sequenceNumberOfMember p1) (sequenceNumberOfMember p2)) |
|||
|
|||
let rec isClosureRepr typ = |
|||
isFunctionType typ || |
|||
(match typ.BaseType with null -> false | bty -> isClosureRepr bty) |
|||
|
|||
let isFSharpObjectType typ = |
|||
match tryFindSourceConstructFlagsOfType(typ) with |
|||
| None -> false |
|||
| Some(flags) -> |
|||
(flags &&& SourceConstructFlags.KindMask) = SourceConstructFlags.ObjectType |
|||
|
|||
let discriminatorNameFromSumConstructor (m:MethodInfo) = |
|||
let nm = m.Name |
|||
if (m.GetParameters()).Length = 0 then |
|||
if nm.Substring(0,4) = "get_" then nm.Substring(4) else nm |
|||
else |
|||
nm |
|||
|
|||
|
|||
let getUnionTypeTagFields (typ:Type,bindingFlags) = |
|||
typ.GetFields(staticGetFieldFlags ||| bindingFlags) |
|||
|> Array.filter (fun (f:FieldInfo) -> f.Name.Length > 4 && f.Name.Substring(0,4) = "tag_") |
|||
|
|||
|> sortFreshArray (fun f1 f2 -> compare (f1.GetValue(null) :?> int) (f1.GetValue(null) :?> int)) |
|||
|
|||
// Check the base type - if it is also an F# type then |
|||
// for the moment we know it is a Discriminated Union |
|||
let isConstructorRepr (typ:Type,bindingFlags:BindingFlags) = |
|||
let rec get (typ:Type) = isUnionType (typ,bindingFlags) || match typ.BaseType with null -> false | b -> get b |
|||
get typ |
|||
|
|||
let unionTypeOfUnionCaseType (typ:Type,bindingFlags) = |
|||
let rec get (typ:Type) = if isUnionType (typ,bindingFlags) then typ else match typ.BaseType with null -> typ | b -> get b |
|||
get typ |
|||
|
|||
// Check the base type - if it is also an F# type then |
|||
// for the moment we know it is a Discriminated Union |
|||
let isExceptionRepr (typ:Type,bindingFlags) = |
|||
match tryFindSourceConstructFlagsOfType(typ) with |
|||
| None -> false |
|||
| Some(flags) -> |
|||
((flags &&& SourceConstructFlags.KindMask) = SourceConstructFlags.Exception) && |
|||
// We see private representations only if BindingFlags.NonPublic is set |
|||
(if (flags &&& SourceConstructFlags.NonpublicRepresentation) <> enum(0) then |
|||
(bindingFlags &&& BindingFlags.NonPublic) <> enum(0) |
|||
else |
|||
true) |
|||
|
|||
let recdDescOfProps props = |
|||
props |> Array.to_list |> List.map (fun (p:PropertyInfo) -> p.Name, p.PropertyType) |
|||
|
|||
let getRecd obj (props:PropertyInfo[]) = |
|||
props |> Array.map (fun prop -> prop.GetValue(obj,null)) |
|||
|
|||
let getRecordReader(typ:Type,bindingFlags) = |
|||
let props = fieldPropsOfRecordType(typ,bindingFlags) |
|||
(fun (obj:obj) -> props |> Array.map (fun prop -> prop.GetValue(obj,null))) |
|||
|
|||
let getRecordConstructorMethod(typ:Type,bindingFlags) = |
|||
let props = fieldPropsOfRecordType(typ,bindingFlags) |
|||
let ctor = typ.GetConstructor(BindingFlags.Instance ||| bindingFlags,null,props |> Array.map (fun p -> p.PropertyType),null) |
|||
checkNonNull "typ" ctor; |
|||
ctor |
|||
|
|||
let getRecordConstructor(typ:Type,bindingFlags) = |
|||
let ctor = getRecordConstructorMethod(typ,bindingFlags) |
|||
(fun (args:obj[]) -> |
|||
ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| bindingFlags,null,args,null)) |
|||
|
|||
let getTupleConstructorMethod(typ:Type,bindingFlags) = |
|||
#if FX_ATLEAST_40 |
|||
let props = typ.GetProperties() |
|||
#else |
|||
let props = typ.GetProperties() |> Array.rev |
|||
#endif |
|||
let ctor = typ.GetConstructor(BindingFlags.Instance ||| bindingFlags,null,props |> Array.map (fun p -> p.PropertyType),null) |
|||
checkNonNull "typ" ctor; |
|||
ctor |
|||
|
|||
let getTupleCtor(typ:Type,bindingFlags) = |
|||
let ctor = getTupleConstructorMethod(typ,bindingFlags) |
|||
(fun (args:obj[]) -> |
|||
ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| bindingFlags,null,args,null)) |
|||
|
|||
let getPropertyReader (typ: Type,propName,bindingFlags) = |
|||
match getPropertyInfo(typ,propName,bindingFlags) with |
|||
| null -> None |
|||
| prop -> Some(fun (obj:obj) -> prop.GetValue(obj,instancePropertyFlags ||| bindingFlags,null,null,null)) |
|||
|
|||
let getRecordFieldReader (typ,propName,bindingFlags) = |
|||
match getPropertyReader (typ,propName,bindingFlags) with |
|||
| None -> failwith "getRecordFieldReader" |
|||
| Some reader -> reader |
|||
|
|||
let rec getTupleReader (typ:Type) = |
|||
let etys = typ.GetGenericArguments() |
|||
// Get the reader for the outer tuple record |
|||
#if FX_ATLEAST_40 |
|||
let props = typ.GetProperties(instancePropertyFlags ||| BindingFlags.Public) |
|||
#else |
|||
let props = typ.GetProperties(instancePropertyFlags ||| BindingFlags.Public) |> Array.rev |
|||
#endif |
|||
let reader = (fun (obj:obj) -> props |> Array.map (fun prop -> prop.GetValue(obj,null))) |
|||
if etys.Length < maxTuple |
|||
then reader |
|||
else |
|||
let tyBenc = etys.[tupleEncField] |
|||
let reader2 = getTupleReader(tyBenc) |
|||
(fun obj -> |
|||
let directVals = reader obj |
|||
let encVals = reader2 directVals.[tupleEncField] |
|||
Array.append directVals.[0..tupleEncField-1] encVals) |
|||
|
|||
let rec getTupleConstructor (typ:Type) = |
|||
let etys = typ.GetGenericArguments() |
|||
let maker1 = getTupleCtor (typ,BindingFlags.Public) |
|||
if etys.Length < maxTuple |
|||
then maker1 |
|||
else |
|||
let tyBenc = etys.[tupleEncField] |
|||
let maker2 = getTupleConstructor(tyBenc) |
|||
(fun (args:obj[]) -> |
|||
let encVal = maker2 args.[tupleEncField..] |
|||
maker1 (Array.append args.[0..tupleEncField-1] [| encVal |])) |
|||
|
|||
let getTupleConstructorInfo (typ:Type) = |
|||
let etys = typ.GetGenericArguments() |
|||
let maker1 = getTupleConstructorMethod (typ,BindingFlags.Public) |
|||
if etys.Length < maxTuple then |
|||
maker1,None |
|||
else |
|||
maker1,Some(etys.[tupleEncField]) |
|||
|
|||
let getTupleReaderInfo (typ:Type,index:int) = |
|||
|
|||
if index < 0 then invalidArg "index" "the tuple index was out of range" |
|||
#if FX_ATLEAST_40 |
|||
let props = typ.GetProperties(instancePropertyFlags ||| BindingFlags.Public) |
|||
#else |
|||
let props = typ.GetProperties(instancePropertyFlags ||| BindingFlags.Public) |> Array.rev |
|||
#endif |
|||
let get index = |
|||
if index >= props.Length then invalidArg "index" "the tuple index was out of range" |
|||
props.[index] |
|||
|
|||
if index < tupleEncField then |
|||
get index, None |
|||
else |
|||
let etys = typ.GetGenericArguments() |
|||
get tupleEncField, Some(etys.[tupleEncField],index-(maxTuple-1)) |
|||
|
|||
let getUnionCaseRecordReader (typ:Type,tag:int,bindingFlags) = |
|||
let props = fieldsPropsOfUnionCase(typ,tag,bindingFlags) |
|||
(fun (obj:obj) -> props |> Array.map (fun prop -> prop.GetValue(obj,bindingFlags,null,null,null))) |
|||
|
|||
let getUnionTagReader (typ:Type,bindingFlags) = |
|||
if isOptionType typ then (function null -> 0 | _ -> 1) |
|||
else |
|||
let tagreader = |
|||
match getPropertyReader (typ,"Tag",bindingFlags) with |
|||
| Some reader -> reader |
|||
| None -> (fun obj -> callStaticMethod(typ,"GetTag",[|obj|],bindingFlags)) |
|||
(fun obj -> (tagreader obj :?> int)) |
|||
|
|||
let getUnionTagMemberInfo (typ:Type,bindingFlags) = |
|||
match getPropertyInfo (typ,"Tag",bindingFlags) with |
|||
| null -> (typ.GetMethod("GetTag",BindingFlags.Static ||| bindingFlags) :> MemberInfo) |
|||
| info -> (info :> MemberInfo) |
|||
|
|||
let getUnionTypeTagNameMap (typ:Type,bindingFlags) = |
|||
getUnionTypeTagFields(typ,bindingFlags) |
|||
|> Array.map (fun tagfield -> |
|||
let constrname = tagfield.Name.Substring(4,tagfield.Name.Length - 4) |
|||
(tagfield.GetValue(null) :?> int),constrname) |
|||
|
|||
let getUnionTagConverter (typ:Type,bindingFlags) = |
|||
if isOptionType typ then (fun tag -> match tag with 0 -> "None" | 1 -> "Some" | _ -> invalidArg "tag" "tag out of range") |
|||
elif isListType typ then (fun tag -> match tag with 0 -> "Empty" | 1 -> "Cons" | _ -> invalidArg "tag" "tag out of range") |
|||
else |
|||
let tagfieldmap = getUnionTypeTagNameMap(typ,bindingFlags) |> Map.of_seq |
|||
(fun tag -> tagfieldmap.[tag]) |
|||
|
|||
let swap (x,y) = (y,x) |
|||
|
|||
let getUnionTagConverters (typ:Type,bindingFlags) = |
|||
let tagfields = getUnionTypeTagNameMap(typ,bindingFlags) |
|||
let tagfieldmap1 = tagfields |> Map.of_seq |
|||
let tagfieldmap2 = tagfields |> Array.map swap |> Map.of_seq |
|||
tagfields.Length, (fun tag -> tagfieldmap1.[tag]), (fun tag -> tagfieldmap2.[tag]) |
|||
|
|||
let getUnionCaseConstructorMethod (typ:Type,tag:int,bindingFlags) = |
|||
let props = fieldsPropsOfUnionCase(typ,tag,bindingFlags) |
|||
let constrname = getUnionTagConverter (typ,bindingFlags) tag |
|||
let methname = if emptyArray props then "get_"+constrname else constrname |
|||
match typ.GetMethod(methname, BindingFlags.Static ||| bindingFlags) with |
|||
| null -> failwith ("the constructor method '" + methname + "' for the union case could not be found") |
|||
| meth -> meth |
|||
|
|||
let getUnionCaseConstructor (typ:Type,tag:int,bindingFlags) = |
|||
let meth = getUnionCaseConstructorMethod (typ,tag,bindingFlags) |
|||
(fun args -> |
|||
meth.Invoke(null,BindingFlags.Static ||| BindingFlags.InvokeMethod ||| bindingFlags,null,args,null)) |
|||
|
|||
let getTypeOfReprType (typ:Type,bindingFlags) = |
|||
if isExceptionRepr(typ,bindingFlags) then typ.BaseType |
|||
elif isConstructorRepr(typ,bindingFlags) then unionTypeOfUnionCaseType(typ,bindingFlags) |
|||
elif isClosureRepr(typ) then |
|||
let rec get (typ:Type) = if isFunctionType typ then typ else match typ.BaseType with null -> typ | b -> get b |
|||
get typ |
|||
else typ |
|||
|
|||
|
|||
let ensureType (typ:Type,obj:obj,bindingFlags) = |
|||
match typ with |
|||
| null -> |
|||
match obj with |
|||
| null -> invalidArg "obj" "the object is null and no type was given" |
|||
| _ -> obj.GetType() |
|||
| _ -> typ |
|||
|
|||
|
|||
let checkUnionType(unionType,bindingFlags) = |
|||
checkNonNull "unionType" unionType; |
|||
if not (isUnionType (unionType,bindingFlags)) then |
|||
if isUnionType (unionType,bindingFlags ||| BindingFlags.NonPublic) then |
|||
invalidArg "unionType" "The type is a union type but its representation is private. You must specify BindingFlags.NonPublic to access private type representations" |
|||
else |
|||
invalidArg "unionType" "The type is not a union type" |
|||
|
|||
let checkExnType(exceptionType,bindingFlags) = |
|||
if not (isExceptionRepr (exceptionType,bindingFlags)) then |
|||
if isExceptionRepr (exceptionType,bindingFlags ||| BindingFlags.NonPublic) then |
|||
invalidArg "exceptionType" "The type is the representation of an F# exception declaration but its representation is private. You must specify BindingFlags.NonPublic to access private type representations" |
|||
else |
|||
invalidArg "exceptionType" "The type is not the representation of an F# exception declaration" |
|||
|
|||
|
|||
// inline lets FxCop check that argument names match those given |
|||
let checkRecordType(argName,recordType,bindingFlags) = |
|||
checkNonNull "recordType" recordType; |
|||
if not (isRecordType (recordType,bindingFlags) ) then |
|||
if isRecordType (recordType,bindingFlags ||| BindingFlags.NonPublic) then |
|||
invalidArg "recordType" "The type is a record type but its representation is private. You must specify BindingFlags.NonPublic to access private type representations" |
|||
else |
|||
invalidArg "recordType" "The type is not a record type" |
|||
|
|||
let checkTupleType(argName,tupleType) = |
|||
checkNonNull argName tupleType; |
|||
if not (isTupleType tupleType) then invalidArg argName "the type is not a tuple type" |
|||
|
|||
[<Sealed>] |
|||
type UnionCaseInfo(typ: System.Type, tag:int) = |
|||
// Cache the tag -> name map |
|||
let mutable names = None |
|||
member x.Name = |
|||
match names with |
|||
| None -> (let conv = Impl.getUnionTagConverter (typ,BindingFlags.Public ||| BindingFlags.NonPublic) in names <- Some(conv); conv tag) |
|||
| Some(conv) -> conv tag |
|||
|
|||
member x.DeclaringType = typ |
|||
//member x.CustomAttributes = failwith<obj[]> "nyi" |
|||
member x.GetFields() = Impl.fieldsPropsOfUnionCase(typ,tag,BindingFlags.Public ||| BindingFlags.NonPublic) |
|||
|
|||
member x.GetCustomAttributes() = |
|||
let methInfo = Impl.getUnionCaseConstructorMethod (typ,tag,BindingFlags.Public ||| BindingFlags.NonPublic) |
|||
methInfo.GetCustomAttributes(false) |
|||
|
|||
member x.GetCustomAttributes(attributeType) = |
|||
let methInfo = Impl.getUnionCaseConstructorMethod (typ,tag,BindingFlags.Public ||| BindingFlags.NonPublic) |
|||
methInfo.GetCustomAttributes(attributeType,false) |
|||
|
|||
member x.Tag = tag |
|||
override x.ToString() = typ.Name + "." + x.Name |
|||
override x.GetHashCode() = typ.GetHashCode() + tag |
|||
override x.Equals(obj:obj) = |
|||
match obj with |
|||
| :? UnionCaseInfo as uci -> uci.DeclaringType = typ && uci.Tag = tag |
|||
| _ -> false |
|||
|
|||
|
|||
[<AbstractClass; Sealed>] |
|||
type FSharpType = |
|||
|
|||
static member IsTuple(typ:Type) = |
|||
Impl.checkNonNull "typ" typ; |
|||
Impl.isTupleType typ |
|||
|
|||
static member IsRecord(typ:Type,?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkNonNull "typ" typ; |
|||
Impl.isRecordType (typ,bindingFlags) |
|||
|
|||
static member IsUnion(typ:Type,?bindingFlags) = |
|||
Impl.checkNonNull "typ" typ; |
|||
let typ = Impl.getTypeOfReprType (typ ,BindingFlags.Public ||| BindingFlags.NonPublic) |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.isUnionType (typ,bindingFlags) |
|||
|
|||
static member IsFunction(typ:Type) = |
|||
Impl.checkNonNull "typ" typ; |
|||
let typ = Impl.getTypeOfReprType (typ ,BindingFlags.Public ||| BindingFlags.NonPublic) |
|||
Impl.isFunctionType typ |
|||
|
|||
static member IsModule(typ:Type) = |
|||
Impl.checkNonNull "typ" typ; |
|||
Impl.isModuleType typ |
|||
|
|||
static member MakeFunctionType(domain:Type,range:Type) = |
|||
Impl.checkNonNull "domain" domain; |
|||
Impl.checkNonNull "range" range; |
|||
Impl.func.MakeGenericType [| domain; range |] |
|||
|
|||
static member MakeTupleType(types:Type[]) = |
|||
Impl.checkNonNull "types" types; |
|||
if types |> Array.exists (function null -> true | _ -> false) then |
|||
invalidArg "types" "one of the types is null" |
|||
Impl.mkTupleType types |
|||
|
|||
static member GetTupleElements(tupleType:Type) = |
|||
Impl.checkTupleType("tupleType",tupleType); |
|||
Impl.getTupleTypeInfo tupleType |
|||
|
|||
static member GetFunctionElements(functionType:Type) = |
|||
Impl.checkNonNull "functionType" functionType; |
|||
let functionType = Impl.getTypeOfReprType (functionType ,BindingFlags.Public ||| BindingFlags.NonPublic) |
|||
Impl.getFunctionTypeInfo functionType |
|||
|
|||
static member GetRecordFields(recordType:Type,?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkRecordType("recordType",recordType,bindingFlags); |
|||
Impl.fieldPropsOfRecordType(recordType,bindingFlags) |
|||
|
|||
static member GetUnionCases (unionType:Type,?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
let unionType = Impl.getTypeOfReprType (unionType ,bindingFlags) |
|||
Impl.checkUnionType(unionType,bindingFlags); |
|||
Impl.getUnionTypeTagFields(unionType,bindingFlags) |> Array.mapi (fun i _ -> UnionCaseInfo(unionType,i)) |
|||
|
|||
static member IsExceptionRepresentation(typ:Type, ?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkNonNull "typ" typ; |
|||
Impl.isExceptionRepr(typ,bindingFlags) |
|||
|
|||
static member GetExceptionFields(exceptionType:Type, ?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkExnType(exceptionType,bindingFlags); |
|||
Impl.fieldPropsOfRecordType (exceptionType,bindingFlags) |
|||
|
|||
type DynamicFunction<'T1,'T2> = |
|||
static member Make(impl : obj -> obj) : obj = |
|||
box<('T1 -> 'T2)> (fun inp -> unbox<'T2>(impl (box<'T1>(inp)))) |
|||
|
|||
|
|||
[<AbstractClass; Sealed>] |
|||
type FSharpValue = |
|||
|
|||
static member MakeRecord(recordType:Type,args,?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkRecordType("recordType",recordType,bindingFlags); |
|||
Impl.getRecordConstructor (recordType,bindingFlags) args |
|||
|
|||
static member GetRecordField(record:obj,info:PropertyInfo) = |
|||
Impl.checkNonNull "info" info; |
|||
Impl.checkNonNull "record" record; |
|||
let reprty = record.GetType() |
|||
if not (Impl.isRecordType(reprty,BindingFlags.Public ||| BindingFlags.NonPublic)) then invalidArg "record" "the object is not an F# record value"; |
|||
info.GetValue(record,null) |
|||
|
|||
static member GetRecordFields(record:obj,?bindingFlags) = |
|||
Impl.checkNonNull "record" record; |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
let typ = record.GetType() |
|||
if not (Impl.isRecordType(typ,bindingFlags)) then invalidArg "record" "the object is not an F# record value"; |
|||
Impl.getRecordReader (typ,bindingFlags) record |
|||
|
|||
static member PreComputeRecordFieldReader(info:PropertyInfo) = |
|||
Impl.checkNonNull "info" info; |
|||
(fun (obj:obj) -> info.GetValue(obj,null)) |
|||
|
|||
static member PreComputeRecordReader(recordType:Type,?bindingFlags) : (obj -> obj[]) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkRecordType("recordType",recordType,bindingFlags); |
|||
Impl.getRecordReader (recordType,bindingFlags) |
|||
|
|||
static member PreComputeRecordConstructor(recordType:Type,?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkRecordType("recordType",recordType,bindingFlags); |
|||
Impl.getRecordConstructor (recordType,bindingFlags) |
|||
|
|||
static member PreComputeRecordConstructorInfo(recordType:Type, ?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkRecordType("recordType",recordType,bindingFlags); |
|||
Impl.getRecordConstructorMethod(recordType,bindingFlags) |
|||
|
|||
|
|||
static member MakeFunction(functionType:Type,implementation:(obj->obj)) = |
|||
Impl.checkNonNull "functionType" functionType; |
|||
if not (Impl.isFunctionType functionType) then invalidArg "functionType" "not a function type"; |
|||
Impl.checkNonNull "implementation" implementation; |
|||
let domain,range = Impl.getFunctionTypeInfo functionType |
|||
let dynCloMakerTy = typedefof<DynamicFunction<obj,obj>> |
|||
let saverTy = dynCloMakerTy.MakeGenericType [| domain; range |] |
|||
#if FX_NO_CULTURE_INFO_ARGS |
|||
saverTy.InvokeMember("Make",BindingFlags.Static ||| BindingFlags.InvokeMethod ||| BindingFlags.Public ||| BindingFlags.NonPublic,null,null,[| box implementation |]) |
|||
#else |
|||
saverTy.InvokeMember("Make",BindingFlags.Static ||| BindingFlags.InvokeMethod ||| BindingFlags.Public ||| BindingFlags.NonPublic,null,null,[| box implementation |],CultureInfo.InvariantCulture(*FxCop:1304*)) |
|||
#endif |
|||
|
|||
static member MakeTuple(tupleElements: obj[],tupleType:Type) = |
|||
Impl.checkNonNull "tupleElements" tupleElements; |
|||
Impl.checkTupleType("tupleType",tupleType) |
|||
Impl.getTupleConstructor tupleType tupleElements |
|||
|
|||
static member GetTupleFields(tuple:obj) = // argument name(s) used in error message |
|||
Impl.checkNonNull "tuple" tuple; |
|||
let typ = tuple.GetType() |
|||
if not (Impl.isTupleType typ ) then invalidArg "tuple" "the object is not a tuple"; |
|||
Impl.getTupleReader typ tuple |
|||
|
|||
static member GetTupleField(tuple:obj,index:int) = // argument name(s) used in error message |
|||
Impl.checkNonNull "tuple" tuple; |
|||
let typ = tuple.GetType() |
|||
if not (Impl.isTupleType typ ) then invalidArg "tuple" "the object is not a tuple"; |
|||
let fields = Impl.getTupleReader typ tuple |
|||
if index < 0 || index >= fields.Length then invalidArg "index" "tuple field index out of range"; |
|||
fields.[index] |
|||
|
|||
static member PreComputeTupleReader(tupleType:Type) : (obj -> obj[]) = |
|||
Impl.checkTupleType("tupleType",tupleType) |
|||
Impl.getTupleReader tupleType |
|||
|
|||
static member PreComputeTuplePropertyInfo(tupleType:Type,index:int) = |
|||
Impl.checkTupleType("tupleType",tupleType) |
|||
Impl.getTupleReaderInfo (tupleType,index) |
|||
|
|||
static member PreComputeTupleConstructor(tupleType:Type) = |
|||
Impl.checkTupleType("tupleType",tupleType) |
|||
Impl.getTupleConstructor tupleType |
|||
|
|||
static member PreComputeTupleConstructorInfo(tupleType:Type) = |
|||
Impl.checkTupleType("tupleType",tupleType) |
|||
Impl.getTupleConstructorInfo (tupleType) |
|||
|
|||
static member MakeUnion(unionCase:UnionCaseInfo,args: obj [],?bindingFlags) = |
|||
Impl.checkNonNull "unionCase" unionCase; |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.getUnionCaseConstructor (unionCase.DeclaringType,unionCase.Tag,bindingFlags) args |
|||
|
|||
static member PreComputeUnionConstructor (unionCase:UnionCaseInfo,?bindingFlags) = |
|||
Impl.checkNonNull "unionCase" unionCase; |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.getUnionCaseConstructor (unionCase.DeclaringType,unionCase.Tag,bindingFlags) |
|||
|
|||
static member PreComputeUnionConstructorInfo(unionCase:UnionCaseInfo, ?bindingFlags) = |
|||
Impl.checkNonNull "unionCase" unionCase; |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.getUnionCaseConstructorMethod (unionCase.DeclaringType,unionCase.Tag,bindingFlags) |
|||
|
|||
static member GetUnionFields(obj:obj,unionType:Type,?bindingFlags) = |
|||
//System.Console.WriteLine("typ1 = {0}",box unionType) |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
let unionType = Impl.ensureType(unionType,obj,bindingFlags) |
|||
//System.Console.WriteLine("typ2 = {0}",box unionType) |
|||
Impl.checkNonNull "unionType" unionType; |
|||
let unionType = Impl.getTypeOfReprType (unionType ,bindingFlags) |
|||
//System.Console.WriteLine("typ3 = {0}",box unionType) |
|||
Impl.checkUnionType(unionType,bindingFlags); |
|||
let tag = Impl.getUnionTagReader (unionType,bindingFlags) obj |
|||
let flds = Impl.getUnionCaseRecordReader (unionType,tag,bindingFlags) obj |
|||
UnionCaseInfo(unionType,tag), flds |
|||
|
|||
static member PreComputeUnionTagReader(unionType: Type,?bindingFlags) : (obj -> int) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkNonNull "unionType" unionType; |
|||
let unionType = Impl.getTypeOfReprType (unionType ,bindingFlags) |
|||
Impl.checkUnionType(unionType,bindingFlags); |
|||
Impl.getUnionTagReader (unionType ,bindingFlags) |
|||
|
|||
static member PreComputeUnionTagMemberInfo(unionType: Type,?bindingFlags) = |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
Impl.checkNonNull "unionType" unionType; |
|||
let unionType = Impl.getTypeOfReprType (unionType ,bindingFlags) |
|||
Impl.checkUnionType(unionType,bindingFlags); |
|||
Impl.getUnionTagMemberInfo(unionType ,bindingFlags) |
|||
|
|||
static member PreComputeUnionReader(unionCase: UnionCaseInfo,?bindingFlags) : (obj -> obj[]) = |
|||
Impl.checkNonNull "unionCase" unionCase; |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
let typ = unionCase.DeclaringType |
|||
Impl.getUnionCaseRecordReader (typ,unionCase.Tag,bindingFlags) |
|||
|
|||
|
|||
static member GetExceptionFields(exn:obj, ?bindingFlags) = |
|||
Impl.checkNonNull "exn" exn; |
|||
let bindingFlags = defaultArg bindingFlags BindingFlags.Public |
|||
let typ = exn.GetType() |
|||
Impl.checkExnType(typ,bindingFlags); |
|||
Impl.getRecordReader (typ,bindingFlags) exn |
|||
|
|||
|
|||
@ -1,223 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
/// This namespace contains constructs for reflecting on the representation of |
|||
/// F# values and types. It augments the design of System.Reflection. |
|||
namespace Microsoft.FSharp.Reflection |
|||
|
|||
open System |
|||
open System.Reflection |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
//--------------------------------------------------------------------- |
|||
// F# reified type inspection. |
|||
|
|||
///Represents a case of a discriminated union type |
|||
[<Sealed>] |
|||
type UnionCaseInfo = |
|||
/// The name of the case |
|||
member Name : string |
|||
/// The type in which the case occurs |
|||
member DeclaringType: Type |
|||
|
|||
/// Return the custom attributes associated with the case |
|||
member GetCustomAttributes: unit -> obj[] |
|||
/// Return the custom attributes associated with the case matching the given attribute type |
|||
member GetCustomAttributes: attributeType:System.Type -> obj[] |
|||
|
|||
/// The fields associated with the case, represented by PropertyInfo |
|||
member GetFields: unit -> PropertyInfo [] |
|||
|
|||
/// The integer tag for the case |
|||
member Tag: int |
|||
|
|||
|
|||
[<AbstractClass; Sealed>] |
|||
/// Contains operations associated with constructing and analyzing values associated with F# types such as records, unions and tuples |
|||
type FSharpValue = |
|||
|
|||
/// Create an instance of a record type |
|||
/// |
|||
/// Assumes the given input is a record type. If not, ArgumentException is raised. |
|||
static member MakeRecord: recordType:Type * values:obj [] * ?bindingFlags:BindingFlags -> obj |
|||
|
|||
/// Read a field from a record value |
|||
/// |
|||
/// Assumes the given input is a record value. If not, ArgumentException is raised. |
|||
static member GetRecordField: record:obj * info:PropertyInfo -> obj |
|||
|
|||
/// Read all the fields from a record value |
|||
/// |
|||
/// Assumes the given input is a record value. If not, ArgumentException is raised. |
|||
static member GetRecordFields: record:obj * ?bindingFlags:BindingFlags -> obj[] |
|||
|
|||
|
|||
/// Precompute a function for reading a particular field from a record. |
|||
/// Assumes the given type is a RecordType with a field of the given name. |
|||
/// If not, ArgumentException is raised during pre-computation. |
|||
/// |
|||
/// Using the computed function will typically be faster than executing a corresponding call to Value.GetInfo |
|||
/// because the path executed by the computed function is optimized given the knowledge that it will be |
|||
/// used to read values of the given type. |
|||
static member PreComputeRecordFieldReader : info:PropertyInfo -> (obj -> obj) |
|||
|
|||
/// Precompute a function for reading all the fields from a record. The fields are returned in the |
|||
/// same order as the fields reported by a call to Microsoft.FSharp.Reflection.Type.GetInfo for |
|||
/// this type. |
|||
/// |
|||
/// Assumes the given type is a RecordType. |
|||
/// If not, ArgumentException is raised during pre-computation. |
|||
/// |
|||
/// Using the computed function will typically be faster than executing a corresponding call to Value.GetInfo |
|||
/// because the path executed by the computed function is optimized given the knowledge that it will be |
|||
/// used to read values of the given type. |
|||
static member PreComputeRecordReader : recordType:Type * ?bindingFlags:BindingFlags -> (obj -> obj[]) |
|||
|
|||
|
|||
/// Precompute a function for constructing a record value. |
|||
/// |
|||
/// Assumes the given type is a RecordType. |
|||
/// If not, ArgumentException is raised during pre-computation. |
|||
static member PreComputeRecordConstructor : recordType:Type * ?bindingFlags:BindingFlags -> (obj[] -> obj) |
|||
|
|||
/// Get a ConstructorInfo for a record type |
|||
static member PreComputeRecordConstructorInfo: recordType:Type * ?bindingFlags:BindingFlags -> ConstructorInfo |
|||
|
|||
/// Create a union case value |
|||
static member MakeUnion: unionCase:UnionCaseInfo * args:obj [] * ?bindingFlags:BindingFlags -> obj |
|||
|
|||
/// Identify the union case and its fields for an object |
|||
/// |
|||
/// Assumes the given input is a union case value. If not, ArgumentException is raised. |
|||
/// |
|||
/// If the type is not given, then the runtime type of the input object is used to identify the |
|||
/// relevant union type. The type should always be given if the input object may be null. For example, |
|||
/// option values may be represented using the 'null'. |
|||
static member GetUnionFields: value:obj * unionType:Type * ?bindingFlags:BindingFlags -> UnionCaseInfo * obj [] |
|||
|
|||
/// |
|||
/// Assumes the given type is a union type. |
|||
/// If not, ArgumentException is raised during pre-computation. |
|||
/// |
|||
/// Using the computed function is more efficient than calling GetUnionCase |
|||
/// because the path executed by the computed function is optimized given the knowledge that it will be |
|||
/// used to read values of the given type. |
|||
static member PreComputeUnionTagReader : unionType:Type * ?bindingFlags:BindingFlags -> (obj -> int) |
|||
|
|||
/// Precompute a property or static method for reading an integer representing the case tag of a union type. |
|||
static member PreComputeUnionTagMemberInfo : unionType:Type * ?bindingFlags:BindingFlags -> MemberInfo |
|||
|
|||
/// Precompute a function for reading all the fields for a particular discriminator case of a union type |
|||
/// |
|||
/// Using the computed function will typically be faster than executing a corresponding call to GetFields |
|||
static member PreComputeUnionReader : unionCase:UnionCaseInfo * ?bindingFlags:BindingFlags -> (obj -> obj[]) |
|||
|
|||
/// Precompute a function for constructing a discriminated union value for a particular union case. |
|||
static member PreComputeUnionConstructor : unionCase:UnionCaseInfo * ?bindingFlags:BindingFlags -> (obj[] -> obj) |
|||
|
|||
/// A method that constructs objects of the given case |
|||
static member PreComputeUnionConstructorInfo: unionCase:UnionCaseInfo * ?bindingFlags:BindingFlags -> MethodInfo |
|||
|
|||
/// Create an instance of a tuple type |
|||
/// |
|||
/// Assumes at least one element is given. If not, ArgumentException is raised. |
|||
static member MakeTuple: tupleElements:obj[] * tupleType:Type -> obj |
|||
|
|||
/// Read a field from a tuple value |
|||
/// |
|||
/// Assumes the given input is a tuple value. If not, ArgumentException is raised. |
|||
static member GetTupleField: tuple:obj * index:int -> obj |
|||
|
|||
/// Read all fields from a tuple |
|||
/// |
|||
/// Assumes the given input is a tuple value. If not, ArgumentException is raised. |
|||
static member GetTupleFields: tuple:obj -> obj [] |
|||
|
|||
/// Precompute a function for reading the values of a particular tuple type |
|||
/// |
|||
/// Assumes the given type is a TupleType. |
|||
/// If not, ArgumentException is raised during pre-computation. |
|||
static member PreComputeTupleReader : tupleType:Type -> (obj -> obj[]) |
|||
|
|||
/// Get information that indicates how to read a field of a tuple |
|||
static member PreComputeTuplePropertyInfo: tupleType:Type * index:int -> PropertyInfo * (Type * int) option |
|||
|
|||
/// Precompute a function for reading the values of a particular tuple type |
|||
/// |
|||
/// Assumes the given type is a TupleType. |
|||
/// If not, ArgumentException is raised during pre-computation. |
|||
static member PreComputeTupleConstructor : tupleType:Type -> (obj[] -> obj) |
|||
|
|||
/// Get a method that constructs objects of the given tuple type. |
|||
/// For small tuples, no additional typoe will be returned. |
|||
/// |
|||
/// For large tuples, an additional type is returned indicating that |
|||
/// a nested encoding has been used for the tuple type. In this case |
|||
/// the suffix portion of the tuple type has the given type and an |
|||
/// object of this type must be created and passed as the last argument |
|||
/// to the ConstructorInfo. A recursive call to PreComputeTupleConstructorInfo |
|||
/// can be used to determine the constructor for that the suffix type. |
|||
static member PreComputeTupleConstructorInfo: tupleType:Type -> ConstructorInfo * Type option |
|||
|
|||
/// Build a typed function from object from a dynamic function implementation |
|||
static member MakeFunction : functionType:Type * implementation:(obj -> obj) -> obj |
|||
|
|||
/// Read all the fields from a value built using an instance of an F# exception declaration |
|||
/// |
|||
/// Assumes the given input is an F# exception value. If not, ArgumentException is raised. |
|||
static member GetExceptionFields: exn:obj * ?bindingFlags:BindingFlags -> obj[] |
|||
|
|||
|
|||
[<AbstractClass; Sealed>] |
|||
/// Contains operations associated with constructing and analyzing F# types such as records, unions and tuples |
|||
type FSharpType = |
|||
|
|||
/// Read all the fields from a record value, in declaration order |
|||
/// |
|||
/// Assumes the given input is a record value. If not, ArgumentException is raised. |
|||
static member GetRecordFields: recordType:Type * ?bindingFlags:BindingFlags -> PropertyInfo[] |
|||
|
|||
/// Get the cases of a union type. |
|||
/// |
|||
/// Assumes the given type is a union type. If not, ArgumentException is raised during pre-computation. |
|||
static member GetUnionCases: unionType:Type * ?bindingFlags:BindingFlags -> UnionCaseInfo[] |
|||
|
|||
/// Return a <c>System.Type</c> representing the F# function type with the given domain and range |
|||
static member MakeFunctionType: domain:Type * range:Type -> Type |
|||
|
|||
/// Return a <c>System.Type</c> representing an F# tuple type with the given element types |
|||
static member MakeTupleType: types:Type[] -> Type |
|||
|
|||
/// Return true if the <c>typ</c> is a representation of an F# tuple type |
|||
static member IsTuple : typ:Type -> bool |
|||
|
|||
/// Return true if the <c>typ</c> is a representation of an F# function type or the runtime type of a closure implementing an F# function type |
|||
static member IsFunction : typ:Type -> bool |
|||
|
|||
/// Return true if the <c>typ</c> is a <c>System.Type</c> value corresponding to the compiled form of an F# module |
|||
static member IsModule: typ:Type -> bool |
|||
|
|||
/// Return true if the <c>typ</c> is a representation of an F# record type |
|||
static member IsRecord: typ:Type * ?bindingFlags:BindingFlags -> bool |
|||
|
|||
/// Return true if the <c>typ</c> is a representation of an F# union type or the runtime type of a value of that type |
|||
static member IsUnion: typ:Type * ?bindingFlags:BindingFlags -> bool |
|||
|
|||
/// Get the tuple elements from the representation of an F# tuple type |
|||
static member GetTupleElements : tupleType:Type -> Type[] |
|||
|
|||
/// Get the domain and range types from an F# function type or from the runtime type of a closure implementing an F# type |
|||
static member GetFunctionElements : functionType:Type -> Type * Type |
|||
|
|||
/// Read all the fields from an F# exception declaration, in declaration order |
|||
/// |
|||
/// Assumes <c>exceptionType</c> is an exception representation type. If not, ArgumentException is raised. |
|||
static member GetExceptionFields: exceptionType:Type * ?bindingFlags:BindingFlags -> PropertyInfo[] |
|||
|
|||
/// Return true if the <c>typ</c> is a representation of an F# exception declaration |
|||
static member IsExceptionRepresentation: exceptionType:Type * ?bindingFlags:BindingFlags -> bool |
|||
|
|||
|
|||
File diff suppressed because it is too large
@ -1,509 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Collections |
|||
open System.Collections.Generic |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
|
|||
/// Basic operations on IEnumerables. |
|||
[<RequireQualifiedAccess>] |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
module Seq = |
|||
|
|||
/// Wrap the two given enumeration-of-enumerations as a single concatenated |
|||
/// enumeration. |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
val append: sequence1:seq<'T> -> sequence2:seq<'T> -> seq<'T> |
|||
|
|||
/// Return the average of the elements in the sequence |
|||
/// |
|||
/// The elements are averaged using the '+' operator, 'DivideByInt' method and 'Zero' property |
|||
/// associated with the element type. |
|||
val inline average : sequence:seq<(^T)> -> ^T |
|||
when ^T : (static member ( + ) : ^T * ^T -> ^T) |
|||
and ^T : (static member DivideByInt : ^T * int -> ^T) |
|||
and ^T : (static member Zero : ^T) |
|||
|
|||
/// Return the average of the results generated by applying the function to each element of the sequence. |
|||
/// |
|||
/// The elements are averaged using the '+' operator, 'DivideByInt' method and 'Zero' property |
|||
/// associated with the generated type. |
|||
val inline averageBy : projection:('T -> ^U) -> sequence:seq<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member DivideByInt : ^U * int -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
/// Return a sequence that corresponds to a cached version of the input sequence. |
|||
/// This result sequence will have the same elements as the input sequence. The result |
|||
/// can be enumerated multiple times. The input sequence will be enumerated at most |
|||
/// once and only as far as is necessary. |
|||
/// |
|||
/// Enumeration of the result sequence is thread safe in the sense that multiple independent IEnumerator |
|||
/// values may be used simultaneously from different threads (accesses to |
|||
/// the internal lookaside table are thread safe). Each individual IEnumerator |
|||
/// is not typically thread safe and should not be accessed concurrently. |
|||
/// |
|||
/// Note, once enumeration of the input sequence has started, |
|||
/// it's enumerator will be kept live by this object until the enumeration has completed. |
|||
/// At that point, the enumerator will be disposed. |
|||
/// |
|||
/// The enumerator may be disposed and underlying cache storage released by |
|||
/// converting the returned sequence object to type IDisposable, and calling the Dispose method |
|||
/// on this object. The sequence object may then be re-enumerated and a fresh enumerator will |
|||
/// be used. |
|||
val cache: sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Wrap a loosely-typed System.Collections sequence as a typed sequence. |
|||
/// |
|||
/// The use of this function usually requires a type annotation. |
|||
/// An incorrect type annotation may result in runtime type |
|||
/// errors. |
|||
/// |
|||
/// Individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
val cast: sequence:IEnumerable -> seq<'T> |
|||
|
|||
/// Apply the given function to each element of the list. Return |
|||
/// the list comprised of the results "x" for each element where |
|||
/// the function returns Some(x) |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
/// |
|||
/// Remember sequence is lazy, effects are delayed until it is enumerated. |
|||
val choose: chooser:('T -> 'U option) -> sequence:seq<'T> -> seq<'U> |
|||
|
|||
/// For each element of the enumeration apply the given function and concatenate all the results. |
|||
/// |
|||
/// Remember sequence is lazy, effects are delayed until it is enumerated. |
|||
val collect: mapping:('T -> #seq<'U>) -> sequence:seq<'T> -> seq<'U> |
|||
|
|||
/// Compare two sequence's using generic comparison, element by element. |
|||
val compare: comparer:('T -> 'T -> int) -> sequence1:seq<'T> -> sequence2:seq<'T> -> int |
|||
|
|||
/// Compare two sequence's using the given comparison function, element by element. |
|||
val compareWith: comparer:('T -> 'T -> int) -> sequence1:seq<'T> -> sequence2:seq<'T> -> int |
|||
|
|||
/// Wrap the given enumeration-of-enumerations as a single concatenated |
|||
/// enumeration. |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
val concat: sequences:seq<#seq<'T>> -> seq<'T> |
|||
|
|||
|
|||
/// Apply a key-generating function to each element of a sequence and return a sequence yielding unique |
|||
/// keys and their number of occurences in the original sequence. |
|||
/// |
|||
/// Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
/// that sequence is iterated. As a result this function should not be used with |
|||
/// large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
/// sequence. |
|||
val countBy : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'Key * int> |
|||
|
|||
/// Return a sequence that is built from the given delayed specification of an |
|||
/// Seq. The input function is evaluated each time an IEnumerator for the sequence |
|||
/// is requested. |
|||
val delay : generator:(unit -> seq<'T>) -> seq<'T> |
|||
|
|||
/// Return a sequence that contains no duplicate entries according to generic hash and equality comparisons on the entries. |
|||
/// If an element occurs multiple times in the sequence then the later occurrences are discarded. |
|||
val distinct: sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Return a sequence that contains no duplicate entries according to the |
|||
/// generic hash and equality comparisons on the keys returned by the given key-generating function. |
|||
/// If an element occurs multiple times in the sequence then the later occurrences are discarded. |
|||
val distinctBy: projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Create an empty sequence |
|||
[<GeneralizableValueAttribute>] |
|||
val empty<'T> : seq<'T> |
|||
|
|||
/// Test if any element of the sequence satisfies the given predicate. |
|||
/// |
|||
/// The predicate is applied to the elements of the input sequence. If any application |
|||
/// returns true then the overall result is true and no further elements are tested. |
|||
/// Otherwise, false is returned. |
|||
val exists: predicate:('T -> bool) -> sequence:seq<'T> -> bool |
|||
|
|||
/// Test if any pair of corresponding elements of the input sequences satisfies the given predicate. |
|||
/// |
|||
/// The predicate is applied to matching elements in the two sequences up to the lesser of the |
|||
/// two lengths of the collections. If any application returns true then the overall result is |
|||
/// true and no further elements are tested. Otherwise, false is returned. If one sequence is shorter than |
|||
/// the other then the remaining elements of the longer sequence are ignored. |
|||
val exists2: predicate:('T1 -> 'T2 -> bool) -> sequence1:seq<'T1> -> sequence2:seq<'T2> -> bool |
|||
|
|||
/// Return a new collection containing only the elements of the collection |
|||
/// for which the given predicate returns "true" |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
/// |
|||
/// Remember sequence is lazy, effects are delayed until it is enumerated. |
|||
val filter: predicate:('T -> bool) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Return the first element for which the given function returns <c>true</c>. |
|||
/// Raise <c>KeyNotFoundException</c> if no such element exists. |
|||
val find: predicate:('T -> bool) -> sequence:seq<'T> -> 'T |
|||
|
|||
/// Return the index of the first element in the sequence of pairs |
|||
/// that satisfies the given predicate. Raise <c>KeyNotFoundException</c> if no such element exists. |
|||
val findIndex: predicate:('T -> bool) -> sequence:seq<'T> -> int |
|||
|
|||
/// Apply a function to each element of the collection, threading an accumulator argument |
|||
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> |
|||
/// then computes <c>f (... (f s i0)...) iN</c> |
|||
val fold: folder:('State -> 'T -> 'State) -> state:'State -> sequence:seq<'T> -> 'State |
|||
|
|||
/// Test if all elements of the sequence satisfy the given predicate. |
|||
/// |
|||
/// The predicate is applied to the elements of the input sequence. If any application |
|||
/// returns false then the overall result is false and no further elements are tested. |
|||
/// Otherwise, true is returned. |
|||
val forall: predicate:('T -> bool) -> sequence:seq<'T> -> bool |
|||
|
|||
/// Test the all pairs of elements drawn from the two sequences satisfies the |
|||
/// given predicate. If one sequence is shorter than |
|||
/// the other then the remaining elements of the longer sequence are ignored |
|||
val forall2: predicate:('T1 -> 'T2 -> bool) -> sequence1:seq<'T1> -> sequence2:seq<'T2> -> bool |
|||
|
|||
/// Apply a key-generating function to each element of a sequence and yields a sequence of |
|||
/// unique keys. Each unique key has also contains a sequence of all elements that match |
|||
/// to this key. |
|||
/// |
|||
/// Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
/// that sequence is iterated. As a result this function should not be used with |
|||
/// large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
/// sequence. |
|||
val groupBy : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'Key * seq<'T>> |
|||
|
|||
/// Return the first element of the sequence. |
|||
val hd: sequence:seq<'T> -> 'T |
|||
|
|||
/// Return true if the sequence contains no elements, false otherwise |
|||
val isEmpty: sequence:seq<'T> -> bool |
|||
|
|||
/// Generate a new sequence which, when iterated, will return successive |
|||
/// elements by calling the given function, up to the given count. The results of calling the function |
|||
/// will not be saved, i.e. the function will be reapplied as necessary to |
|||
/// regenerate the elements. The function is passed the index of the item being |
|||
/// generated. |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
val init: count:int -> initializer:(int -> 'T) -> seq<'T> |
|||
|
|||
/// Generate a new sequence which, when iterated, will return successive |
|||
/// elements by calling the given function. The results of calling the function |
|||
/// will not be saved, i.e. the function will be reapplied as necessary to |
|||
/// regenerate the elements. The function is passed the index of the item being |
|||
/// generated |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
val initInfinite: initializer:(int -> 'T) -> seq<'T> |
|||
|
|||
/// Apply the given function to each element of the collection. |
|||
val iter: action:('T -> unit) -> sequence:seq<'T> -> unit |
|||
|
|||
/// Apply the given function to each element of the collection. The integer passed to the |
|||
/// function indicates the index of element. |
|||
val iteri: action:(int -> 'T -> unit) -> sequence:seq<'T> -> unit |
|||
|
|||
/// Apply the given function to two collections simultaneously. If one sequence is shorter than |
|||
/// the other then the remaining elements of the longer sequence are ignored. |
|||
val iter2: action:('T1 -> 'T2 -> unit) -> sequence1:seq<'T1> -> sequence2:seq<'T2> -> unit |
|||
|
|||
/// Return the length of the sequence |
|||
val length: sequence:seq<'T> -> int |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to each of the elements of the collection. The given function will be applied |
|||
/// as elements are demanded using the 'MoveNext' method on enumerators retrieved from the |
|||
/// object. |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
val map : mapping:('T -> 'U) -> sequence:seq<'T> -> seq<'U> |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than |
|||
/// the other then the remaining elements of the longer sequence are ignored. |
|||
val map2: mapping:('T1 -> 'T2 -> 'U) -> sequence1:seq<'T1> -> sequence2:seq<'T2> -> seq<'U> |
|||
|
|||
/// Build a new collection whose elements are the results of applying the given function |
|||
/// to each of the elements of the collection. The integer index passed to the |
|||
/// function indicates the index (from 0) of element being transformed. |
|||
val mapi: mapping:(int -> 'T -> 'U) -> sequence:seq<'T> -> seq<'U> |
|||
|
|||
/// Return the greatest of all elements of the sequence, compared via Operators.max |
|||
val max : sequence:seq<'T> -> 'T |
|||
|
|||
/// Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
val maxBy : projection:('T -> 'Key) -> sequence:seq<'T> -> 'T |
|||
|
|||
/// Return the lowest of all elements of the sequence, compared via Operators.min |
|||
val min : sequence:seq<'T> -> 'T |
|||
|
|||
/// Return the lowest of all elements of the array, compared via Operators.min on the function result |
|||
val minBy : projection:('T -> 'Key) -> sequence:seq<'T> -> 'T |
|||
|
|||
/// Compute the nth element in the collection. |
|||
val nth: index:int -> sequence:seq<'T> -> 'T |
|||
|
|||
/// Build a collection from the given array |
|||
val of_array: elements:'T array -> seq<'T> |
|||
|
|||
/// Build a collection from the given array |
|||
val of_list: elements:'T list -> seq<'T> |
|||
|
|||
/// Return a sequence of each element in the input sequence and its predecessor, with the |
|||
/// exception of the first element which is only returned as the predecessor of the second element. |
|||
val pairwise: sequence:seq<'T> -> seq<'T * 'T> |
|||
|
|||
/// Apply the given function to successive elements, returning the first |
|||
/// 'x' where the function returns "Some(x)". |
|||
val pick: chooser:('T -> 'U option) -> sequence:seq<'T> -> 'U |
|||
|
|||
/// Build a new sequence object that delegates to the given sequence object. This ensures |
|||
/// the original sequence can't be rediscovered and mutated by a type cast. For example, |
|||
/// if given an array the returned sequence will return the elements of the array, but |
|||
/// you can't cast the returned sequence object to an array. |
|||
val readonly : sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Apply a function to each element of the sequence, threading an accumulator argument |
|||
/// through the computation. Begin by applying the function to the first two elements. |
|||
/// Then feed this result into the function along with the third element and so on. |
|||
/// Return the final result. |
|||
/// Raises ArgumentException if the sequence has no elements. |
|||
val reduce: reduction:('T -> 'T -> 'T) -> sequence:seq<'T> -> 'T |
|||
|
|||
/// Like fold, but compute on-demand and return the sequence of intermediary and final results |
|||
val scan : folder:('State -> 'T -> 'State) -> state:'State -> sequence:seq<'T> -> seq<'State> |
|||
|
|||
/// Return a sequence that yields one item only. |
|||
val singleton: value:'T -> seq<'T> |
|||
|
|||
/// Return a sequence that skips N elements of the underlying sequence and then yields the |
|||
/// remaining elements of the sequence |
|||
val skip: count:int -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Return a sequence that, when iterated, skips elements of the underlying sequence while the |
|||
/// given predicate returns 'true', and then yields the remaining elements of the sequence |
|||
val skipWhile: predicate:('T -> bool) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Yield a sequence ordered by keys. |
|||
/// |
|||
/// Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
/// that sequence is iterated. As a result this function should not be used with |
|||
/// large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
/// sequence. |
|||
val sort : sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Apply a key-generating function to each element of a sequence and yield a sequence ordered |
|||
/// by keys. The keys are compared using generic comparison as implemented by <c>Operators.compare</c>. |
|||
/// |
|||
/// Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
/// that sequence is iterated. As a result this function should not be used with |
|||
/// large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
/// sequence. |
|||
val sortBy : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Return the sum of the elements in the sequence. |
|||
/// |
|||
/// The elements are summed using the '+' operator and 'Zero' property associated with the generated type. |
|||
val inline sum : sequence:seq<(^T)> -> ^T |
|||
when ^T : (static member ( + ) : ^T * ^T -> ^T) |
|||
and ^T : (static member Zero : ^T) |
|||
|
|||
/// Return the sum of the results generated by applying the function to each element of the sequence. |
|||
/// The generated elements are summed using the '+' operator and 'Zero' property associated with the generated type. |
|||
val inline sumBy : projection:('T -> ^U) -> sequence:seq<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
/// Return the first N elements of the sequence. |
|||
val take: count:int -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Return a sequence that, when iterated, yields elements of the underlying sequence while the |
|||
/// given predicate returns 'true', and returns no further elements |
|||
val takeWhile: predicate:('T -> bool) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Build an array from the given collection |
|||
val to_array: sequence:seq<'T> -> 'T array |
|||
|
|||
/// Build a list from the given collection |
|||
val to_list: sequence:seq<'T> -> 'T list |
|||
|
|||
/// Return the first element for which the given function returns <c>true</c>. |
|||
/// Return <c>None</c> if no such element exists. |
|||
val tryFind: predicate:('T -> bool) -> sequence:seq<'T> -> 'T option |
|||
|
|||
/// Return the index of the first element in the sequence |
|||
/// that satisfies the given predicate. Return 'None' if no such element exists. |
|||
val tryFindIndex : predicate:('T -> bool) -> sequence:seq<'T> -> int option |
|||
|
|||
/// Apply the given function to successive elements, returning the first |
|||
/// result where the function returns "Some(x)". |
|||
val tryPick: chooser:('T -> 'U option) -> sequence:seq<'T> -> 'U option |
|||
|
|||
/// Return a sequence that when enumerated returns at most N elements. |
|||
val truncate: count:int -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// Return a sequence that contains the elements generated by the given computation. |
|||
/// The given initial 'state' argument is passed to the element generator. |
|||
/// For each IEnumerator elements in the stream are generated on-demand by applying the element |
|||
/// generator, until a None value is returned by the element generator. Each call to the element |
|||
/// generator returns a new residual 'state'. |
|||
/// |
|||
/// Note the stream will be recomputed each time an IEnumerator is requested and iterated for the Seq. |
|||
/// |
|||
/// The returned sequence may be passed between threads safely. However, |
|||
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T> |
|||
|
|||
/// Return a sequence that yields 'sliding windows' of containing elements drawn from the input |
|||
/// sequence. Each window is returned as a fresh array. |
|||
val windowed: windowSize:int -> sequence:seq<'T> -> seq<'T[]> |
|||
|
|||
/// Combine the two sequences into a list of pairs. The two sequences need not have equal lengths: |
|||
/// when one sequence is exhausted any remaining elements in the other |
|||
/// sequence are ignored. |
|||
val zip: sequence1:seq<'T1> -> sequence2:seq<'T2> -> seq<'T1 * 'T2> |
|||
|
|||
/// Combine the three sequences into a list of triples. The two sequences need not have equal lengths: |
|||
/// when one sequence is exhausted any remaining elements in the other |
|||
/// sequence are ignored. |
|||
val zip3: sequence1:seq<'T1> -> sequence2:seq<'T2> -> sequence3:seq<'T3> -> seq<'T1 * 'T2 * 'T3> |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'groupBy' instead")>] |
|||
val group_by : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'Key * seq<'T>> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'isEmpty' instead")>] |
|||
val is_empty: sequence:seq<'T> -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryPick' instead")>] |
|||
val first: chooser:('T -> 'U option) -> sequence:seq<'T> -> 'U option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:('T -> bool) -> sequence:seq<'T> -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall2' instead")>] |
|||
val for_all2: predicate:('T1 -> 'T2 -> bool) -> sequence1:seq<'T1> -> sequence2:seq<'T2> -> bool |
|||
|
|||
|
|||
[<Obsolete("This function will be removed from the F# library. Replacement functions 'pick' and 'findIndex' are now provided, though with a different signature")>] |
|||
val find_index: predicate:('T -> bool) -> sequence:seq<'Key * 'T> -> 'Key |
|||
|
|||
[<Obsolete("This function will be removed from the F# library. Replacement functions 'pick' and 'findIndex' are now provided, though with a different signature")>] |
|||
val find_indexi: predicate:('Key -> 'T -> bool) -> sequence:seq<'Key * 'T> -> 'Key |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'tryFind' instead")>] |
|||
val tryfind: predicate:('T -> bool) -> sequence:seq<'T> -> 'T option |
|||
|
|||
[<Obsolete("This function will be removed from the F# library. Replacement functions 'tryPick' and 'tryFindIndex' are now provided, though with a different signature")>] |
|||
val tryfind_index : predicate:('T -> bool) -> sequence:seq<'Key * 'T> -> 'Key option |
|||
|
|||
[<Obsolete("This function will be removed from the F# library. Replacement functions 'tryPick' and 'tryFindIndex' are now provided, though with a different signature")>] |
|||
val tryfind_indexi : predicate:('Key -> 'T -> bool) -> sequence:seq<'Key * 'T> -> 'Key option |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'collect' instead")>] |
|||
val map_concat: mapping:('T -> #seq<'U>) -> sequence:seq<'T> -> seq<'U> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'init' instead")>] |
|||
val init_finite: count:int -> initializer:(int -> 'T) -> seq<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'initInfinite' instead")>] |
|||
val init_infinite: initializer:(int -> 'T) -> seq<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'takeWhile' instead")>] |
|||
val take_while: predicate:('T -> bool) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'skipWhile' instead")>] |
|||
val skip_while: predicate:('T -> bool) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'distinctBy' instead")>] |
|||
val distinct_by : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'countBy' instead")>] |
|||
val count_by : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'Key * int> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'sortBy' instead")>] |
|||
val sort_by : projection:('T -> 'Key) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'sumBy' instead")>] |
|||
val inline sum_by : projection:('T -> ^U) -> sequence:seq<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'averageBy' instead")>] |
|||
val inline average_by : projection:('T -> ^U) -> sequence:seq<'T> -> ^U |
|||
when ^U : (static member ( + ) : ^U * ^U -> ^U) |
|||
and ^U : (static member DivideByInt : ^U * int -> ^U) |
|||
and ^U : (static member Zero : ^U) |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'minBy' instead")>] |
|||
val min_by : projection:('T -> 'Key) -> sequence:seq<'T> -> 'T |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'maxBy' instead")>] |
|||
val max_by : projection:('T -> 'Key) -> sequence:seq<'T> -> 'T |
|||
#endif |
|||
|
|||
[<RequireQualifiedAccess>] |
|||
/// A group of functions used as part of the compiled representation of F# sequence expressions |
|||
module SequenceExpressionHelpers = |
|||
|
|||
/// The F# compiler emits calls to this function to |
|||
/// implement the 'while' operator for F# sequence expressions |
|||
val EnumerateWhile : guard:(unit -> bool) -> sequence:seq<'T> -> seq<'T> |
|||
|
|||
/// The F# compiler emits calls to this function to |
|||
/// implement the 'try/finally' operator for F# sequence expressions |
|||
val EnumerateThenFinally : sequence:seq<'T> -> compensation:(unit -> unit) -> seq<'T> |
|||
|
|||
/// The F# compiler emits calls to this function to implement the compiler-intrinsic |
|||
/// conversions from untyped System.Collections.IEnumerable sequences to typed sequences |
|||
val EnumerateFromFunctions: create:(unit -> 'T) -> moveNext:('T -> bool) -> current:('T -> 'U) -> seq<'U> |
|||
|
|||
/// The F# compiler emits calls to this function to implement the 'use' operator for F# sequence expressions |
|||
val EnumerateUsing : resource:'T -> sequence:('T -> #seq<'U>) -> seq<'U> when 'T :> IDisposable |
|||
|
|||
[<AbstractClass>] |
|||
/// The F# compiler emits implementations of this type for compiled sequence expressions |
|||
type GeneratedSequenceBase<'T> = |
|||
/// The F# compiler emits implementations of this method for compiled sequence expressions |
|||
new : unit -> GeneratedSequenceBase<'T> |
|||
/// The F# compiler emits implementations of this method for compiled sequence expressions |
|||
abstract GetFreshEnumerator : unit -> IEnumerator<'T> |
|||
/// The F# compiler emits implementations of this method for compiled sequence expressions |
|||
abstract GenerateNext : next:byref<IEnumerable<'T>> -> int |
|||
/// The F# compiler emits implementations of this method for compiled sequence expressions |
|||
abstract Close: unit -> unit |
|||
/// The F# compiler emits implementations of this method for compiled sequence expressions |
|||
abstract CheckClose: bool |
|||
/// The F# compiler emits implementations of this method for compiled sequence expressions |
|||
abstract LastGenerated : 'T |
|||
interface IEnumerable<'T> |
|||
interface IEnumerable |
|||
interface IEnumerator<'T> |
|||
interface IEnumerator |
|||
|
|||
@ -1,818 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
open System.Collections |
|||
open System.Collections.Generic |
|||
open System.Diagnostics |
|||
|
|||
(* A classic functional language implementation of binary trees *) |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>] |
|||
type (* internal *) SetTree<'T> = |
|||
| SetEmpty // height = 0 |
|||
| SetNode of 'T * SetTree<'T> * SetTree<'T> * int // height = int |
|||
| SetOne of 'T // height = 1 |
|||
// OPTIMIZATION: store SetNode(k,SetEmpty,SetEmpty,1) ---> SetOne(k) |
|||
// REVIEW: performance rumour has it that the data held in SetNode and SetOne should be |
|||
// exactly one cache line on typical architectures. They are currently |
|||
// ~6 and 3 words respectively. |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
module internal SetTree = |
|||
|
|||
let height t = |
|||
match t with |
|||
| SetEmpty -> 0 |
|||
| SetOne _ -> 1 |
|||
| SetNode (_,_,_,h) -> h |
|||
|
|||
#if CHECKED |
|||
let rec checkInvariant t = |
|||
// A good sanity check, loss of balance can hit perf |
|||
match t with |
|||
| SetEmpty -> true |
|||
| SetOne _ -> true |
|||
| SetNode (k,t1,t2,h) -> |
|||
let h1 = height t1 |
|||
let h2 = height t2 |
|||
(-2 <= (h1 - h2) && (h1 - h2) <= 2) && checkInvariant t1 && checkInvariant t2 |
|||
#endif |
|||
|
|||
let tolerance = 2 |
|||
|
|||
let mk l k r = |
|||
match l,r with |
|||
| SetEmpty,SetEmpty -> SetOne (k) |
|||
| _ -> |
|||
let hl = height l |
|||
let hr = height r |
|||
let m = if hl < hr then hr else hl |
|||
SetNode(k,l,r,m+1) |
|||
|
|||
let rebalance t1 k t2 = |
|||
let t1h = height t1 |
|||
let t2h = height t2 |
|||
if t2h > t1h + tolerance then // right is heavier than left |
|||
match t2 with |
|||
| SetNode(t2k,t2l,t2r,t2h) -> |
|||
// one of the nodes must have height > height t1 + 1 |
|||
if height t2l > t1h + 1 then // balance left: combination |
|||
match t2l with |
|||
| SetNode(t2lk,t2ll,t2lr,t2lh) -> |
|||
mk (mk t1 k t2ll) t2lk (mk t2lr t2k t2r) |
|||
| _ -> failwith "rebalance" |
|||
else // rotate left |
|||
mk (mk t1 k t2l) t2k t2r |
|||
| _ -> failwith "rebalance" |
|||
else |
|||
if t1h > t2h + tolerance then // left is heavier than right |
|||
match t1 with |
|||
| SetNode(t1k,t1l,t1r,t1h) -> |
|||
// one of the nodes must have height > height t2 + 1 |
|||
if height t1r > t2h + 1 then |
|||
// balance right: combination |
|||
match t1r with |
|||
| SetNode(t1rk,t1rl,t1rr,t1rh) -> |
|||
mk (mk t1l t1k t1rl) t1rk (mk t1rr k t2) |
|||
| _ -> failwith "rebalance" |
|||
else |
|||
mk t1l t1k (mk t1r k t2) |
|||
| _ -> failwith "rebalance" |
|||
else mk t1 k t2 |
|||
|
|||
let rec add (comparer: OptimizedClosures.FastFunc2<'T,'T,int>) k t = |
|||
match t with |
|||
| SetNode (k2,l,r,h) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then rebalance (add comparer k l) k2 r |
|||
elif c = 0 then t |
|||
else rebalance l k2 (add comparer k r) |
|||
| SetOne(k2) -> |
|||
// nb. no check for rebalance needed for small trees, also be sure to reuse node already allocated |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then SetNode (k,SetEmpty,t,2) |
|||
elif c = 0 then t |
|||
else SetNode (k,t,SetEmpty,2) |
|||
| SetEmpty -> SetOne(k) |
|||
|
|||
let rec balance comparer t1 k t2 = |
|||
// Given t1 < k < t2 where t1 and t2 are "balanced", |
|||
// return a balanced tree for <t1,k,t2>. |
|||
// Recall: balance means subtrees heights differ by at most "tolerance" |
|||
match t1,t2 with |
|||
| SetEmpty,t2 -> add comparer k t2 // drop t1 = empty |
|||
| t1,SetEmpty -> add comparer k t1 // drop t2 = empty |
|||
| SetOne k1,t2 -> add comparer k (add comparer k1 t2) |
|||
| t1,SetOne k2 -> add comparer k (add comparer k2 t1) |
|||
| SetNode(k1,t11,t12,h1),SetNode(k2,t21,t22,h2) -> |
|||
// Have: (t11 < k1 < t12) < k < (t21 < k2 < t22) |
|||
// Either (a) h1,h2 differ by at most 2 - no rebalance needed. |
|||
// (b) h1 too small, i.e. h1+2 < h2 |
|||
// (c) h2 too small, i.e. h2+2 < h1 |
|||
if h1+tolerance < h2 then |
|||
// case: b, h1 too small |
|||
// push t1 into low side of t2, may increase height by 1 so rebalance |
|||
rebalance (balance comparer t1 k t21) k2 t22 |
|||
elif h2+tolerance < h1 then |
|||
// case: c, h2 too small |
|||
// push t2 into high side of t1, may increase height by 1 so rebalance |
|||
rebalance t11 k1 (balance comparer t12 k t2) |
|||
else |
|||
// case: a, h1 and h2 meet balance requirement |
|||
mk t1 k t2 |
|||
|
|||
let rec split (comparer : OptimizedClosures.FastFunc2<'T,'T,int>) pivot t = |
|||
// Given a pivot and a set t |
|||
// Return { x in t s.t. x < pivot }, pivot in t? , { x in t s.t. x > pivot } |
|||
match t with |
|||
| SetNode(k1,t11,t12,h1) -> |
|||
let c = comparer.Invoke(pivot,k1) |
|||
if c < 0 then // pivot t1 |
|||
let t11_lo,havePivot,t11_hi = split comparer pivot t11 |
|||
t11_lo,havePivot,balance comparer t11_hi k1 t12 |
|||
elif c = 0 then // pivot is k1 |
|||
t11,true,t12 |
|||
else // pivot t2 |
|||
let t12_lo,havePivot,t12_hi = split comparer pivot t12 |
|||
balance comparer t11 k1 t12_lo,havePivot,t12_hi |
|||
| SetOne k1 -> |
|||
let c = comparer.Invoke(k1,pivot) |
|||
if c < 0 then t ,false,SetEmpty // singleton under pivot |
|||
elif c = 0 then SetEmpty,true ,SetEmpty // singleton is pivot |
|||
else SetEmpty,false,t // singleton over pivot |
|||
| SetEmpty -> |
|||
SetEmpty,false,SetEmpty |
|||
|
|||
let rec spliceOutSuccessor t = |
|||
match t with |
|||
| SetEmpty -> failwith "internal error: Map.splice_out_succ_or_pred" |
|||
| SetOne (k2) -> k2,SetEmpty |
|||
| SetNode (k2,l,r,_) -> |
|||
match l with |
|||
| SetEmpty -> k2,r |
|||
| _ -> let k3,l' = spliceOutSuccessor l in k3,mk l' k2 r |
|||
|
|||
let rec remove (comparer: OptimizedClosures.FastFunc2<'T,'T,int>) k t = |
|||
match t with |
|||
| SetEmpty -> t |
|||
| SetOne (k2) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c = 0 then SetEmpty |
|||
else t |
|||
| SetNode (k2,l,r,_) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then rebalance (remove comparer k l) k2 r |
|||
elif c = 0 then |
|||
match l,r with |
|||
| SetEmpty,_ -> r |
|||
| _,SetEmpty -> l |
|||
| _ -> |
|||
let sk,r' = spliceOutSuccessor r |
|||
mk l sk r' |
|||
else rebalance l k2 (remove comparer k r) |
|||
|
|||
let rec mem (comparer: OptimizedClosures.FastFunc2<'T,'T,int>) k t = |
|||
match t with |
|||
| SetNode(k2,l,r,_) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then mem comparer k l |
|||
elif c = 0 then true |
|||
else mem comparer k r |
|||
| SetOne(k2) -> (comparer.Invoke(k,k2) = 0) |
|||
| SetEmpty -> false |
|||
|
|||
let rec iter f t = |
|||
match t with |
|||
| SetNode(k2,l,r,_) -> iter f l; f k2; iter f r |
|||
| SetOne(k2) -> f k2 |
|||
| SetEmpty -> () |
|||
|
|||
let rec fold_right f m x = |
|||
match m with |
|||
| SetNode(k,l,r,h) -> fold_right f l (f k (fold_right f r x)) |
|||
| SetOne(k) -> f k x |
|||
| SetEmpty -> x |
|||
|
|||
let rec fold_left f x m = |
|||
match m with |
|||
| SetNode(k,l,r,h) -> |
|||
let x = fold_left f x l in |
|||
let x = f x k |
|||
fold_left f x r |
|||
| SetOne(k) -> f x k |
|||
| SetEmpty -> x |
|||
|
|||
let rec for_all f m = |
|||
match m with |
|||
| SetNode(k2,l,r,h) -> f k2 && for_all f l && for_all f r |
|||
| SetOne(k2) -> f k2 |
|||
| SetEmpty -> true |
|||
|
|||
let rec exists f m = |
|||
match m with |
|||
| SetNode(k2,l,r,h) -> f k2 || exists f l || exists f r |
|||
| SetOne(k2) -> f k2 |
|||
| SetEmpty -> false |
|||
|
|||
let is_empty m = match m with | SetEmpty -> true | _ -> false |
|||
|
|||
let subset comparer a b = for_all (fun x -> mem comparer x b) a |
|||
|
|||
let rec filterAux comparer f s acc = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> |
|||
let acc = if f k then add comparer k acc else acc |
|||
filterAux comparer f l (filterAux comparer f r acc) |
|||
| SetOne(k) -> if f k then add comparer k acc else acc |
|||
| SetEmpty -> acc |
|||
|
|||
let filter comparer f s = filterAux comparer f s SetEmpty |
|||
|
|||
let rec diffAux comparer m acc = |
|||
match m with |
|||
| SetNode(k,l,r,_) -> diffAux comparer l (diffAux comparer r (remove comparer k acc)) |
|||
| SetOne(k) -> remove comparer k acc |
|||
| SetEmpty -> acc |
|||
|
|||
let diff comparer a b = diffAux comparer b a |
|||
|
|||
let rec countAux s acc = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> countAux l (countAux r (acc+1)) |
|||
| SetOne(k) -> acc+1 |
|||
| SetEmpty -> acc |
|||
|
|||
let count s = countAux s 0 |
|||
|
|||
let rec union comparer t1 t2 = |
|||
// Perf: tried bruteForce for low heights, but nothing significant |
|||
match t1,t2 with |
|||
| SetNode(k1,t11,t12,h1),SetNode(k2,t21,t22,h2) -> // (t11 < k < t12) AND (t21 < k2 < t22) |
|||
// Divide and Quonquer: |
|||
// Suppose t1 is largest. |
|||
// Split t2 using pivot k1 into lo and hi. |
|||
// Union disjoint subproblems and then combine. |
|||
if h1 > h2 then |
|||
let lo,_,hi = split comparer k1 t2 in |
|||
balance comparer (union comparer t11 lo) k1 (union comparer t12 hi) |
|||
else |
|||
let lo,_,hi = split comparer k2 t1 in |
|||
balance comparer (union comparer t21 lo) k2 (union comparer t22 hi) |
|||
| SetEmpty,t -> t |
|||
| t,SetEmpty -> t |
|||
| SetOne k1,t2 -> add comparer k1 t2 |
|||
| t1,SetOne k2 -> add comparer k2 t1 |
|||
|
|||
let rec intersectionAux comparer b m acc = |
|||
match m with |
|||
| SetNode(k,l,r,_) -> |
|||
let acc = intersectionAux comparer b r acc |
|||
let acc = if mem comparer k b then add comparer k acc else acc |
|||
intersectionAux comparer b l acc |
|||
| SetOne(k) -> |
|||
if mem comparer k b then add comparer k acc else acc |
|||
| SetEmpty -> acc |
|||
|
|||
let intersection comparer a b = intersectionAux comparer b a SetEmpty |
|||
|
|||
let partition1 comparer f k (acc1,acc2) = if f k then (add comparer k acc1,acc2) else (acc1,add comparer k acc2) |
|||
|
|||
let rec partitionAux comparer f s acc = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> |
|||
let acc = partitionAux comparer f r acc |
|||
let acc = partition1 comparer f k acc |
|||
partitionAux comparer f l acc |
|||
| SetOne(k) -> partition1 comparer f k acc |
|||
| SetEmpty -> acc |
|||
|
|||
let partition comparer f s = partitionAux comparer f s (SetEmpty,SetEmpty) |
|||
|
|||
// It's easier to get many less-important algorithms right using this active pattern |
|||
let (|MatchSetNode|MatchSetEmpty|) s = |
|||
match s with |
|||
| SetNode(k2,l,r,_) -> MatchSetNode(k2,l,r) |
|||
| SetOne(k2) -> MatchSetNode(k2,SetEmpty,SetEmpty) |
|||
| SetEmpty -> MatchSetEmpty |
|||
|
|||
let rec nextElemCont (comparer: OptimizedClosures.FastFunc2<'T,'T,int>) k s cont = |
|||
match s with |
|||
| MatchSetNode(k2,l,r) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c < 0 then nextElemCont comparer k l (function None -> cont(Some(k2)) | res -> res) |
|||
elif c = 0 then cont(minimumElementOpt r) |
|||
else nextElemCont comparer k r cont |
|||
| MatchSetEmpty -> cont(None) |
|||
|
|||
and nextElem comparer k s = nextElemCont comparer k s (fun res -> res) |
|||
|
|||
and prevElemCont (comparer: OptimizedClosures.FastFunc2<'T,'T,int>) k s cont = |
|||
match s with |
|||
| MatchSetNode(k2,l,r) -> |
|||
let c = comparer.Invoke(k,k2) |
|||
if c > 0 then prevElemCont comparer k r (function None -> cont(Some(k2)) | res -> res) |
|||
elif c = 0 then cont(maximumElementOpt r) |
|||
else prevElemCont comparer k l cont |
|||
| MatchSetEmpty -> cont(None) |
|||
|
|||
and prevElem comparer k s = prevElemCont comparer k s (fun res -> res) |
|||
|
|||
and minimumElementAux s n = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> minimumElementAux l k |
|||
| SetOne(k) -> k |
|||
| SetEmpty -> n |
|||
|
|||
and minimumElementOpt s = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> Some(minimumElementAux l k) |
|||
| SetOne(k) -> Some k |
|||
| SetEmpty -> None |
|||
|
|||
and maximumElementAux s n = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> maximumElementAux r k |
|||
| SetOne(k) -> k |
|||
| SetEmpty -> n |
|||
|
|||
and maximumElementOpt s = |
|||
match s with |
|||
| SetNode(k,l,r,_) -> Some(maximumElementAux r k) |
|||
| SetOne(k) -> Some(k) |
|||
| SetEmpty -> None |
|||
|
|||
let minimumElement s = |
|||
match minimumElementOpt s with |
|||
| Some(k) -> k |
|||
| None -> failwith "minimumElement" |
|||
|
|||
let maximumElement s = |
|||
match maximumElementOpt s with |
|||
| Some(k) -> k |
|||
| None -> failwith "maximumElement" |
|||
|
|||
|
|||
//-------------------------------------------------------------------------- |
|||
// Imperative left-to-right iterators. |
|||
//-------------------------------------------------------------------------- |
|||
|
|||
[<StructuralEquality(false); StructuralComparison(false)>] |
|||
type iterator<'T> = |
|||
{ mutable stack: SetTree<'T> list; // invariant: always collapseLHS result |
|||
mutable started : bool // true when MoveNext has been called |
|||
} |
|||
|
|||
// collapseLHS: |
|||
// a) Always returns either [] or a list starting with SetOne. |
|||
// b) The "fringe" of the set stack is unchanged. |
|||
let rec collapseLHS stack = |
|||
match stack with |
|||
| [] -> [] |
|||
| SetEmpty :: rest -> collapseLHS rest |
|||
| SetOne k :: rest -> stack |
|||
| SetNode(k,l,r,h) :: rest -> collapseLHS (l :: SetOne k :: r :: rest) |
|||
|
|||
let mkIterator s = { stack = collapseLHS [s]; started = false } |
|||
|
|||
let not_started() = raise (new System.InvalidOperationException("Enumeration has not started. Call MoveNext.")) |
|||
let already_finished() = raise (new System.InvalidOperationException("Enumeration already finished.")) |
|||
|
|||
let current i = |
|||
if i.started then |
|||
match i.stack with |
|||
| SetOne k :: _ -> k |
|||
| [] -> already_finished() |
|||
| _ -> failwith "Please report error: Set iterator, unexpected stack for current" |
|||
else |
|||
not_started() |
|||
|
|||
let rec moveNext i = |
|||
if i.started then |
|||
match i.stack with |
|||
| SetOne k :: rest -> ( i.stack <- collapseLHS rest; |
|||
i.stack <> [] |
|||
) |
|||
| [] -> false |
|||
| _ -> failwith "Please report error: Set iterator, unexpected stack for moveNext" |
|||
else |
|||
i.started <- true; // The first call to MoveNext "starts" the enumeration. |
|||
i.stack <> [] |
|||
|
|||
let mkIEnumerator s = |
|||
let i = ref (mkIterator s) |
|||
{ new IEnumerator<_> with |
|||
member x.Current = current !i |
|||
interface IEnumerator with |
|||
member x.Current = box (current !i) |
|||
member x.MoveNext() = moveNext !i |
|||
member x.Reset() = i := mkIterator s |
|||
interface System.IDisposable with |
|||
member x.Dispose() = () } |
|||
|
|||
//-------------------------------------------------------------------------- |
|||
// Set comparison. This can be expensive. |
|||
//-------------------------------------------------------------------------- |
|||
|
|||
let rec compareStacks (comparer: OptimizedClosures.FastFunc2<'T,'T,int>) l1 l2 = |
|||
match l1,l2 with |
|||
| [],[] -> 0 |
|||
| [],_ -> -1 |
|||
| _ ,[] -> 1 |
|||
| (SetEmpty _ :: t1),(SetEmpty :: t2) -> compareStacks comparer t1 t2 |
|||
| (SetOne(n1k) :: t1),(SetOne(n2k) :: t2) -> |
|||
let c = comparer.Invoke(n1k,n2k) |
|||
if c <> 0 then c else compareStacks comparer t1 t2 |
|||
| (SetOne(n1k) :: t1),(SetNode(n2k,SetEmpty,n2r,_) :: t2) -> |
|||
let c = comparer.Invoke(n1k,n2k) |
|||
if c <> 0 then c else compareStacks comparer (SetEmpty :: t1) (n2r :: t2) |
|||
| (SetNode(n1k,(SetEmpty as emp),n1r,_) :: t1),(SetOne(n2k) :: t2) -> |
|||
let c = comparer.Invoke(n1k,n2k) |
|||
if c <> 0 then c else compareStacks comparer (n1r :: t1) (emp :: t2) |
|||
| (SetNode(n1k,(SetEmpty as emp),n1r,_) :: t1),(SetNode(n2k,SetEmpty,n2r,_) :: t2) -> |
|||
let c = comparer.Invoke(n1k,n2k) |
|||
if c <> 0 then c else compareStacks comparer (n1r :: t1) (n2r :: t2) |
|||
| (SetOne(n1k) :: t1),_ -> |
|||
compareStacks comparer (SetEmpty :: SetOne(n1k) :: t1) l2 |
|||
| (SetNode(n1k,n1l,n1r,_) :: t1),_ -> |
|||
compareStacks comparer (n1l :: SetNode(n1k,SetEmpty,n1r,0) :: t1) l2 |
|||
| _,(SetOne(n2k) :: t2) -> |
|||
compareStacks comparer l1 (SetEmpty :: SetOne(n2k) :: t2) |
|||
| _,(SetNode(n2k,n2l,n2r,_) :: t2) -> |
|||
compareStacks comparer l1 (n2l :: SetNode(n2k,SetEmpty,n2r,0) :: t2) |
|||
|
|||
let compare comparer s1 s2 = |
|||
match s1,s2 with |
|||
| SetEmpty,SetEmpty -> 0 |
|||
| SetEmpty,_ -> -1 |
|||
| _,SetEmpty -> 1 |
|||
| _ -> compareStacks comparer [s1] [s2] |
|||
|
|||
let choose s = minimumElement s |
|||
|
|||
let to_list s = |
|||
let rec loop m acc = |
|||
match m with |
|||
| SetNode(k,l,r,h) -> loop l (k :: loop r acc) |
|||
| SetOne(k) -> k ::acc |
|||
| SetEmpty -> acc |
|||
loop s [] |
|||
|
|||
let copyToArray s (arr: _[]) i = |
|||
let j = ref i |
|||
iter (fun x -> arr.[!j] <- x; j := !j + 1) s |
|||
|
|||
let to_array s = |
|||
let n = (count s) |
|||
let res = Array.zeroCreate n |
|||
copyToArray s res 0; |
|||
res |
|||
|
|||
|
|||
|
|||
let rec mkFromEnumerator comparer acc (e : IEnumerator<_>) = |
|||
if e.MoveNext() then |
|||
mkFromEnumerator comparer (add comparer e.Current acc) e |
|||
else acc |
|||
|
|||
let of_seq comparer (c : IEnumerable<_>) = |
|||
use ie = c.GetEnumerator() |
|||
mkFromEnumerator comparer SetEmpty ie |
|||
|
|||
let of_array comparer l = Array.fold (fun acc k -> add comparer k acc) SetEmpty l |
|||
|
|||
|
|||
[<Sealed>] |
|||
#if FX_NO_DEBUG_PROXIES |
|||
#else |
|||
[<System.Diagnostics.DebuggerTypeProxy(typedefof<SetDebugView<_>>)>] |
|||
#endif |
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<System.Diagnostics.DebuggerDisplay("Count = {Count}")>] |
|||
#endif |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")>] |
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId="Set")>] |
|||
|
|||
type Set<'T>(comparer:OptimizedClosures.FastFunc2<'T,'T,int>, tree: SetTree<'T>) = |
|||
|
|||
// We use .NET generics per-instantiation static fields to avoid allocating a new object for each empty |
|||
// set (it is just be a lookup into a .NET table of type-instantiation-indexed static fields). |
|||
|
|||
static let empty : Set<'T> = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'T>() |
|||
new Set<'T>(comparer,SetEmpty) |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member internal set.Comparer = comparer |
|||
//[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
member internal set.Tree : SetTree<'T> = tree |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
static member Empty :Set<'T> = empty |
|||
|
|||
member s.Add(x) : Set<'T> = Set<'T>(s.Comparer,SetTree.add s.Comparer x s.Tree ) |
|||
member s.Remove(x) : Set<'T> = Set<'T>(s.Comparer,SetTree.remove s.Comparer x s.Tree) |
|||
member s.Count = SetTree.count s.Tree |
|||
member s.Contains(x) = SetTree.mem s.Comparer x s.Tree |
|||
member s.Iterate(x) = SetTree.iter x s.Tree |
|||
member s.Fold f z = SetTree.fold_left (fun x z -> f z x) z s.Tree |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member s.IsEmpty = SetTree.is_empty s.Tree |
|||
|
|||
member s.Partition f : Set<'T> * Set<'T> = |
|||
match s.Tree with |
|||
| SetEmpty -> s,s |
|||
| _ -> let t1,t2 = SetTree.partition s.Comparer f s.Tree in Set<_>(s.Comparer,t1), Set<_>(s.Comparer,t2) |
|||
|
|||
member s.Filter f : Set<'T> = |
|||
match s.Tree with |
|||
| SetEmpty -> s |
|||
| _ -> Set<_>(s.Comparer,SetTree.filter s.Comparer f s.Tree) |
|||
|
|||
member s.Map f : Set<'U> = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'U>() |
|||
Set<_>(comparer,SetTree.fold_left (fun acc k -> SetTree.add comparer (f k) acc) (SetTree<_>.SetEmpty) s.Tree) |
|||
|
|||
member s.Exists f = SetTree.exists f s.Tree |
|||
|
|||
member s.forall f = SetTree.for_all f s.Tree |
|||
|
|||
static member (-) (a: Set<'T>, b: Set<'T>) = Set<_>.Subtract(a,b) |
|||
|
|||
[<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")>] |
|||
static member (+) (a: Set<'T>, b: Set<'T>) = Set<_>.Union(a,b) |
|||
|
|||
static member Intersection(a: Set<'T>, b: Set<'T>) : Set<'T> = |
|||
match b.Tree with |
|||
| SetEmpty -> b (* A INTER 0 = 0 *) |
|||
| _ -> |
|||
match a.Tree with |
|||
| SetEmpty -> a (* 0 INTER B = 0 *) |
|||
| _ -> Set<_>(a.Comparer,SetTree.intersection a.Comparer a.Tree b.Tree) |
|||
|
|||
static member Union(a: Set<'T>, b: Set<'T>) : Set<'T> = |
|||
match b.Tree with |
|||
| SetEmpty -> a (* A U 0 = A *) |
|||
| _ -> |
|||
match a.Tree with |
|||
| SetEmpty -> b (* 0 U B = B *) |
|||
| _ -> Set<_>(a.Comparer,SetTree.union a.Comparer a.Tree b.Tree) |
|||
|
|||
static member Union(sets:seq<Set<'T>>) : Set<'T> = |
|||
Seq.fold (fun s1 s2 -> Set<_>.Union(s1,s2)) Set<'T>.Empty sets |
|||
|
|||
static member Intersection(sets:seq<Set<'T>>) : Set<'T> = |
|||
Seq.reduce (fun s1 s2 -> Set<_>.Intersection(s1,s2)) sets |
|||
|
|||
static member Subtract(a: Set<'T>, b: Set<'T>) : Set<'T> = |
|||
match a.Tree with |
|||
| SetEmpty -> a (* 0 - B = 0 *) |
|||
| _ -> |
|||
match b.Tree with |
|||
| SetEmpty -> a (* A - 0 = A *) |
|||
| _ -> Set<_>(a.Comparer,SetTree.diff a.Comparer a.Tree b.Tree) |
|||
|
|||
static member Equality(a: Set<'T>, b: Set<'T>) = (SetTree.compare a.Comparer a.Tree b.Tree = 0) |
|||
|
|||
static member Compare(a: Set<'T>, b: Set<'T>) = SetTree.compare a.Comparer a.Tree b.Tree |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member x.Choose = SetTree.choose x.Tree |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member x.MinimumElement = SetTree.minimumElement x.Tree |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>] |
|||
#endif |
|||
member x.MaximumElement = SetTree.maximumElement x.Tree |
|||
member x.GetNextElement(e) = SetTree.nextElem x.Comparer e x.Tree |
|||
member x.GetPreviousElement(e) = SetTree.prevElem x.Comparer e x.Tree |
|||
|
|||
member x.IsSubsetOf(y: Set<'T>) = SetTree.subset x.Comparer x.Tree y.Tree |
|||
member x.IsSupersetOf(y: Set<'T>) = SetTree.subset x.Comparer y.Tree x.Tree |
|||
member x.ToList () = SetTree.to_list x.Tree |
|||
member x.ToArray () = SetTree.to_array x.Tree |
|||
|
|||
member this.ComputeHashCode() = |
|||
let combineHash x y = (x <<< 1) + y + 631 |
|||
let mutable res = 0 |
|||
for x in this do |
|||
res <- combineHash res (hash x) |
|||
abs res |
|||
|
|||
override this.GetHashCode() = this.ComputeHashCode() |
|||
|
|||
override this.Equals(that) = |
|||
match that with |
|||
| :? Set<'T> as that -> |
|||
((this :> System.IComparable).CompareTo(that) = 0) |
|||
| _ -> false |
|||
|
|||
interface System.IComparable with |
|||
member this.CompareTo(that: obj) = SetTree.compare this.Comparer this.Tree ((that :?> Set<'T>).Tree) |
|||
|
|||
interface ICollection<'T> with |
|||
member s.Add(x) = raise (new System.NotSupportedException("ReadOnlyCollection")) |
|||
member s.Clear() = raise (new System.NotSupportedException("ReadOnlyCollection")) |
|||
member s.Remove(x) = raise (new System.NotSupportedException("ReadOnlyCollection")) |
|||
member s.Contains(x) = SetTree.mem s.Comparer x s.Tree |
|||
member s.CopyTo(arr,i) = SetTree.copyToArray s.Tree arr i |
|||
member s.get_IsReadOnly() = true |
|||
member s.get_Count() = SetTree.count s.Tree |
|||
|
|||
interface IEnumerable<'T> with |
|||
member s.GetEnumerator() = SetTree.mkIEnumerator s.Tree |
|||
|
|||
interface IEnumerable with |
|||
override s.GetEnumerator() = (SetTree.mkIEnumerator s.Tree :> IEnumerator) |
|||
|
|||
static member Singleton(x:'T) : Set<'T> = Set<'T>.Empty.Add(x) |
|||
|
|||
new (elements : seq<'T>) = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'T>() |
|||
Set<_>(comparer,SetTree.of_seq comparer elements) |
|||
|
|||
static member Create(elements : seq<'T>) = Set<'T>(elements) |
|||
|
|||
static member FromArray(arr : 'T array) : Set<'T> = |
|||
let comparer = ComparisonIdentity.GetFastStructuralComparisonFunction<'T>() |
|||
Set<_>(comparer,SetTree.of_array comparer arr) |
|||
|
|||
and |
|||
[<Sealed>] |
|||
SetDebugView<'T>(v: Set<'T>) = |
|||
|
|||
#if FX_NO_DEBUG_DISPLAYS |
|||
#else |
|||
[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)>] |
|||
#endif |
|||
member x.Items = v |> Seq.truncate 1000 |> Seq.to_array |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
open System.Collections |
|||
open System.Collections.Generic |
|||
open System.Diagnostics |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module Set = |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let isEmpty (s : Set<'T>) = s.IsEmpty |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let is_empty (s : Set<'T>) = s.IsEmpty |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let contains x (s : Set<'T>) = s.Contains(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mem x (s : Set<'T>) = s.Contains(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let add x (s : Set<'T>) = s.Add(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let singleton x = Set<'T>.Singleton(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let remove x (s : Set<'T>) = s.Remove(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let union (s1 : Set<'T>) (s2 : Set<'T>) = Set<'T>.Union(s1,s2) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let unionMany sets = Set<_>.Union(sets) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let union_all sets = unionMany sets |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let intersect (s1 : Set<'T>) (s2 : Set<'T>) = Set<'T>.Intersection(s1,s2) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let intersectMany sets = Set<_>.Intersection(sets) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let intersect_all sets = intersectMany sets |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter f (s : Set<'T>) = s.Iterate(f) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let empty<'T> : Set<'T> = Set<'T>.Empty |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall f (s : Set<'T>) = s.forall f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all f (s : Set<'T>) = s.forall f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists f (s : Set<'T>) = s.Exists f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let filter f (s : Set<'T>) = s.Filter f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let partition f (s : Set<'T>) = s.Partition f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold f z (s : Set<'T>) = SetTree.fold_left f z s.Tree |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_left f z s = fold f z s |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let foldBack f (s : Set<'T>) z = SetTree.fold_right f s.Tree z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let fold_right f s z = foldBack f s z |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map f (s : Set<'T>) = s.Map f |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let count (s : Set<'T>) = s.Count |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let minimumElement (s : Set<'T>) = s.MinimumElement |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let maximumElement (s : Set<'T>) = s.MaximumElement |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let choose (s : Set<'T>) = s.Choose |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_list l = Set<_>(List.to_seq l) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_array (l : 'T array) = Set<'T>.FromArray(l) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_list (s : Set<'T>) = s.ToList() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_array (s : Set<'T>) = s.ToArray() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let to_seq (s : Set<'T>) = (s :> seq<'T>) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let of_seq (c : seq<_>) = Set<_>(c) |
|||
|
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let next_elt x (s : Set<'T>) = s.GetNextElement(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let prev_elt x (s : Set<'T>) = s.GetPreviousElement(x) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let min_elt (s : Set<'T>) = s.MinimumElement |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let max_elt (s : Set<'T>) = s.MaximumElement |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let size (s: Set<'T>) = s.Count |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let compare (s1: Set<'T>) (s2: Set<'T>) = Set<_>.Compare(s1,s2) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let subset (s1: Set<'T>) (s2: Set<'T>) = s1.IsSubsetOf(s2) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let diff (s1: Set<'T>) (s2: Set<'T>) = s1 - s2 |
|||
@ -1,245 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Collections.Generic |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
/// Immutable sets based on binary trees, where comparison is the |
|||
/// F# structural comparison function, potentially using implementations |
|||
/// of the IComparable interface on key values. |
|||
/// |
|||
/// See the Set module for further operations on sets. |
|||
/// |
|||
/// These sets can be used with elements of any type, but you should check that |
|||
/// structural hashing and equality on the element type are correct for your type. |
|||
[<Sealed>] |
|||
type Set<'T> = |
|||
|
|||
/// Create a set containing elements drawn from the given sequence. |
|||
new : elements:seq<'T> -> Set<'T> |
|||
|
|||
/// The empty set for the type 'T. |
|||
static member Empty : Set<'T> |
|||
|
|||
/// A useful shortcut for Set.add. Note this operation produces a new set |
|||
/// and does not mutate the original set. The new set will share many storage |
|||
/// nodes with the original. See the Set module for further operations on sets. |
|||
member Add : value:'T -> Set<'T> |
|||
|
|||
/// A useful shortcut for Set.remove. Note this operation produces a new set |
|||
/// and does not mutate the original set. The new set will share many storage |
|||
/// nodes with the original. See the Set module for further operations on sets. |
|||
member Remove : value:'T -> Set<'T> |
|||
|
|||
/// The number of elements in the set |
|||
member Count : int |
|||
|
|||
/// A useful shortcut for Set.contains. See the Set module for further operations on sets. |
|||
member Contains : value:'T -> bool |
|||
|
|||
/// A useful shortcut for Set.isEmpty. See the Set module for further operations on sets. |
|||
member IsEmpty : bool |
|||
|
|||
/// Return a new set with the elements of the second set removed from the first. |
|||
static member Subtract : set1:Set<'T> * set2:Set<'T> -> Set<'T> |
|||
|
|||
/// Return a new set with the elements of the second set removed from the first. |
|||
static member (-) : set1:Set<'T> * set2:Set<'T> -> Set<'T> |
|||
|
|||
/// Compute the union of the two sets. |
|||
static member (+) : set1:Set<'T> * set2:Set<'T> -> Set<'T> |
|||
|
|||
|
|||
/// Evaluates to "true" if all elements of the second set are in the first |
|||
member IsSubsetOf: set:Set<'T> -> bool |
|||
|
|||
/// Evaluates to "true" if all elements of the first set are in the second |
|||
member IsSupersetOf: set:Set<'T> -> bool |
|||
|
|||
|
|||
/// Returns the lowest element in the set according to the ordering being used for the set |
|||
member MinimumElement: 'T |
|||
|
|||
/// Returns the highest element in the set according to the ordering being used for the set |
|||
member MaximumElement: 'T |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
/// Returns the least element in the set that is greater than the given key |
|||
/// according to the ordering being used for the set |
|||
[<Obsolete("This member is being removed. Consider searching the elements explicitly instead")>] |
|||
member GetNextElement: value:'T -> 'T option |
|||
|
|||
/// Returns the greatest element in the set that is less than the given key |
|||
/// according to the ordering being used for the set |
|||
[<Obsolete("This member is being removed. Consider searching the elements explicitly instead")>] |
|||
member GetPreviousElement: value:'T -> 'T option |
|||
#endif |
|||
|
|||
interface ICollection<'T> |
|||
interface IEnumerable<'T> |
|||
interface System.Collections.IEnumerable |
|||
|
|||
interface System.IComparable |
|||
override Equals : obj -> bool |
|||
|
|||
|
|||
namespace Microsoft.FSharp.Collections |
|||
|
|||
open System |
|||
open System.Collections.Generic |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
|
|||
/// Functional programming operators related to the <c>Set<_></c> type. |
|||
module Set = |
|||
|
|||
/// The empty set for the type 'T . |
|||
[<GeneralizableValue>] |
|||
val empty<'T> : Set<'T> |
|||
|
|||
/// The set containing the given one element. |
|||
val singleton: value:'T -> Set<'T> |
|||
|
|||
/// Return a new set with an element added to the set. No exception is raised if |
|||
/// the set already contains the given element. |
|||
val add: value:'T -> set:Set<'T> -> Set<'T> |
|||
|
|||
///Evaluates to "true" if the given element is in the given set |
|||
val contains: element:'T -> set:Set<'T> -> bool |
|||
|
|||
///Return the number of elements in the set. Same as <c>size</c> |
|||
val count: set:Set<'T> -> int |
|||
|
|||
///Test if any element of the collection satisfies the given predicate. |
|||
///If the input function is <c>f</c> and the elements are <c>i0...iN</c> |
|||
///then computes <c>p i0 or ... or p iN</c>. |
|||
val exists: predicate:('T -> bool) -> set:Set<'T> -> bool |
|||
|
|||
/// Return a new collection containing only the elements of the collection |
|||
/// for which the given predicate returns <c>true</c> |
|||
val filter: predicate:('T -> bool) -> set:Set<'T> -> Set<'T> |
|||
|
|||
/// Return a new collection containing the results of applying the |
|||
/// given function to each element of the input set |
|||
val map: mapping:('T -> 'U) -> set:Set<'T> -> Set<'U> |
|||
|
|||
/// Apply the given accumulating function to all the elements of the set |
|||
val fold: folder:('State -> 'T -> 'State) -> state:'State -> set:Set<'T> -> 'State |
|||
|
|||
/// Apply the given accumulating function to all the elements of the set |
|||
val foldBack: folder:('T -> 'State -> 'State) -> set:Set<'T> -> state:'State -> 'State |
|||
|
|||
/// Test if all elements of the collection satisfy the given predicate. |
|||
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and "j0...jN" |
|||
/// then computes <c>p i0 && ... && p iN</c>. |
|||
val forall: predicate:('T -> bool) -> set:Set<'T> -> bool |
|||
|
|||
/// Compute the intersection of the two sets. |
|||
val intersect: set1:Set<'T> -> set2:Set<'T> -> Set<'T> |
|||
|
|||
///Compute the intersection of a sequence of sets. The sequence must be non-empty |
|||
val intersectMany: sets:seq<Set<'T>> -> Set<'T> |
|||
|
|||
///Compute the union of the two sets. |
|||
val union: set1:Set<'T> -> set2:Set<'T> -> Set<'T> |
|||
|
|||
///Compute the union of a sequence of sets. |
|||
val unionMany: sets:seq<Set<'T>> -> Set<'T> |
|||
|
|||
///Return "true" if the set is empty |
|||
val isEmpty: set:Set<'T> -> bool |
|||
|
|||
///Apply the given function to each element of the set, in order according |
|||
///to the comparison function |
|||
val iter: action:('T -> unit) -> set:Set<'T> -> unit |
|||
|
|||
///Split the set into two sets containing the elements for which the given predicate |
|||
///returns true and false respectively |
|||
val partition: predicate:('T -> bool) -> set:Set<'T> -> (Set<'T> * Set<'T>) |
|||
|
|||
///Return a new set with the given element removed. No exception is raised in |
|||
///the set doesn't contain the given element. |
|||
val remove: value: 'T -> set:Set<'T> -> Set<'T> |
|||
|
|||
/// Build a set that contains the same elements as the given list |
|||
val of_list: elements:'T list -> Set<'T> |
|||
|
|||
/// Build a list that contains the elements of the set in order |
|||
val to_list: set:Set<'T> -> 'T list |
|||
|
|||
/// Build a set that contains the same elements as the given array |
|||
val of_array: array:'T array -> Set<'T> |
|||
|
|||
/// Build an array that contains the elements of the set in order |
|||
val to_array: set:Set<'T> -> 'T array |
|||
|
|||
/// Return a view of the collection as an enumerable object |
|||
val to_seq: set:Set<'T> -> seq<'T> |
|||
|
|||
/// Build a new collection from the given enumerable object |
|||
val of_seq: elements:seq<'T> -> Set<'T> |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'unionMany' instead")>] |
|||
val union_all: seq<Set<'T>> -> Set<'T> |
|||
|
|||
[<Obsolete("Use the property notation 'set.MinumumElement' instead")>] |
|||
val min_elt: set:Set<'T> -> 'T |
|||
|
|||
[<Obsolete("Use the property notation 'set.MaximumElement' instead")>] |
|||
val max_elt: set:Set<'T> -> 'T |
|||
|
|||
[<Obsolete("This function is being removed. Consider using a different data structure, or iterating the elements of the set explicitly")>] |
|||
val next_elt: value:'T -> set:Set<'T> -> 'T option |
|||
|
|||
[<Obsolete("This function is being removed. Consider using a different data structure, or iterating the elements of the set explicitly")>] |
|||
val prev_elt: value:'T -> set:Set<'T> -> 'T option |
|||
|
|||
[<Obsolete("This function is being removed. Use 'Set.count' instead, or the property notation 'set.Size'")>] |
|||
val size: set:Set<'T> -> int |
|||
|
|||
[<Obsolete("This function is being removed. Use 'Operators.compare' on the two sets")>] |
|||
val compare: set1:Set<'T> -> set2:Set<'T> -> int |
|||
|
|||
///Evaluates to "true" if the given element is in the given set |
|||
[<Obsolete("This F# library function has been renamed. Use 'contains' instead")>] |
|||
val mem: element:'T -> set:Set<'T> -> bool |
|||
|
|||
/// Returns the minimum element of the set |
|||
[<Obsolete("This function is being removed. Use 'set.MinimumElement' instead")>] |
|||
val choose: set:Set<'T> -> 'T |
|||
|
|||
/// Evaluates to "true" if all elements of the second set are in the first |
|||
[<Obsolete("This function is being removed. Use 'set.IsSubsetOf' instead")>] |
|||
val subset: set1:Set<'T> -> set2:Set<'T> -> bool |
|||
|
|||
/// Return a new set with the elements of the second set removed from the first. |
|||
[<Obsolete("This function is being removed. Use the subtraction operator instead, e.g. a - b")>] |
|||
val diff: set1:Set<'T> -> set2:Set<'T> -> Set<'T> |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'intersectMany' instead")>] |
|||
val intersect_all: seq<Set<'T>> -> Set<'T> |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'isEmpty' instead")>] |
|||
val is_empty: set:Set<'T> -> bool |
|||
|
|||
[<OCamlCompatibility("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:('T -> bool) -> set:Set<'T> -> bool |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> set:Set<'T> -> 'State |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right: folder:('T -> 'State -> 'State) -> set:Set<'T> -> state:'State -> 'State |
|||
|
|||
#endif |
|||
@ -1,96 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Core |
|||
|
|||
open System.Diagnostics |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module String = |
|||
|
|||
let inline checkNonNull arg = |
|||
match box arg with null -> nullArg "str" | _ -> () |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let concat sep (strings : seq<string>) = |
|||
System.String.Join(sep, Seq.to_array strings) |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iter (f : (char -> unit)) (str:string) = |
|||
checkNonNull str |
|||
for i = 0 to str.Length - 1 do |
|||
f str.[i] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let iteri f (str:string) = |
|||
checkNonNull str |
|||
for i = 0 to str.Length - 1 do |
|||
f i str.[i] |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map (f: char -> char) (str:string) = |
|||
checkNonNull str |
|||
let res = new System.Text.StringBuilder(str.Length) |
|||
str |> iter (fun c -> res.Append(f c) |> ignore); |
|||
res.ToString() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let mapi (f: int -> char -> char) (str:string) = |
|||
checkNonNull str |
|||
let res = new System.Text.StringBuilder(str.Length) |
|||
str |> iteri (fun i c -> res.Append(f i c) |> ignore); |
|||
res.ToString() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let collect (f: char -> string) (str:string) = |
|||
checkNonNull str |
|||
let res = new System.Text.StringBuilder(str.Length) |
|||
str |> iter (fun c -> res.Append(f c) |> ignore); |
|||
res.ToString() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let init (count:int) (f: int-> string) = |
|||
if count < 0 then invalidArg "n" "the length may not be negative" |
|||
let res = new System.Text.StringBuilder(count) |
|||
for i = 0 to count - 1 do |
|||
res.Append(f i) |> ignore; |
|||
res.ToString() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let replicate (count:int) (str:string) = |
|||
checkNonNull str |
|||
let res = new System.Text.StringBuilder(str.Length) |
|||
for i = 0 to count - 1 do |
|||
res.Append(str) |> ignore; |
|||
res.ToString() |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let map_concat f str = collect f str |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let forall f (str:string) = |
|||
checkNonNull str |
|||
let rec check i = (i >= str.Length) || (f str.[i] && check (i+1)) |
|||
check 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let for_all f str = forall f str |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let exists f (str:string) = |
|||
checkNonNull str |
|||
let rec check i = (i < str.Length) && (f str.[i] || check (i+1)) |
|||
check 0 |
|||
|
|||
[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1709:IdentifiersShouldBeCasedCorrectly"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1707:IdentifiersShouldNotContainUnderscores"); CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>] |
|||
let length (str:string) = |
|||
checkNonNull str |
|||
str.Length |
|||
|
|||
|
|||
@ -1,67 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
namespace Microsoft.FSharp.Core |
|||
|
|||
open System |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Core.Operators |
|||
open Microsoft.FSharp.Collections |
|||
|
|||
/// Functional programming operators for string processing. Further string operations |
|||
/// are available via the member functions on strings and other functionality in |
|||
/// <a href="http://msdn2.microsoft.com/en-us/library/system.string.aspx">System.String</a> |
|||
/// and <a href="http://msdn2.microsoft.com/library/system.text.regularexpressions.aspx">System.Text.RegularExpressions</a> types. |
|||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] |
|||
[<RequireQualifiedAccess>] |
|||
module String = |
|||
|
|||
/// Return a new string made by concatenating the given strings |
|||
/// with separator 'sep', i.e. 'a1 + sep + ... + sep + aN' |
|||
val concat: sep:string -> strings: seq<string> -> string |
|||
|
|||
/// Apply the function <c>action</c> to each character in the string. |
|||
val iter: action:(char -> unit) -> str:string -> unit |
|||
|
|||
/// Apply the function <c>action</c> to the index of each character in the string and the character itself. |
|||
val iteri: action:(int -> char -> unit) -> str:string -> unit |
|||
|
|||
/// Build a new string whose characters are the results of applying the function <c>mapping</c> |
|||
/// to each of the characters of the input string. |
|||
val map: mapping:(char -> char) -> str:string -> string |
|||
|
|||
/// Build a new string whose characters are the results of applying the function <c>mapping</c> |
|||
/// to each character in the string and the character itself. |
|||
val mapi: mapping:(int -> char -> char) -> str:string -> string |
|||
|
|||
/// Build a new string whose characters are the results of applying the function <c>mapping</c> |
|||
/// to each of the characters of the input string and concatenating the resulting |
|||
/// strings. |
|||
val collect: mapping:(char -> string) -> str:string -> string |
|||
|
|||
/// Build a new string whose characters are the results of applying the function <c>mapping</c> |
|||
/// to each index from <c>0</c> to <c>count-1</c> and concatenating the resulting |
|||
/// strings. |
|||
val init: count:int -> initializer:(int -> string) -> string |
|||
|
|||
/// Test if all characters in the string satisfy the given predicate. |
|||
val forall: predicate:(char -> bool) -> str:string -> bool |
|||
|
|||
/// Test if any character of the string satisfies the given predicate. |
|||
val exists: predicate:(char -> bool) -> str:string -> bool |
|||
|
|||
/// Return a string by concatenating <c>count</c> instances of <c>str</c>. |
|||
val replicate: count:int -> str: string -> string |
|||
|
|||
/// Return the length of the string. |
|||
val length: str:string -> int |
|||
|
|||
#if DONT_INCLUDE_DEPRECATED |
|||
#else |
|||
[<Obsolete("This F# library function has been renamed. Use 'collect' instead")>] |
|||
val map_concat: mapping:(char -> string) -> str:string -> string |
|||
|
|||
[<Obsolete("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all: predicate:(char -> bool) -> str:string -> bool |
|||
#endif |
|||
File diff suppressed because it is too large
@ -1,257 +0,0 @@ |
|||
//========================================================================= |
|||
// (c) Microsoft Corporation 2005-2009. |
|||
//========================================================================= |
|||
|
|||
// This file is compiled 4(!) times in the codebase |
|||
// - as the internal implementation of printf '%A' formatting |
|||
// defines: RUNTIME |
|||
// - as the internal implementation of structured formatting in the FSharp.Compiler-proto.dll |
|||
// defines: INTERNALIZED_POWER_PACK + BUILDING_WITH_LKG |
|||
// - as the internal implementation of structured formatting in FSharp.Compiler.dll |
|||
// defines: INTERNALIZED_POWER_PACK |
|||
// NOTE: this implementation is used by fsi.exe. This is very important. |
|||
// - as the public implementation of structured formatting in the FSharp.PowerPack.dll |
|||
// defines: <none> |
|||
// |
|||
// The one implementation file is used because we very much want to keep the implementations of |
|||
// structured formatting the same for fsi.exe and '%A' printing. However fsi.exe may have |
|||
// a richer feature set. |
|||
// |
|||
// Note no layout objects are ever transferred between the above implementations, and in |
|||
// all 4 cases the layout types are really different types. |
|||
|
|||
#if INTERNALIZED_POWER_PACK |
|||
// FSharp.Compiler-proto.dll: |
|||
// FSharp.Compiler.dll: |
|||
namespace Internal.Utilities.StructuredFormat |
|||
#else |
|||
#if RUNTIME |
|||
// FSharp.Core.dll: |
|||
namespace Microsoft.FSharp.Text.StructuredPrintfImpl |
|||
#else |
|||
// Powerpack: |
|||
namespace Microsoft.FSharp.Text.StructuredFormat |
|||
#endif |
|||
#endif |
|||
|
|||
open System |
|||
open System.IO |
|||
open Microsoft.FSharp.Core |
|||
open Microsoft.FSharp.Collections |
|||
open Microsoft.FSharp.Primitives.Basics |
|||
|
|||
/// Data representing structured layouts of terms. |
|||
#if INTERNALIZED_POWER_PACK // FSharp.Compiler-proto.dll, FSharp.Compiler.dll: the F# compiler likes to see these representations |
|||
|
|||
/// Data representing joints in structured layouts of terms. The representation |
|||
/// of this data type is only for the consumption of formatting engines. |
|||
type Joint = |
|||
| Unbreakable |
|||
| Breakable of int |
|||
| Broken of int |
|||
|
|||
/// Data representing structured layouts of terms. The representation |
|||
/// of this data type is only for the consumption of formatting engines. |
|||
[<StructuralEquality(false);StructuralComparison(false)>] |
|||
type Layout = |
|||
| Leaf of bool * obj * bool |
|||
| Node of bool * Layout * bool * Layout * bool * Joint |
|||
| Attr of string * (string * string) list * Layout |
|||
#else |
|||
#if RUNTIME // FSharp.Core.dll makes things internal and hides representations |
|||
type internal Layout |
|||
#else // FSharp.PowerPack.dll makes things public but hides representations |
|||
type Layout |
|||
#endif |
|||
#endif |
|||
|
|||
|
|||
#if RUNTIME // FSharp.Core.dll doesn't use PrintIntercepts |
|||
#else // FSharp.Compiler.dll, FSharp.Compiler-proto.dll, FSharp.PowerPack.dll |
|||
type IEnvironment = |
|||
/// Return to the layout-generation |
|||
/// environment to layout any otherwise uninterpreted object |
|||
abstract GetLayout : obj -> Layout |
|||
/// The maximum number of elements for which to generate layout for |
|||
/// list-like structures, or columns in table-like |
|||
/// structures. -1 if no maximum. |
|||
abstract MaxColumns : int |
|||
/// The maximum number of rows for which to generate layout for table-like |
|||
/// structures. -1 if no maximum. |
|||
abstract MaxRows : int |
|||
#endif |
|||
|
|||
/// A layout is a sequence of strings which have been joined together. |
|||
/// The strings are classified as words, separators and left and right parenthesis. |
|||
/// This classification determines where spaces are inserted. |
|||
/// A joint is either unbreakable, breakable or broken. |
|||
/// If a joint is broken the RHS layout occurs on the next line with optional indentation. |
|||
/// A layout can be squashed to for given width which forces breaks as required. |
|||
module |
|||
#if RUNTIME // FSharp.Core.dll |
|||
internal |
|||
#endif |
|||
LayoutOps = |
|||
|
|||
/// The empty layout |
|||
val emptyL : Layout |
|||
/// Is it the empty layout? |
|||
val isEmptyL : layout:Layout -> bool |
|||
|
|||
/// An uninterpreted leaf, to be interpreted into a string |
|||
/// by the layout engine. This allows leaf layouts for numbers, strings and |
|||
/// other atoms to be customized according to culture. |
|||
val objL : value:obj -> Layout |
|||
|
|||
/// An string leaf |
|||
val wordL : text:string -> Layout |
|||
/// An string which requires no spaces either side. |
|||
val sepL : text:string -> Layout |
|||
/// An string which is right parenthesis (no space on it's left). |
|||
val rightL : text:string -> Layout |
|||
/// An string which is left parenthesis (no space on the right). |
|||
val leftL : text:string -> Layout |
|||
|
|||
/// Join, unbreakable. |
|||
val ( $$ ) : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Join, possible break with indent=0 |
|||
val ( ++ ) : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Join, possible break with indent=1 |
|||
val ( -- ) : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Join, possible break with indent=2 |
|||
val ( --- ) : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Join broken with ident=0 |
|||
val ( @@ ) : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Join broken with ident=1 |
|||
val ( @@- ) : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Join broken with ident=2 |
|||
val ( @@-- ) : layout1:Layout -> layout2:Layout -> Layout |
|||
|
|||
/// Join layouts into a comma separated list. |
|||
val commaListL : layouts:Layout list -> Layout |
|||
|
|||
/// Join layouts into a space separated list. |
|||
val spaceListL : layouts:Layout list -> Layout |
|||
|
|||
/// Join layouts into a semi-colon separated list. |
|||
val semiListL : layouts:Layout list -> Layout |
|||
|
|||
/// Join layouts into a list separated using the given Layout. |
|||
val sepListL : layout1:Layout -> layouts:Layout list -> Layout |
|||
|
|||
/// Wrap round brackets around Layout. |
|||
val bracketL : Layout:Layout -> Layout |
|||
/// Wrap square brackets around layout. |
|||
val squareBracketL : layout:Layout -> Layout |
|||
/// Wrap braces around layout. |
|||
val braceL : layout:Layout -> Layout |
|||
/// Form tuple of layouts. |
|||
val tupleL : layouts:Layout list -> Layout |
|||
/// Layout two vertically. |
|||
val aboveL : layout1:Layout -> layout2:Layout -> Layout |
|||
/// Layout list vertically. |
|||
val aboveListL : layouts:Layout list -> Layout |
|||
|
|||
/// Layout like an F# option. |
|||
val optionL : selector:('T -> Layout) -> value:'T option -> Layout |
|||
/// Layout like an F# list. |
|||
val listL : selector:('T -> Layout) -> value:'T list -> Layout |
|||
|
|||
/// See tagL |
|||
val tagAttrL : text:string -> maps:(string * string) list -> layout:Layout -> Layout |
|||
|
|||
/// For limitting layout of list-like sequences (lists,arrays,etc). |
|||
/// unfold a list of items using (project and z) making layout list via itemL. |
|||
/// If reach maxLength (before exhausting) then truncate. |
|||
val unfoldL : selector:('T -> Layout) -> folder:('State -> ('T * 'State) option) -> state:'State -> count:int -> Layout list |
|||
|
|||
/// A record of options to control structural formatting. |
|||
/// For F# Interactive properties matching those of this value can be accessed via the 'fsi' |
|||
/// value. |
|||
/// |
|||
/// Floating Point format given in the same format accepted by System.Double.ToString, |
|||
/// e.g. f6 or g15. |
|||
/// |
|||
/// If ShowProperties is set the printing process will evaluate properties of the values being |
|||
/// displayed. This may cause additional computation. |
|||
/// |
|||
/// The ShowIEnumerable is set the printing process will force the evalution of IEnumerable objects |
|||
/// to a small, finite depth, as determined by the printing parameters. |
|||
/// This may lead to additional computation being performed during printing. |
|||
/// |
|||
/// <example> |
|||
/// From F# Interactive the default settings can be adjusted using, for example, |
|||
/// <pre> |
|||
/// open Microsoft.FSharp.Compiler.Interactive.Settings;; |
|||
/// setPrintWidth 120;; |
|||
/// </pre> |
|||
/// </example> |
|||
[<StructuralEquality(false);StructuralComparison(false)>] |
|||
type |
|||
#if RUNTIME // FSharp.Core.dll |
|||
internal |
|||
#endif |
|||
FormatOptions = |
|||
{ FloatingPointFormat: string |
|||
AttributeProcessor: (string -> (string * string) list -> bool -> unit); |
|||
#if RUNTIME // FSharp.Core.dll: PrintIntercepts aren't used there |
|||
#else |
|||
#if INTERNALIZED_POWER_PACK // FSharp.Compiler.dll: This is the PrintIntercepts extensibility point currently revealed by fsi.exe's AddPrinter |
|||
PrintIntercepts: (IEnvironment -> obj -> Layout option) list; |
|||
StringLimit: int; |
|||
#endif |
|||
#endif |
|||
FormatProvider: System.IFormatProvider |
|||
BindingFlags: System.Reflection.BindingFlags |
|||
PrintWidth : int |
|||
PrintDepth : int |
|||
PrintLength : int |
|||
PrintSize : int |
|||
ShowProperties : bool |
|||
ShowIEnumerable: bool } |
|||
static member Default : FormatOptions |
|||
|
|||
module |
|||
#if RUNTIME // FSharp.Core.dll |
|||
internal |
|||
#endif |
|||
Display = |
|||
|
|||
|
|||
/// Convert any value to a string using a standard formatter |
|||
/// Data is typically formatted in a structured format, e.g. |
|||
/// lists are formatted using the "[1;2]" notation. |
|||
/// The details of the format are not specified and may change |
|||
/// from version to version and according to the flags given |
|||
/// to the F# compiler. The format is intended to be human-readable, |
|||
/// not machine readable. If alternative generic formats are required |
|||
/// you should develop your own formatter, using the code in the |
|||
/// implementation of this file as a starting point. |
|||
/// |
|||
/// Data from other .NET languages is formatted using a virtual |
|||
/// call to Object.ToString() on the boxed version of the input. |
|||
val any_to_string: value:'T -> string |
|||
|
|||
/// Ouput any value to a channel using the same set of formatting rules |
|||
/// as any_to_string |
|||
val output_any: writer:TextWriter -> value:'T -> unit |
|||
|
|||
#if RUNTIME // FSharp.Core.dll: Most functions aren't needed in FSharp.Core.dll, but we add one entry for printf |
|||
val printf_any_to_string: options:FormatOptions -> bindingFlags:System.Reflection.BindingFlags -> value:'T -> string |
|||
#else |
|||
val any_to_layout : options:FormatOptions -> value:'T -> Layout |
|||
val squash_layout : options:FormatOptions -> layout:Layout -> Layout |
|||
val output_layout : options:FormatOptions -> writer:TextWriter -> layout:Layout -> unit |
|||
val layout_as_string: options:FormatOptions -> value:'T -> string |
|||
#endif |
|||
|
|||
/// Convert any value to a layout using the given formatting options. The |
|||
/// layout can then be processed using formatting display engines such as |
|||
/// those in the LayoutOps module. any_to_string and output_any are |
|||
/// built using any_to_layout with default format options. |
|||
val layout_to_string: options:FormatOptions -> layout:Layout -> string |
|||
|
|||
|
|||
#if INTERNALIZED_POWER_PACK |
|||
val fsi_any_to_layout : options:FormatOptions -> value:'T -> Layout |
|||
#endif |
|||
@ -1,325 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.Array</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.Array </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Basic operations on arrays |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val append : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array that contains the elements of the first array followed by the elements of the second array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val average : overloaded</pre></td><td><summary> |
|||
Return the average of the elements in the array. If the array is empty an ArgumentException is thrown. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val averageBy : overloaded</pre></td><td><summary> |
|||
Return the average of the elements generated by applying the function to each element of the array. |
|||
If the array is empty an ArgumentException is thrown. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val blit : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Read a range of elements from the first array and write them into the second. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val choose : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. Return |
|||
the array comprised of the results "x" for each element where |
|||
the function returns Some(x) |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val collect : ('T -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
For each element of the array, apply the given function. Concatenate all the results and return the combined array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'zip' instead")>] |
|||
val combine : 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> ('T1 * 'T2) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val concat : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a>> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array that contains the elements of each of the given sequence of arrays |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val copy : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array that contains the elements of the given array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val create : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Create an array whose elements are all initially the given value. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_GeneralizableValueAttribute.html'>GeneralizableValueAttribute</a> ()>] |
|||
val empty<'T> : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Return an empty array of the given type |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if any element of the array satisfies the given predicate. |
|||
|
|||
The predicate is applied to the elements of the input array. If any application |
|||
returns true then the overall result is true and no further elements are tested. |
|||
Otherwise, false is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if any pair of corresponding elements of the arrays satisfies the given predicate. |
|||
|
|||
The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
two lengths of the collections. If any application returns true then the overall result is |
|||
true and no further elements are tested. Otherwise, if one collections is longer |
|||
than the other then the <tt>ArgumentException</tt> exception is raised. |
|||
Otherwise, false is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val fill : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Fill a range of elements of the array with the given value. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val filter : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Return a new collection containing only the elements of the collection |
|||
for which the given predicate returns "true" |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val find : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Return the first element for which the given function returns 'true'. |
|||
Raise <tt>KeyNotFoundException</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val findIndex : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the index of the first element in the array |
|||
that satisfies the given predicate. Raise <tt>KeyNotFoundException</tt> if |
|||
none of the elements satisy the predicate. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val fold : ('State -> 'T -> 'State) -> 'State -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State</pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> then computes |
|||
<tt>f (... (f s i0)...) iN</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val fold2 : |
|||
('State -> 'T1 -> 'T2 -> 'State) -> 'State -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State</pre></td><td><summary> |
|||
Apply a function to pairs of elements drawn from the two collections, |
|||
left-to-right, threading an accumulator argument |
|||
through the computation. The two input |
|||
arrays must have the same lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left : ('State -> 'T -> 'State) -> 'State -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State</pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right : ('T -> 'State -> 'State) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State -> 'State</pre></td><td><summary> |
|||
Apply a function to each element of the array, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> |
|||
then computes <tt>f i0 (...(f iN s))</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val foldBack : ('T -> 'State -> 'State) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State -> 'State</pre></td><td><summary> |
|||
Apply a function to each element of the array, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> then computes |
|||
<tt>f i0 (...(f iN s))</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val foldBack2 : |
|||
('T1 -> 'T2 -> 'State -> 'State) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State -> 'State</pre></td><td><summary> |
|||
Apply a function to pairs of elements drawn from the two collections, right-to-left, |
|||
threading an accumulator argument through the computation. The two input |
|||
arrays must have the same lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val forall : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if all elements of the array satisfy the given predicate. |
|||
|
|||
The predicate is applied to the elements of the input collection. If any application |
|||
returns false then the overall result is false and no further elements are tested. |
|||
Otherwise, true is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val forall2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if all corresponding elements of the array satisfy the given predicate pairwise. |
|||
|
|||
The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
two lengths of the collections. If any application returns false then the overall result is |
|||
false and no further elements are tested. Otherwise, if one collection is longer |
|||
than the other then the <tt>ArgumentException</tt> exception is raised. |
|||
Otherwise, true is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val get : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary> |
|||
Get an element from an array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val init : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Create an array given the dimension and a generator function to compute the elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val isEmpty : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Return true if the given array is empty, otherwise false |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter : ('T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to pair of elements drawn from matching indices in two arrays. The |
|||
two arrays must have the same lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. The integer passed to the |
|||
function indicates the index of element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri2 : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to pair of elements drawn from matching indices in two arrays, |
|||
also passing the index of the elements. The two arrays must have the same lengths, |
|||
otherwise an <tt>ArgumentException</tt> is raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array. You can also use property arr.Length. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'create' instead")>] |
|||
val make : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val map : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array whose elements are the results of applying the given function |
|||
to each of the elements of the array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map2 : ('T1 -> 'T2 -> 'U) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to the corresponding elements of the two collections pairwise. The two input |
|||
arrays must have the same lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'U) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array whose elements are the results of applying the given function |
|||
to each of the elements of the array. The integer index passed to the |
|||
function indicates the index of element being transformed. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi2 : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T1 -> 'T2 -> 'U) -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to the corresponding elements of the two collections pairwise, also passing the index of |
|||
the elements. The two input arrays must have the same lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val max : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val maxBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val min : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Return the lowest of all elements of the array, compared via Operators.min |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val minBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Return the lowest of all elements of the array, compared via Operators.min on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_list : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build an array from the given list |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_seq : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array from the given enumerable object |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val partition : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> * 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Split the collection into two collections, containing the |
|||
elements for which the given predicate returns "true" and "false" |
|||
respectively |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val permute : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Returns an array with all elements permuted according to the |
|||
specified permutation |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val pick : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U</pre></td><td><summary> |
|||
Apply the given function to successive elements, returning the first |
|||
result where function returns <tt>Some(x)</tt> for some <tt>x</tt>. If the function |
|||
never returns <tt>Some(x)</tt> then <tt>KeyNotFoundException</tt> is raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val reduce : ('T -> 'T -> 'T) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Apply a function to each element of the array, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> |
|||
then computes <tt>f (... (f i0 i1)...) iN</tt>. |
|||
Raises ArgumentException if the array has size zero. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val reduceBack : ('T -> 'T -> 'T) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T</pre></td><td><summary> |
|||
Apply a function to each element of the array, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> |
|||
then computes <tt>f i0 (...(f iN-1 iN))</tt>. |
|||
Raises ArgumentException if the array has size zero. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val rev : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Return a new array with the elements in reverse order |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val scan : ('State -> 'T -> 'State) -> 'State -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Like <tt>fold_left</tt>, but return the intermediary and final results |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val scanBack : ('T -> 'State -> 'State) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'State -> 'State <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Like <tt>fold_right</tt>, but return both the intermediary and final results |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val set : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Set an element of an array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sort : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Sort the elements of an array, returning a new array. Elements are compared using Operators.compare. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Sort the elements of an array, using the given projection for the keys and returning a new array. Elements are compared using Operators.compare. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortInPlace : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Sort the elements of an array by mutating the array in-place, using the given comparison function. Elements are compared using Operators.compare. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortInPlaceBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Sort the elements of an array by mutating the array in-place, using the given projection for the keys. Elements are compared using Operators.compare. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortInPlaceWith : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Sort the elements of an array by mutating the array in-place, using the given comparison function as the order |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortWith : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Sort the elements of an array, using the given comparison function as the order, returning a new array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'unzip' instead")>] |
|||
val split : ('T1 * 'T2) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> * 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val sub : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build a new array that contains the given subrange specified by |
|||
starting index and length. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sum : overloaded</pre></td><td><summary> |
|||
Return the sum of the elements in the array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sumBy : overloaded</pre></td><td><summary> |
|||
Return the sum of the results generated by applying the function to each element of the array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_list : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a list from the given array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_seq : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
View the given array as a sequence |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFind : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the first element for which the given function returns <tt>true</tt>. |
|||
Return <tt>None</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFindIndex : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the index of the first element in the array |
|||
that satisfies the given predicate. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryPick : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Apply the given function to successive elements, returning the first |
|||
result where function returns <tt>Some(x)</tt> for some <tt>x</tt>. If the function |
|||
never returns <tt>Some(x)</tt> then <tt>None</tt> is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val unzip : ('T1 * 'T2) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> * 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Split an array of pairs into two arrays |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val unzip3 : ('T1 * 'T2 * 'T3) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> * 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> * 'T3 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Split an array of triples into three arrays |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zeroCreate : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Create an array where the entries are initially the default value Unchecked.defaultof<'T>. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zip : 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> ('T1 * 'T2) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Combine the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zip3 : 'T1 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T2 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T3 <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> ('T1 * 'T2 * 'T3) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Combine three arrays into an array of pairs. The three arrays must have equal lengths, otherwise an <tt>ArgumentException</tt> is |
|||
raised. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,112 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.Array2D</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.Array2D </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Basic operations on 2-dimensional arrays. |
|||
|
|||
F# and .NET multi-dimensional arrays are typically zero-based. |
|||
However, .NET multi-dimensional arrays used in conjunction with external |
|||
libraries (e.g. libraries associated with Visual Basic) be |
|||
non-zero based, using a potentially different base for each dimension. |
|||
The operations in this module will accept such arrays, and |
|||
the basing on an input array will be propogated to a matching output |
|||
array on the <tt>Array2D.map</tt> and <tt>Array2D.mapi</tt> operations. |
|||
Non-zero-based arrays can also be created using <tt>Array2D.zero_create_based</tt>, |
|||
<tt>Array2D.create_based</tt> and <tt>Array2D.init_based</tt>. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val base1 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Fetch the base-index for the first dimension of the array. |
|||
|
|||
See notes on the Array2D module re. zero-basing. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val base2 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Fetch the base-index for the second dimension of the array. |
|||
|
|||
See notes on the Array2D module re. zero-basing. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val blit : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Read a range of elements from the first array and write them into the second. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val copy : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Build a new array whose elements are the same as the input array. |
|||
|
|||
For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val create : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Create an array whose elements are all initially the given value |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val createBased : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Create a based array whose elements are all initially the given value |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val get : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary> |
|||
Fetch an element from a 2D array. You can also use the syntax 'array.[index1,index2]' |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val init : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Create an array given the dimensions and a generator function to compute the elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val initBased : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Create a based array given the dimensions and a generator function to compute the elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter : ('T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. The integer indicies passed to the |
|||
function indicates the index of element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length1 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the first dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length2 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the second dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map : ('T -> 'U) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> 'U <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Build a new array whose elements are the results of applying the given function |
|||
to each of the elements of the array. |
|||
|
|||
For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'U) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> 'U <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Build a new array whose elements are the results of applying the given function |
|||
to each of the elements of the array. The integer indices passed to the |
|||
function indicates the element being transformed. |
|||
|
|||
For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val rebase : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Build a new array whose elements are the same as the input array but |
|||
where a non-zero-based input array generates a corresponding zero-based |
|||
output array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val set : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Set the value of an element in an array. You can also use the syntax 'array.[index1,index2] <- value' |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zeroCreate : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Create an array where the entries are initially Unchecked.defaultof<'T>. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zeroCreateBased : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td><summary> |
|||
Create a based array where the entries are initially Unchecked.defaultof<'T>. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,73 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.Array3D</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.Array3D </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Basic operations on rank 3 arrays. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val create : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a></pre></td><td><summary> |
|||
Create an array whose elements are all initially the given value |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val get : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary> |
|||
Fetch an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]' |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val init : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a></pre></td><td><summary> |
|||
Create an array given the dimensions and a generator function to compute the elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter : ('T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the array. The integer indicies passed to the |
|||
function indicates the index of element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length1 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the first dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length2 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the second dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length3 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the third dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map : ('T -> 'U) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> 'U <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a></pre></td><td><summary> |
|||
Build a new array whose elements are the results of applying the given function |
|||
to each of the elements of the array. |
|||
|
|||
For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'U) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> 'U <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a></pre></td><td><summary> |
|||
Build a new array whose elements are the results of applying the given function |
|||
to each of the elements of the array. The integer indices passed to the |
|||
function indicates the element being transformed. |
|||
|
|||
For non-zero-based arrays the basing on an input array will be propogated to the output |
|||
array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val set : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Set the value of an element in an array. You can also |
|||
use the syntax 'array.[index1,index2,index3] <- value'. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zeroCreate : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,]-1.html'>[,,]</a></pre></td><td><summary> |
|||
Create an array where the entries are initially the "default" value. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,55 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.Array4D</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.Array4D </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Basic operations on rank 4 arrays. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val create : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a></pre></td><td><summary> |
|||
Create an array whose elements are all initially the given value |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val get : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary> |
|||
Fetch an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]' |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val init : |
|||
<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a></pre></td><td><summary> |
|||
Create an array given the dimensions and a generator function to compute the elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length1 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the first dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length2 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the second dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length3 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the third dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length4 : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of an array in the fourth dimension |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val set : 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Set the value of an element in an array. You can also |
|||
use the syntax 'array.[index1,index2,index3,index4] <- value'. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zeroCreate : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,,,]-1.html'>[,,,]</a></pre></td><td><summary> |
|||
Create an array where the entries are initially the "default" value. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,41 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.ComparisonIdentity</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.ComparisonIdentity </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Common notions of comparison identity used with sorted data structures. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val FromFunction : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> IComparer<'T></pre></td><td><summary> |
|||
Compare using the given comparer function |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val GetFastComparisonFunction : |
|||
IComparer<'T> -> <a href='Microsoft.FSharp.Core.OptimizedClosures.type_FastFunc2-3.html'>FastFunc2</a><'T,'T,<a href='Microsoft.FSharp.Core.type__int.html'>int</a>></pre></td><td><summary> |
|||
Convert an existing IComparer object into a comparison function with a fast entry point |
|||
If comparer was originally built using ComparisonIdentity.FromFunction then the original function will be |
|||
returned |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val GetFastStructuralComparisonFunction : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__unit.html'>unit</a> -> <a href='Microsoft.FSharp.Core.OptimizedClosures.type_FastFunc2-3.html'>FastFunc2</a><'T,'T,<a href='Microsoft.FSharp.Core.type__int.html'>int</a>></pre></td><td><summary> |
|||
Convert an existing IComparer object into a comparison function with a fast entry point |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val Structural<'T> : IComparer<'T></pre></td><td><summary> |
|||
Structural comparison. Compare using Operators.compare. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,41 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.HashIdentity</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.HashIdentity </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Common notions of value identity used with hash tables. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val FromFunctions : |
|||
('T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> IEqualityComparer<'T></pre></td><td><summary> |
|||
Hash using the given hashing and equality functions |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val LimitedStructural : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> IEqualityComparer<'T></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val Reference<'T> : IEqualityComparer<'T></pre></td><td><summary> |
|||
Physical hashing (hash on reference identity of objects, and the contents of value types). |
|||
Hash using LanguagePrimitives.PhysicalEquality and LanguagePrimitives.PhysicalHash, |
|||
That is, for value types use GetHashCode and Object.Equals (if no other optimization available), |
|||
and for reference types use System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode and |
|||
reference equality. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val Structural<'T> : IEqualityComparer<'T></pre></td><td><summary> |
|||
Structural hashing. Hash using Operators.(=) and Operators.hash. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,320 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.List</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.List </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Basic operations on lists. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val append : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Return a new list that contains the elements of the first list |
|||
followed by elements of the second |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val average : overloaded</pre></td><td><summary> |
|||
Return the average of the elements in the list. |
|||
If the list is empty an ArgumentException is thrown. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val averageBy : overloaded</pre></td><td><summary> |
|||
Return the average of the elements generated by applying the function to each element of the list. |
|||
If the list is empty an ArgumentException is thrown. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val choose : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Apply the given function to each element of the list. Return |
|||
the list comprised of the results <tt>x</tt> for each element where |
|||
the function returns Some(x) |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val collect : ('T -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
For each element of the list, apply the given function. Concatenate all the results and return the combined list. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'zip' instead")>] |
|||
val combine : 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> ('T1 * 'T2) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val concat : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a>> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Return a new list that contains the elements of each the lists in order |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_GeneralizableValueAttribute.html'>GeneralizableValueAttribute</a> ()>] |
|||
val empty<'T> : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Return an empty list of the given type |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if any element of the list satisfies the given predicate. |
|||
|
|||
The predicate is applied to the elements of the input list. If any application |
|||
returns true then the overall result is true and no further elements are tested. |
|||
Otherwise, false is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if any pair of corresponding elements of the lists satisfies the given predicate. |
|||
|
|||
The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
two lengths of the collections. If any application returns true then the overall result is |
|||
true and no further elements are tested. Otherwise, if one collections is longer |
|||
than the other then the <tt>ArgumentException</tt> exception is raised. |
|||
Otherwise, false is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val filter : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Return a new collection containing only the elements of the collection |
|||
for which the given predicate returns "true" |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val find : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Return the first element for which the given function returns <tt>true</tt>. |
|||
Raise <tt>KeyNotFoundException</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'filter' instead")>] |
|||
val find_all : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val findIndex : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the index of the first element in the list |
|||
that satisfies the given predicate. |
|||
Raise <tt>KeyNotFoundException</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'concat' instead")>] |
|||
val flatten : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a>> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val fold : ('State -> 'T -> 'State) -> 'State -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State</pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. Take the second argument, and apply the function to it |
|||
and the first element of the list. Then feed this result into the function along |
|||
with the second element and so on. Return the final result. |
|||
If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> then |
|||
computes <tt>f (... (f s i0) i1 ...) iN</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val fold2 : |
|||
('State -> 'T1 -> 'T2 -> 'State) -> 'State -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State</pre></td><td><summary> |
|||
Apply a function to corresponding elements of two collections, threading an accumulator argument |
|||
through the computation. The collections must have identical sizes. |
|||
If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> and <tt>j0...jN</tt> |
|||
then computes <tt>f (... (f s i0 j0)...) iN jN</tt>. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'fold' instead")>] |
|||
val fold_left : ('State -> 'T -> 'State) -> 'State -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State</pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'fold2' instead")>] |
|||
val fold_left2 : |
|||
('State -> 'T1 -> 'T2 -> 'State) -> 'State -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State</pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'foldBack' instead")>] |
|||
val fold_right : ('T -> 'State -> 'State) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State -> 'State</pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'foldBack2' instead")>] |
|||
val fold_right2 : |
|||
('T1 -> 'T2 -> 'State -> 'State) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State -> 'State</pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val foldBack : ('T -> 'State -> 'State) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State -> 'State</pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> then |
|||
computes <tt>f i0 (...(f iN s))</tt>. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val foldBack2 : |
|||
('T1 -> 'T2 -> 'State -> 'State) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State -> 'State</pre></td><td><summary> |
|||
Apply a function to corresponding elements of two collections, threading an accumulator argument |
|||
through the computation. The collections must have identical sizes. |
|||
If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> and <tt>j0...jN</tt> |
|||
then computes <tt>f i0 j0 (...(f iN jN s))</tt>. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'forall' instead")>] |
|||
val for_all : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val forall : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if all elements of the collection satisfy the given predicate. |
|||
|
|||
The predicate is applied to the elements of the input list. If any application |
|||
returns false then the overall result is false and no further elements are tested. |
|||
Otherwise, true is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val forall2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if all corresponding elements of the collection satisfy the given predicate pairwise. |
|||
|
|||
The predicate is applied to matching elements in the two collections up to the lesser of the |
|||
two lengths of the collections. If any application returns false then the overall result is |
|||
false and no further elements are tested. Otherwise, if one collection is longer |
|||
than the other then the <tt>ArgumentException</tt> exception is raised. |
|||
Otherwise, true is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val hd : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Return the first element of the list. Raise (Invalid_argument "hd") if undefined. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val init : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Create a list by calling the given generator on each index |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val isEmpty : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Return true if the list contains no elements, false otherwise |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter : ('T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the collection. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to two collections simultaneously. The |
|||
collections must have identical size. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the collection. The integer passed to the |
|||
function indicates the index of element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri2 : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to two collections simultaneously. The |
|||
collections must have identical size. The integer passed to the |
|||
function indicates the index of element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of the list |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to each of the elements of the collection. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map2 : ('T1 -> 'T2 -> 'U) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to the corresponding elements of the two collections pairwise. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map3 : |
|||
('T1 -> 'T2 -> 'T3 -> 'U) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T3 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to the corresponding elements of the three collections simultaneously. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'U) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to each of the elements of the collection. The integer index passed to the |
|||
function indicates the index (from 0) of element being transformed. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi2 : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T1 -> 'T2 -> 'U) -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Like mapi, but mapping corresponding elements from two lists of equal length. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val max : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Return the greatest of all elements of the list, compared via Operators.max |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val maxBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val min : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Return the lowest of all elements of the list, compared via Operators.min |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val minBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Return the lowest of all elements of the array, compared via Operators.min on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val nth : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary> |
|||
Index into the list. The first element has index 0. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_array : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a collection from the given array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_seq : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a new collection from the given enumerable object |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val partition : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> * 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Split the collection into two collections, containing the |
|||
elements for which the given predicate returns <tt>true</tt> and <tt>false</tt> |
|||
respectively |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val permute : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Returns a list with all elements permuted according to the |
|||
specified permutation |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val pick : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U</pre></td><td><summary> |
|||
Apply the given function to successive elements, returning the first |
|||
result where function returns <tt>Some(x)</tt> for some x. If no such |
|||
element exists then raise <tt>System.Collections.Generic.KeyNotFoundException</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val reduce : ('T -> 'T -> 'T) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. Apply the function to the first two elements of the list. |
|||
Then feed this result into the function along with the third element and so on. |
|||
Return the final result. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> then computes |
|||
<tt>f (... (f i0 i1) i2 ...) iN</tt>. |
|||
Raises ArgumentException if the list has no elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val reduceBack : ('T -> 'T -> 'T) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T</pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> then computes |
|||
<tt>f i0 (...(f iN-1 iN))</tt>. |
|||
Raises ArgumentException if the list has no elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val replicate : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Create a list by calling the given generator on each index |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val rev : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Return a new list with the elements in reverse order |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val scan : ('State -> 'T -> 'State) -> 'State -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. Take the second argument, and apply the function to it |
|||
and the first element of the list. Then feed this result into the function along |
|||
with the second element and so on. Return the list of intermediate results and the final result. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val scanBack : ('T -> 'State -> 'State) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'State -> 'State <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Like <tt>foldBack</tt>, but return both the intermediary and final results |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sort : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Sort the given list using the given comparison function |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortBy : ('T -> 'U) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Sort the given list using keys given by the given projection. Keys are compared using Operators.compare. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortWith : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Sort the given list using the given comparison function |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'unzip' instead")>] |
|||
val split : ('T1 * 'T2) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> * 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'sortWith' instead")>] |
|||
val stable_sort : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val sum : overloaded</pre></td><td><summary> |
|||
Return the sum of the elements in the list |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sumBy : overloaded</pre></td><td><summary> |
|||
Return the sum of the results generated by applying the function to each element of the list. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tl : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Return the tail of the list. Raise (Invalid_argument "tl") if undefined. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_array : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build an array from the given collection |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_seq : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Build a new collection from the given enumerable object |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFind : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the first element for which the given function returns <tt>true</tt>. |
|||
Return <tt>None</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFindIndex : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the index of the first element in the list |
|||
that satisfies the given predicate. |
|||
Return <tt>None</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryPick : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Apply the given function to successive elements, returning <tt>Some(x)</tt> the first |
|||
result where function returns <tt>Some(x)</tt> for some x. If no such element |
|||
exists then return <tt>None</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val unzip : ('T1 * 'T2) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> * 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Split a list of pairs into two lists |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val unzip3 : ('T1 * 'T2 * 'T3) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> * 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> * 'T3 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Split a list of triples into three lists |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zip : 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> ('T1 * 'T2) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Combine the two lists into a list of pairs. The two lists must have equal lengths. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zip3 : 'T1 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T2 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> 'T3 <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> ('T1 * 'T2 * 'T3) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Combine the three lists into a list of triples. The lists must have equal lengths. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,128 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.Map</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.Map </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Functional programming operators related to the <tt>Map<_,_></tt> type. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val add : 'Key -> 'T -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Return a new map with the binding added to the given map. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val contains : 'Key -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test is an element is in the domain of the map |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_GeneralizableValueAttribute.html'>GeneralizableValueAttribute</a> ()>] |
|||
val empty<'Key,'T> : <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
The empty map |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists : ('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Return true if the given predicate returns true for one of the |
|||
bindings in the map. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val filter : ('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Build a new map containing only the bindings for which the given predicate returns 'true' |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val find : 'Key -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'T</pre></td><td><summary> |
|||
Lookup an element in the map, raising <tt>KeyNotFoundException</tt> if no binding |
|||
exists in the map. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val findIndex : ('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'Key</pre></td><td><summary> |
|||
Evaluates the function on each mapping in the collection. Returns the key for the first mapping |
|||
where the function returns 'true'. Raise <tt>KeyNotFoundException</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val fold : |
|||
('State -> 'Key -> 'T -> 'State) -> 'State -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'State</pre></td><td><summary> |
|||
Fold over the bindings in the map |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val foldBack : |
|||
('Key -> 'T -> 'State -> 'State) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'State -> 'State</pre></td><td><summary> |
|||
Fold over the bindings in the map |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val forall : ('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Return true if the given predicate returns true for all of the |
|||
bindings in the map. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'isEmpty' instead")>] |
|||
val is_empty : <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val isEmpty : <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Is the map empty? |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter : ('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each binding in the dictionary |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map : ('Key -> 'T -> 'U) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'U></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to each of the elements of the collection. The index passed to the |
|||
function indicates the index of element being transformed. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_OCamlCompatibilityAttribute.html'>OCamlCompatibilityAttribute</a> |
|||
("This F# library function has been renamed. Use 'contains' instead")>] |
|||
val mem : 'Key -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td></td></tr> |
|||
<tr valign="top"><td><pre>val of_array : ('Key * 'T) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Return a new map made from the given bindings |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_list : ('Key * 'T) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Return a new map made from the given bindings |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_seq : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'Key * 'T> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Return a new map made from the given bindings |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val partition : |
|||
('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> |
|||
<a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> * <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Build two new maps, one containing the bindings for which the given predicate returns 'true', |
|||
and the other the remaining bindings. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val pick : ('Key -> 'T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'U</pre></td><td><summary> |
|||
Search the map looking for the first element where the given function returns a <tt>Some</tt> value |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val remove : 'Key -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T></pre></td><td><summary> |
|||
Remove an element from the domain of the map. No exception is raised if the element is not present. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_array : <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> ('Key * 'T) <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Returns an array of all key-value pairs in the mappinng |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_list : <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> ('Key * 'T) <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Returns a list of all key-value pairs in the mappinng |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_seq : <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'Key * 'T></pre></td><td><summary> |
|||
View the collection as an enumerable sequence. This collection |
|||
type is also directly compatible with 'seq<KeyValuePair<_,_> >'. |
|||
|
|||
Note this function returns a sequence of tuples, whereas the collection |
|||
itself is compatible with the logically equivalent sequence of KeyValuePairs. |
|||
Using sequences of tuples tends to be more convenient in F#, however the |
|||
collection itself must enumerate KeyValuePairs to conform to the .NET |
|||
design guidelines and the IDictionary interface. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFind : 'Key -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'T <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Lookup an element in the map, returning a <tt>Some</tt> value if the element is in the domain |
|||
of the map and <tt>None</tt> if not. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFindIndex : ('Key -> 'T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'Key <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the key of the first mapping in the collection that satisfies the given predicate. |
|||
Return 'None' if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryPick : ('Key -> 'T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> <a href='Microsoft.FSharp.Collections.type_Map-2.html'>Map</a><'Key,'T> -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Search the map looking for the first element where the given function returns a <tt>Some</tt> value |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,387 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.Seq</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.Seq </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
Basic operations on IEnumerables. |
|||
</summary> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val append : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Wrap the two given enumeration-of-enumerations as a single concatenated |
|||
enumeration. |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val average : overloaded</pre></td><td><summary> |
|||
Return the average of the elements in the sequence |
|||
|
|||
The elements are averaged using the '+' operator, 'DivideByInt' method and 'Zero' property |
|||
associated with the element type. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val averageBy : overloaded</pre></td><td><summary> |
|||
Return the average of the results generated by applying the function to each element of the sequence. |
|||
|
|||
The elements are averaged using the '+' operator, 'DivideByInt' method and 'Zero' property |
|||
associated with the generated type. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val cache : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that corresponds to a cached version of the input sequence. |
|||
This result sequence will have the same elements as the input sequence. The result |
|||
can be enumerated multiple times. The input sequence will be enumerated at most |
|||
once and only as far as is necessary. |
|||
|
|||
Enumeration of the result sequence is thread safe in the sense that multiple independent IEnumerator |
|||
values may be used simultaneously from different threads (accesses to |
|||
the internal lookaside table are thread safe). Each individual IEnumerator |
|||
is not typically thread safe and should not be accessed concurrently. |
|||
|
|||
Note, once enumeration of the input sequence has started, |
|||
it's enumerator will be kept live by this object until the enumeration has completed. |
|||
At that point, the enumerator will be disposed. |
|||
|
|||
The enumerator may be disposed and underlying cache storage released by |
|||
converting the returned sequence object to type IDisposable, and calling the Dispose method |
|||
on this object. The sequence object may then be re-enumerated and a fresh enumerator will |
|||
be used. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val cast : <a href='http://msdn2.microsoft.com/en-us/library/System.Collections.IEnumerable.aspx'>IEnumerable</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Wrap a loosely-typed System.Collections sequence as a typed sequence. |
|||
|
|||
The use of this function usually requires a type annotation. |
|||
An incorrect type annotation may result in runtime type |
|||
errors. |
|||
|
|||
Individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val choose : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U></pre></td><td><summary> |
|||
Apply the given function to each element of the list. Return |
|||
the list comprised of the results "x" for each element where |
|||
the function returns Some(x) |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
Remember sequence is lazy, effects are delayed until it is enumerated. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val collect : ('T -> #<a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U></pre></td><td><summary> |
|||
For each element of the enumeration apply the given function and concatenate all the results. |
|||
|
|||
Remember sequence is lazy, effects are delayed until it is enumerated. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val compare : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Compare two sequence's using generic comparison, element by element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val compareWith : ('T -> 'T -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Compare two sequence's using the given comparison function, element by element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val concat : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><#<a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T>> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Wrap the given enumeration-of-enumerations as a single concatenated |
|||
enumeration. |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val countBy : ('T -> 'Key) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'Key * <a href='Microsoft.FSharp.Core.type__int.html'>int</a>></pre></td><td><summary> |
|||
Apply a key-generating function to each element of a sequence and return a sequence yielding unique |
|||
keys and their number of occurences in the original sequence. |
|||
|
|||
Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
that sequence is iterated. As a result this function should not be used with |
|||
large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
sequence. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val delay : (<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that is built from the given delayed specification of an |
|||
Seq. The input function is evaluated each time an IEnumerator for the sequence |
|||
is requested. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val distinct : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that contains no duplicate entries according to generic hash and equality comparisons on the entries. |
|||
If an element occurs multiple times in the sequence then the later occurrences are discarded. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val distinctBy : ('T -> 'Key) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that contains no duplicate entries according to the |
|||
generic hash and equality comparisons on the keys returned by the given key-generating function. |
|||
If an element occurs multiple times in the sequence then the later occurrences are discarded. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>[<<a href='Microsoft.FSharp.Core.type_GeneralizableValueAttribute.html'>GeneralizableValueAttribute</a> ()>] |
|||
val empty<'T> : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Create an empty sequence |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if any element of the sequence satisfies the given predicate. |
|||
|
|||
The predicate is applied to the elements of the input sequence. If any application |
|||
returns true then the overall result is true and no further elements are tested. |
|||
Otherwise, false is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val exists2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T2> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if any pair of corresponding elements of the input sequences satisfies the given predicate. |
|||
|
|||
The predicate is applied to matching elements in the two sequences up to the lesser of the |
|||
two lengths of the collections. If any application returns true then the overall result is |
|||
true and no further elements are tested. Otherwise, false is returned. If one sequence is shorter than |
|||
the other then the remaining elements of the longer sequence are ignored. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val filter : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a new collection containing only the elements of the collection |
|||
for which the given predicate returns "true" |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
|
|||
Remember sequence is lazy, effects are delayed until it is enumerated. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val find : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Return the first element for which the given function returns <tt>true</tt>. |
|||
Raise <tt>KeyNotFoundException</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val findIndex : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the index of the first element in the sequence of pairs |
|||
that satisfies the given predicate. Raise <tt>KeyNotFoundException</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val fold : ('State -> 'T -> 'State) -> 'State -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'State</pre></td><td><summary> |
|||
Apply a function to each element of the collection, threading an accumulator argument |
|||
through the computation. If the input function is <tt>f</tt> and the elements are <tt>i0...iN</tt> |
|||
then computes <tt>f (... (f s i0)...) iN</tt> |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val forall : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test if all elements of the sequence satisfy the given predicate. |
|||
|
|||
The predicate is applied to the elements of the input sequence. If any application |
|||
returns false then the overall result is false and no further elements are tested. |
|||
Otherwise, true is returned. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val forall2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T2> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Test the all pairs of elements drawn from the two sequences satisfies the |
|||
given predicate. If one sequence is shorter than |
|||
the other then the remaining elements of the longer sequence are ignored |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val groupBy : ('T -> 'Key) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'Key * <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T>></pre></td><td><summary> |
|||
Apply a key-generating function to each element of a sequence and yields a sequence of |
|||
unique keys. Each unique key has also contains a sequence of all elements that match |
|||
to this key. |
|||
|
|||
Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
that sequence is iterated. As a result this function should not be used with |
|||
large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
sequence. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val hd : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Return the first element of the sequence. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val init : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Generate a new sequence which, when iterated, will return successive |
|||
elements by calling the given function, up to the given count. The results of calling the function |
|||
will not be saved, i.e. the function will be reapplied as necessary to |
|||
regenerate the elements. The function is passed the index of the item being |
|||
generated. |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val initInfinite : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Generate a new sequence which, when iterated, will return successive |
|||
elements by calling the given function. The results of calling the function |
|||
will not be saved, i.e. the function will be reapplied as necessary to |
|||
regenerate the elements. The function is passed the index of the item being |
|||
generated |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val isEmpty : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary> |
|||
Return true if the sequence contains no elements, false otherwise |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter : ('T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the collection. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iter2 : ('T1 -> 'T2 -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T2> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to two collections simultaneously. If one sequence is shorter than |
|||
the other then the remaining elements of the longer sequence are ignored. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val iteri : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary> |
|||
Apply the given function to each element of the collection. The integer passed to the |
|||
function indicates the index of element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val length : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a></pre></td><td><summary> |
|||
Return the length of the sequence |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map : ('T -> 'U) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to each of the elements of the collection. The given function will be applied |
|||
as elements are demanded using the 'MoveNext' method on enumerators retrieved from the |
|||
object. |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val map2 : |
|||
('T1 -> 'T2 -> 'U) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T2> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than |
|||
the other then the remaining elements of the longer sequence are ignored. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val mapi : (<a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> 'U) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U></pre></td><td><summary> |
|||
Build a new collection whose elements are the results of applying the given function |
|||
to each of the elements of the collection. The integer index passed to the |
|||
function indicates the index (from 0) of element being transformed. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val max : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Return the greatest of all elements of the sequence, compared via Operators.max |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val maxBy : ('T -> 'Key) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Return the greatest of all elements of the array, compared via Operators.max on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val min : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Return the lowest of all elements of the sequence, compared via Operators.min |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val minBy : ('T -> 'Key) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Return the lowest of all elements of the array, compared via Operators.min on the function result |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val nth : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Compute the nth element in the collection. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_array : 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Build a collection from the given array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val of_list : 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Build a collection from the given array |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val pairwise : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T * 'T></pre></td><td><summary> |
|||
Return a sequence of each element in the input sequence and its predecessor, with the |
|||
exception of the first element which is only returned as the predecessor of the second element. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val pick : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'U</pre></td><td><summary> |
|||
Apply the given function to successive elements, returning the first |
|||
'x' where the function returns "Some(x)". |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val readonly : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Build a new sequence object that delegates to the given sequence object. This ensures |
|||
the original sequence can't be rediscovered and mutated by a type cast. For example, |
|||
if given an array the returned sequence will return the elements of the array, but |
|||
you can't cast the returned sequence object to an array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val reduce : ('T -> 'T -> 'T) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T</pre></td><td><summary> |
|||
Apply a function to each element of the sequence, threading an accumulator argument |
|||
through the computation. Begin by applying the function to the first two elements. |
|||
Then feed this result into the function along with the third element and so on. |
|||
Return the final result. |
|||
Raises ArgumentException if the sequence has no elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val scan : |
|||
('State -> 'T -> 'State) -> 'State -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'State></pre></td><td><summary> |
|||
Like fold, but compute on-demand and return the sequence of intermediary and final results |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val singleton : 'T -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that yields one item only. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val skip : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that skips N elements of the underlying sequence and then yields the |
|||
remaining elements of the sequence |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val skipWhile : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that, when iterated, skips elements of the underlying sequence while the |
|||
given predicate returns 'true', and then yields the remaining elements of the sequence |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sort : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Yield a sequence ordered by keys. |
|||
|
|||
Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
that sequence is iterated. As a result this function should not be used with |
|||
large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
sequence. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sortBy : ('T -> 'Key) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Apply a key-generating function to each element of a sequence and yield a sequence ordered |
|||
by keys. The keys are compared using generic comparison as implemented by <tt>Operators.compare</tt>. |
|||
|
|||
Note that this function returns a sequence that digests the whole initial sequence as soon as |
|||
that sequence is iterated. As a result this function should not be used with |
|||
large or infinite sequences. The function makes no assumption on the ordering of the original |
|||
sequence. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sum : overloaded</pre></td><td><summary> |
|||
Return the sum of the elements in the sequence. |
|||
|
|||
The elements are summed using the '+' operator and 'Zero' property associated with the generated type. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val sumBy : overloaded</pre></td><td><summary> |
|||
Return the sum of the results generated by applying the function to each element of the sequence. |
|||
The generated elements are summed using the '+' operator and 'Zero' property associated with the generated type. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val take : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return the first N elements of the sequence. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val takeWhile : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that, when iterated, yields elements of the underlying sequence while the |
|||
given predicate returns 'true', and returns no further elements |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_array : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T <a href='Microsoft.FSharp.Core.type__array-1.html'>array</a></pre></td><td><summary> |
|||
Build an array from the given collection |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val to_list : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T <a href='Microsoft.FSharp.Collections.type__list-1.html'>list</a></pre></td><td><summary> |
|||
Build a list from the given collection |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val truncate : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that when enumerated returns at most N elements. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFind : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'T <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the first element for which the given function returns <tt>true</tt>. |
|||
Return <tt>None</tt> if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryFindIndex : ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Core.type__int.html'>int</a> <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Return the index of the first element in the sequence |
|||
that satisfies the given predicate. Return 'None' if no such element exists. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val tryPick : ('T -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> 'U <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a></pre></td><td><summary> |
|||
Apply the given function to successive elements, returning the first |
|||
result where the function returns "Some(x)". |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val unfold : ('State -> ('T * 'State) <a href='Microsoft.FSharp.Core.type__option-1.html'>option</a>) -> 'State -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
Return a sequence that contains the elements generated by the given computation. |
|||
The given initial 'state' argument is passed to the element generator. |
|||
For each IEnumerator elements in the stream are generated on-demand by applying the element |
|||
generator, until a None value is returned by the element generator. Each call to the element |
|||
generator returns a new residual 'state'. |
|||
|
|||
Note the stream will be recomputed each time an IEnumerator is requested and iterated for the Seq. |
|||
|
|||
The returned sequence may be passed between threads safely. However, |
|||
individual IEnumerator values generated from the returned sequence should not be accessed concurrently. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val windowed : <a href='Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[]-1.html'>[]</a>></pre></td><td><summary> |
|||
Return a sequence that yields 'sliding windows' of containing elements drawn from the input |
|||
sequence. Each window is returned as a fresh array. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zip : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T2> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1 * 'T2></pre></td><td><summary> |
|||
Combine the two sequences into a list of pairs. The two sequences need not have equal lengths: |
|||
when one sequence is exhausted any remaining elements in the other |
|||
sequence are ignored. |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val zip3 : |
|||
<a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1> -> |
|||
<a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T2> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T3> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T1 * 'T2 * 'T3></pre></td><td><summary> |
|||
Combine the three sequences into a list of triples. The two sequences need not have equal lengths: |
|||
when one sequence is exhausted any remaining elements in the other |
|||
sequence are ignored. |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
@ -1,52 +0,0 @@ |
|||
<HTML><HEAD><TITLE>Microsoft.FSharp.Collections.SequenceExpressionHelpers</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY> |
|||
<br><dl> |
|||
<dt></dt><dd> |
|||
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Collections.html'>Microsoft.FSharp.Collections</a>.SequenceExpressionHelpers </h1><br> |
|||
</dd> |
|||
<dt></dt><dd> |
|||
<table> |
|||
<tr valign='top'><td><summary> |
|||
A group of functions used as part of the compiled representation of F# sequence expressions |
|||
</summary> |
|||
<dt><h3>Type Definitions</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=30%>Type</th><th>Description</th></tr> |
|||
<tr valign="top"><td>type <a href='Microsoft.FSharp.Collections.SequenceExpressionHelpers.type_GeneratedSequenceBase-1.html'>GeneratedSequenceBase</a></td><td><summary> |
|||
The F# compiler emits implementations of this type for compiled sequence expressions |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
<dt><h3>Values</h3></dt><dd> |
|||
<table width="100%%"> |
|||
<tr><th width=60%>Value</th><th>Description</th></tr> |
|||
<tr valign="top"><td><pre>val EnumerateFromFunctions : |
|||
(<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> 'T) -> ('T -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> ('T -> 'U) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U></pre></td><td><summary> |
|||
The F# compiler emits calls to this function to implement the compiler-intrinsic |
|||
conversions from untyped System.Collections.IEnumerable sequences to typed sequences |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val EnumerateThenFinally : <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> (<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> <a href='Microsoft.FSharp.Core.type__unit.html'>unit</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
The F# compiler emits calls to this function to |
|||
implement the 'try/finally' operator for F# sequence expressions |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val EnumerateUsing : |
|||
'T -> ('T -> #<a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'U> (requires 'T :> <a href='http://msdn2.microsoft.com/en-us/library/System.IDisposable.aspx'>IDisposable</a>)</pre></td><td><summary> |
|||
The F# compiler emits calls to this function to implement the 'use' operator for F# sequence expressions |
|||
</summary></td></tr> |
|||
<tr valign="top"><td><pre>val EnumerateWhile : (<a href='Microsoft.FSharp.Core.type__unit.html'>unit</a> -> <a href='Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T> -> <a href='Microsoft.FSharp.Collections.type__seq-1.html'>seq</a><'T></pre></td><td><summary> |
|||
The F# compiler emits calls to this function to |
|||
implement the 'while' operator for F# sequence expressions |
|||
</summary></td></tr> |
|||
|
|||
</table> |
|||
</dd> |
|||
</td></tr> |
|||
<tr valign='top'><td> |
|||
<dt><h3>See Also</h3></dt><dd> |
|||
<a href="Microsoft.FSharp.Collections.html">Microsoft.FSharp.Collections</a> </dd> |
|||
</td></tr> |
|||
</table> |
|||
</dd> |
|||
</dl> |
|||
<br /> <br/><p><i>Documentation for assembly FSharp.Core, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p> |
|||
</BODY></HTML> |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue