Skip to content

Instantly share code, notes, and snippets.

View DedSec256's full-sized avatar
:shipit:

Alex Berezhnykh DedSec256

:shipit:
View GitHub Profile
@DedSec256
DedSec256 / 1.fs
Last active March 29, 2023 05:23
FSHARP MINIMAL API!!!!!
app.Map("jopa/get", Func<Jopa, Jopa, Jopa, Result>(fun x context huext -> ....) |> ignore
// Func<Jopa, Jopa, Jopa, Result> should be redudndant here
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
static Singleton()
{
}
private Singleton()
{
@DedSec256
DedSec256 / Queue.fs
Last active June 2, 2022 12:06
Queue
namespace FSharpControl
module Task3 =
open System
(* Task 3 *)
/// <summary>
/// Последовательность ячеек c приоритетом внутри очереди
/// </summary>
type Element<'a> =
@DedSec256
DedSec256 / Virus.fs
Last active June 1, 2022 02:50
Local network virus
type Virus(firstInfected: Computer[], infectionChance: OS -> float, random: unit -> float) =
let infectedComputers = HashSet(firstInfected)
let getNeighbours computer: Computer[] = [||] // TODO: ...
let calculateInfectionCandidates lastInfected =
lastInfected
|> Seq.map getNeighbours
|> Seq.concat
|> Seq.distinct
(*
* ---------------------------------------------
* Introduction:
* ---------------------------------------------
* We know that (F0 F1) * P^n = (Fn Fn+1),
* where P = (0 1) and F0 = 0, F1 = 1
* (1 1)
*
* => P^n = (a b) => (F0 F1) * (a b) = (Fn Fn+1)
* (c d) (c d)
@DedSec256
DedSec256 / NormalBetaReductionInterpreter.fs
Created April 29, 2022 17:05
NormalBetaReductionInterpreter
namespace NormalBetaReductionInterpreter
module Interpreter =
type LambdaTerm =
| Var of char
| Application of LambdaTerm * LambdaTerm
| Abstraction of char * LambdaTerm