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
open System.IO | |
let lines = File.ReadAllLines "references.fsx" | |
let fixedLines = lines |> Array.map (fun line -> | |
if line.StartsWith("#r") then | |
if line.Contains("/usr/share/dotnet/packs/") then | |
line.Replace("/packs/", "/shared/") | |
.Replace(".Ref/","/") | |
.Replace("/ref/net8.0/", "/") |
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: Fli" | |
open Fli | |
open System | |
open System | |
let isHelpRequested = fsi.CommandLineArgs |> Seq.contains "--h" | |
[<Literal>] |
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: NodaMoney" | |
open NodaMoney | |
open System | |
open System.Threading.Tasks | |
module Products = | |
type Product = | |
| Shoes | |
| Skirt |
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
type MyType = | |
| MyCase | |
static member statFun x = match x with MyCase -> "I'm static member function!" | |
static member statFunUnit () = "I'm static member function with unit param!" | |
static member statFunGeneric (x, y) = | |
match x with MyCase -> $"I'm static member function with generic param with value = %O{y}!" | |
static member statProp = "I'm static member property!" | |
member this.objProp = match this with MyCase -> "I'm object member property!" | |
member this.objFunGen x = match this with MyCase -> $"I'm object member function with param with value = %O{x}!" | |
member this.objFunUnit () = match this with MyCase -> "I'm object member function with unit param!" |
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
(* | |
An exercise in modeling. Users can be verified or banned. A user can be banned only if their username is "offensive". | |
We assume the Onion architecture. Modules `User` and `Verification` belong to the model. Module `UserVerification` | |
belongs to the application layer. Data access layer is omitted completely; it should be fairly trivial. | |
Note that the verified/banned aspect of a user is modeled "externally" to the notion of user itself. In particular, | |
there are no "aggregates" below which combine all aspects of a user. | |
*) |
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 rec Dat | |
open Browser.Types | |
open Fable.Core | |
open System | |
[<ImportAll("dat.gui")>] | |
let exports: IExports = jsNative | |
[<AllowNullLiteral>] |
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
// SRTP: Statically Resolved Type Parameters | |
// https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters | |
// SRTP Allows for pulling members out of types that where the member is named and typed the same | |
// In this example SRTP will be used to pull out the 'First: string' and 'Last: string' members | |
// from different types | |
// One example of SRTP in the F# Base Class Library is the (+) operator. | |
// You'll see that it has this type signature: |
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:Microsoft.ML" | |
#r "nuget:Microsoft.ML.OnnxRuntime" | |
#r "nuget:Microsoft.ML.OnnxTransformer" | |
#r "nuget:Microsoft.ML.ImageAnalytics" | |
#r "nuget:System.Drawing.Common" | |
open System.IO | |
open System.Drawing | |
open Microsoft.ML | |
open Microsoft.ML.Data |
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
open System | |
type Settings = { | |
Capacities : array<float> | |
MaxRates : array<float> | |
ValveState : array<int> | |
Hash: int | |
} with | |
static member TrivialButPossiblyOkHash _ _ valueStates = | |
// This or some other way of combining the values eg. xor etc without copying my be good | |
// enought. You can test it on your data. With random values for the value states this is |
NewerOlder