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
#I "../hopac/Libs/Hopac/bin/Release/net7.0/" | |
#r "Hopac.Core" | |
#r "Hopac.Platform" | |
#r "Hopac" | |
#load "./Bench.fs" | |
open System | |
open System.Threading | |
open Hopac.Extensions | |
open Hopac.Infixes |
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
query { | |
for order in db.Orders do | |
let status = | |
match order.Status with | |
| 0 | 1 -> "Cancelled/Returned" | |
| _ -> "Valid" | |
where (status = "Valid") | |
select order | |
} |
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
module Order = | |
type T = Order of int | |
let get (db: DataContext) id = | |
query { | |
for order in db.Orders do | |
where (order.Id = id) | |
select (Order id) | |
exactlyOne | |
} |
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 FileChange = | |
| Changed of string | |
| Deleted of string | |
| Created of string | |
| Renamed of string * string | |
let watch folder = | |
async { | |
use fsw = new System.IO.FileSystemWatcher(folder, "*.fsx", EnableRaisingEvents = true) | |
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 (|Empty|_|) = function | |
| xs when Set.isEmpty xs -> Some () | |
| _ -> None | |
[ | |
"rule1", ["192"; "193"] | |
"rule2", ["193"; "194"] | |
"rule3", ["194"; "195"] | |
] | |
|> Seq.fold (fun data (rule, dst) -> |
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 data = | |
query { | |
for packet in communicator.ReceivePackets() do | |
// where (not packet.IsValid) | |
select packet | |
} |
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 numBuffers = 50 | |
[1; 2; 3; 4; 5] | |
|> Seq.mapi (fun i x -> i, x) | |
|> Seq.groupBy (fun (i, _) -> i % numBuffers) | |
|> Seq.map (fun (_, group) -> group |> Seq.map snd |> Seq.toArray) | |
|> Seq.toArray | |
let bufferSize = 500 | |
[1; 2; 3; 4; 5] | |
|> Seq.mapi (fun i x -> i, x) |
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 PagePath = | |
| [<Require(typeof<kendo.Resources.Culture.French>)>] FR | |
| [<Require(typeof<kendo.Resources.Culture.English>)>] EN |
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
open System; | |
open System.Diagnostics; | |
[<EntryPoint>] | |
let main argv = | |
let rec cc amount coins = | |
match (amount, coins) with | |
| (0,_) -> 1 | |
| (_,[]) -> 0 | |
| (amount,_) when amount < 0 -> 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
open System; | |
open System.Diagnostics; | |
[<EntryPoint>] | |
let main argv = | |
let rec cc amount coins = | |
match (amount, coins) with | |
| (0,_) -> 1 | |
| (_,[]) -> 0 | |
| (amount,_) when amount < 0 -> 0 |
NewerOlder