This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CartItem = string | |
type EmptyState = NoItems | |
type PaidForState = { PaidItems : CartItem list; | |
Payment : decimal} | |
type ActiveState = { UnpaidItems : CartItem list; } | |
type Cart = | |
| Empty of EmptyState | |
| Active of ActiveState | |
| PaidFor of PaidForState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CompilationMapping(SourceConstructFlags.SumType), Struct, DebuggerDisplay("{__DebugDisplay(),nq}")] | |
[Serializable] | |
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] | |
public struct PaymentMethod : IEquatable<Program.PaymentMethod>, IStructuralEquatable, IComparable<Program.PaymentMethod>, IComparable, IStructuralComparable | |
{ | |
public static class Tags | |
{ | |
public const int Cash = 0; | |
public const int Check = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculate prime numbers using erathosphen method | |
open System.Collections.Generic | |
let erathosphensSieve n = | |
let numbers = ResizeArray [|2..n|] | |
let mutable p = 2 | |
let mutable ready = false | |
while not ready do | |
match Seq.tryFindIndex (fun x -> x >= p * p) numbers with | |
| None -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let triples n = | |
let mutable triples = [] | |
let mutable ones = [] | |
let mutable pairs = | |
[ for x = 1 to n+1 do | |
for y = x+1 to n+1 do | |
yield x,y] | |
let del k = pairs <- List.filter( (<>) k) pairs | |
while not pairs.IsEmpty do | |
let (x,y) as xy = pairs.Head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program | |
public static void f3(Program.Type3 _arg1) | |
{ | |
if (_arg1 is Program.Type3.Type3Case2) | |
{ | |
Program.Type3.Type3Case2 type3Case = (Program.Type3.Type3Case2)_arg1; | |
return; | |
} | |
if (!(_arg1 is Program.Type3.Type3Case3)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<AutoOpen>] | |
module private Helpers1 = | |
let rec generateFsharpObject (t:Type) : obj = | |
let fail() = failwithf "generateFsharpObject %A " t | |
if t.IsValueType then Activator.CreateInstance(t) | |
elif t = typeof<string> then box "" | |
elif isEnumerable t then | |
if t.IsArray then | |
let valueType = t.GetElementType() | |
let result = Array.CreateInstance( valueType, 0 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Json | |
open System | |
open System.Text | |
open System.Globalization | |
open FParsec | |
type Json = | |
| String of string | |
| Number of decimal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* файл File1.fs *) | |
//module File1 | |
// | |
//let x1 = | |
// printfn "x1" | |
// | |
//do | |
// () | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TYPE RUNNER_STATUS -- статус опции рынка | |
AS ENUM ('ACTIVE', 'REMOVED', 'WINNER', 'LOSER', 'HIDDEN', 'UNKNOWN'); | |
CREATE TYPE SIDE -- тип ставки | |
AS ENUM ( | |
'B', -- ставка ЗА | |
'L' -- ставка ПРОТИВ | |
); | |
CREATE TABLE IF NOT EXISTS teams ( -- команды |
OlderNewer