mirror of
https://github.com/Smaug123/mystery-hunt-2023-reactivation
synced 2025-10-14 00:48:43 +00:00
Format
This commit is contained in:
@@ -5,16 +5,24 @@ module Seq =
|
||||
|
||||
let minMax (s : int seq) : struct (int * int) voption =
|
||||
use e = s.GetEnumerator ()
|
||||
if not (e.MoveNext ()) then ValueNone else
|
||||
|
||||
let mutable min = e.Current
|
||||
let mutable max = e.Current
|
||||
while e.MoveNext () do
|
||||
if e.Current < min then min <- e.Current
|
||||
if e.Current > max then max <- e.Current
|
||||
ValueSome (struct (min, max))
|
||||
if not (e.MoveNext ()) then
|
||||
ValueNone
|
||||
else
|
||||
|
||||
let mutable min = e.Current
|
||||
let mutable max = e.Current
|
||||
|
||||
while e.MoveNext () do
|
||||
if e.Current < min then
|
||||
min <- e.Current
|
||||
|
||||
if e.Current > max then
|
||||
max <- e.Current
|
||||
|
||||
ValueSome (struct (min, max))
|
||||
|
||||
let rangeOrZero (s : int seq) : int =
|
||||
match minMax s with
|
||||
| ValueNone -> 0
|
||||
| ValueSome (min, max) -> max - min
|
||||
| ValueSome (min, max) -> max - min
|
||||
|
Reference in New Issue
Block a user