This file contains hidden or 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
| module TelegramWebApp = | |
| open System.Security.Cryptography | |
| open System.Text | |
| open System.Web | |
| let validateInitData botToken (initData: string) = | |
| let items = | |
| initData.Split "&" |> Array.map (fun x -> let p = x.Split("=") in (p[0], p[1])) |
This file contains hidden or 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
| module Text = | |
| /// поиск индекс первого вхождения образца в строке | |
| let findFirst (s: string) (p: string) = | |
| // предикат проверяющий совпадение части строки с образцом | |
| let eqSample i (s: string) (p: string) = | |
| let rec loop j = | |
| if j < p.Length && p.[j] = s.[i + j] then | |
| loop (j + 1) | |
| else |
This file contains hidden or 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 Company.AdPlaceSearchEngine; | |
| public record Location(string Name); | |
| public record AdPlace(string Name); | |
| public abstract record SearchResult(Location Location) | |
| { | |
| public record NotFound(Location Location) : SearchResult(Location); | |
| public record Success(Location Location, List<AdPlace> AdPlaces) : SearchResult(Location); | |
| } |
This file contains hidden or 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
| // продолжения на F# | |
| type Cont<'a, 'r> = ('a -> 'r) -> 'r | |
| module Cont = | |
| // Создание continuation из значения | |
| let ret (x: 'a) : Cont<'a, 'r> = | |
| fun k -> k x | |
| // Связывание continuation | |
| let bind (m: Cont<'a, 'r>) (f: 'a -> Cont<'b, 'r>) : Cont<'b, 'r> = |
This file contains hidden or 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
| #r "nuget: FSharp.Data" | |
| open FSharp.Data | |
| open System | |
| type AccountTransaction = | |
| { Date: DateTime | |
| Category: string | |
| Amount: decimal | |
| Description: string } |
OlderNewer