Get an implementation of comparison semantics using the given function.
'T -> 'T -> int
A function to compare two values.
IComparer<'T>
An object implementing IComparer using the supplied function.
Create and use a comparer using the given function:
let comparer = ComparisonIdentity.FromFunction(fun i1 i2 -> compare (i1%5) (i2%5))
comparer.Compare(7, 2)
val comparer: System.Collections.Generic.IComparer<int>
module ComparisonIdentity from Microsoft.FSharp.Collections
val FromFunction: comparer: ('T -> 'T -> int) -> System.Collections.Generic.IComparer<'T>
val i1: int
val i2: int
val compare: e1: 'T -> e2: 'T -> int (requires comparison)
System.Collections.Generic.IComparer.Compare(x: int, y: int) : int
Evaluates to0
because 7
and 2
compare as equal using to the provided function.
Get an implementation of comparison semantics using non-structural comparison.
IComparer<^T>
An object implementing IComparer using NonStructuralComparison.Compare.
Create and use a comparer using structural comparison:
let comparer = ComparisonIdentity.NonStructural<System.DateTime>
comparer.Compare(System.DateTime.Now, System.DateTime.Today)
val comparer: System.Collections.Generic.IComparer<System.DateTime>
module ComparisonIdentity from Microsoft.FSharp.Collections
val NonStructural<'T (requires member (<) and member (>))> : System.Collections.Generic.IComparer<'T> (requires member (<) and member (>))
namespace System
Multiple items
[<Struct>] type DateTime = new: date: DateOnly * time: TimeOnly -> unit + 16 overloads member Add: value: TimeSpan -> DateTime member AddDays: value: float -> DateTime member AddHours: value: float -> DateTime member AddMicroseconds: value: float -> DateTime member AddMilliseconds: value: float -> DateTime member AddMinutes: value: float -> DateTime member AddMonths: months: int -> DateTime member AddSeconds: value: float -> DateTime member AddTicks: value: int64 -> DateTime ...
--------------------
System.DateTime ()
System.DateTime(ticks: int64) : System.DateTime
System.DateTime(date: System.DateOnly, time: System.TimeOnly) : System.DateTime
System.DateTime(ticks: int64, kind: System.DateTimeKind) : System.DateTime
System.DateTime(date: System.DateOnly, time: System.TimeOnly, kind: System.DateTimeKind) : System.DateTime
System.DateTime(year: int, month: int, day: int) : System.DateTime
System.DateTime(year: int, month: int, day: int, calendar: System.Globalization.Calendar) : System.DateTime
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : System.DateTime
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: System.DateTimeKind) : System.DateTime
System.DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: System.Globalization.Calendar) : System.DateTime
System.Collections.Generic.IComparer.Compare(x: System.DateTime, y: System.DateTime) : int
property System.DateTime.Now: System.DateTime with get
<summary>Gets a <see cref="T:System.DateTime" /> object that is set to the current date and time on this computer, expressed as the local time.</summary>
<returns>An object whose value is the current local date and time.</returns>
property System.DateTime.Today: System.DateTime with get
<summary>Gets the current date.</summary>
<returns>An object that is set to today's date, with the time component set to 00:00:00.</returns>
1
.
Get an implementation of comparison semantics using structural comparison.
IComparer<'T>
An object implementing IComparer using Operators.compare.
Create and use a comparer using structural comparison:
let compareTuples = ComparisonIdentity.Structural<int * int>
compareTuples.Compare((1, 4), (1, 5))
val compareTuples: System.Collections.Generic.IComparer<int * int>
module ComparisonIdentity from Microsoft.FSharp.Collections
val Structural<'T (requires comparison)> : System.Collections.Generic.IComparer<'T> (requires comparison)
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
System.Collections.Generic.IComparer.Compare(x: int * int, y: int * int) : int
Evaluates to-1
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4