Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
hmmm

Phillip Carter cartermp

🦄
hmmm
View GitHub Profile
We couldn’t find that file to show.
We couldn’t find that file to show.
View deterministic_sampler.go
package main
import (
"errors"
"go.opentelemetry.io/otel/attribute"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)
var (
View fsharp-foundation-goals.md

Herein lies my thoughts on what the FSSF should seek to accomplish and why. Ultimately, it comes down to spending the money that we have to further the reach of the F# language. How that gets done could make for some challenging implementation details.

It's a marketplace out there

Like it or not, language adoption is a game in a market.

Java didn't overtake the world in the 90s because it was better than C++. It did it because Oracle pumped hundreds of millions of dollars into marketing efforts to get people to realize that it was more productive than C++. They even took out ads in newspapers.

And other times you don't need explicit marketing because you're the default language used for a platform (kotlin via Android, Swift via iOS) and you get to piggyback on the marketing for that platform instead. C# fills this role for Microsoft's stuff that's .NET-based. Yes, F# can "me too" here, but this is just a tiny drip of adoption (albeit steady).

View dotproduct-bench.md
// Learn more about F# at http://docs.microsoft.com/dotnet/fsharp

open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running

module DotProduct =
    let rec dotProduct (vector1 : float []) (vector2 : float []) : float =

        if vector1 |> Array.length = 0 then
View bio-abstract-fsharp-stuff.md

Title:

F# is awesome - learn what's new and what you can use it for!

Abstract:

F# is a functional cousin to the C# language. It's part of .NET, but has a lightweight syntax and several awesome features that make it a great choice for writing succinct code, web apps, and doing data scripting and analytics. It's got great tooling support, and highly active community, great package and ecosystem support, and it's used in all kinds of domains.

F# 6 is the latest release of F#, bringing some great new features that simplify some things for beginners and make it an even more well-rounded language for folks who love type safety and robustness but don't want to write a bunch of code to get those things.

View benchmark-simple-option-voption.fs
// Learn more about F# at http://docs.microsoft.com/dotnet/fsharp
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
let MAGIC = 7
let simple n =
n &&& 0xFF
View sunset.txt
https://github.com/honeycombio/zipkin-python-opentracing
https://github.com/honeycombio/dynsampler-js
https://github.com/honeycombio/chef-honeytail
https://github.com/honeycombio/leakybucket
https://github.com/honeycombio/influx2hny
https://github.com/honeycombio/prom2hny
https://github.com/honeycombio/opentelemetry-exporter-go
https://github.com/honeycombio/opentelemetry-exporter-python
https://github.com/honeycombio/opentelemetry-dotnet
https://github.com/honeycombio/zipkin-python-opentracing
View regexes-better.fs
open System.Threading.Tasks
open System.Text.RegularExpressions
let regex s = Regex(s, RegexOptions.Compiled)
let input = System.IO.File.ReadAllText($"{__SOURCE_DIRECTORY__}/regexredux-input5000000.txt")
let text = (regex ">.*\n|\n").Replace(input, "")
let regexCount pattern text =
let rec loop c (m:Match) =
View string-interop-notes.fsx
// Notes:
// 0. Immediately thrown off by `{` and `}` being colorized as the string literal
// 1. Bad expression diagnostic in the interpolation is correct
// 2. String literal in non-triple-quoted string diagnostic is good
// 3. Typing these out works well, editor doesn't freak out
// 4. symbol-based operations all work (symbol highlight, find refs, go to def) for symbols in interpolated stuff
// 5. Breakpoint can be set in the interp string on a single line
// 6. Using interp string with %d/%s/etc. specifiers adjusts the argument's type as expected (e.g., %d{whom} infers a valid type for 'whom')
// 7. Error recoviery for splitting the interpolated expression into a new line matches other rules for splitting things out into new lines
// 8. Quick fix to rename misspelled identifier in interpolation works