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
let tuple = "a","b" | |
let v1 = System.String.Compare(tuple) // error | |
let v2 = System.Object.Equals(tuple) // no error |
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
#if INTERACTIVE | |
#r "nuget: FsToolkit.ErrorHandling" | |
#endif | |
open System.Text.Json | |
open FsToolkit.ErrorHandling | |
/// All Error DUs should implement this to "take part" in generalised fault reporting. | |
[<Interface>] | |
type IFault = |
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: OpenAI, 2.0.0" | |
open OpenAI.Chat | |
open System.Text.Json | |
open System.Collections.Generic | |
open System.IO | |
let client = ChatClient("gpt-4o", "KEY GOES HERE") | |
module FsOpenAi = |
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: OpenAI, 2.0.0" | |
open OpenAI.Chat | |
let client = | |
ChatClient("gpt-4o-mini", "API-KEY-GOES-HERE") | |
//1. Basic call | |
let response = | |
client.CompleteChat([ UserChatMessage "Please send a funny greeting back to me!" :> ChatMessage ]) |
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
City | State | Latitude | Longitude | |
---|---|---|---|---|
MILAN | IL | 41.453089 | -90.5720803 | |
WATERLOO | IA | 42.492786 | -92.3425775 | |
JACKSON | TN | 35.6145169 | -88.81394689999999 | |
BIRMINGHAM | AL | 33.5185892 | -86.8103567 | |
SPARKS | NV | 39.5349112 | -119.7526886 | |
NEWTON | NC | 35.6698552 | -81.22147079999999 | |
DENVER | CO | 39.7392358 | -104.990251 | |
TERRE HAUTE | IN | 39.4667034 | -87.41390919999999 | |
FLORENCE | KY | 38.9989499 | -84.62661109999999 |
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.EntityFrameworkCore.SqlServer, 8.0.8" | |
open Microsoft.EntityFrameworkCore | |
open System | |
open System.Linq | |
// Our domain model with a custom wrapped ID type | |
type Id<'T> = | |
| Id of Guid |
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 LinqOo = | |
/// Selects a value into another shape. | |
type ISelectable<'a, 'b> = | |
abstract Select: 'a -> 'b | |
/// Filters a value. | |
type IFilterable<'a> = | |
abstract Filter: 'a -> bool | |
type ICollectable<'a, 'b> = |
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
source https://api.nuget.org/v3/index.json | |
framework: net8.0 | |
storage: none | |
nuget Microsoft.ApplicationInsights.Profiler.AspNetCore |
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
// A generic Record | |
type Person<'T> = { | |
Name: string | |
Age: int | |
Singleton: 'T -> 'T list | |
} | |
// Creating a value with an "open" generic argument (?) | |
let personRec : Person<'T> = { | |
Name = "Isaac" |
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 | |
let s = "Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53" | |
// challenge - split above into values we can reason about e.g. | |
type Card = { | |
Id : int // 1 | |
Winning : int list // 41 48 83 86 17 | |
Ticket : int list // 83 86 6 31 17 9 48 53 | |
} |
NewerOlder