Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct
- Get .NET SDK with
sudo apt install dotnet9(ordotnet-sdk-9.0),brew install dotnetfor macOS - Get FSharpPacker tool with
dotnet tool install -g --allow-roll-forward FSharpPacker - Make an F# interactive script file (e.g. copy the
phash.fsxbelow) - Compile it with
fspack {your-script.fsx} -f net9.0 -o {destination} --aot
(in this example:fspack phash.fsx -f net9.0 -o . --aot), note that it will take some time to do so for the first time - .NET needs to fetch IL AOT Compiler from Nuget - Profit! You have compiled an F# script to a native binary
- (Optional) If you add fspk.fish, the process is simplified to
fspk {my-script}.fsx!
Note 1: if you are not using macOS or FreeBSD, give https://github.com/ieviev/fflat a try which can produce even smaller binaries
| // Comment about https://mastodon.social/@[email protected]/113064780292323247 | |
| // https://brandewinder.com/2024/09/01/should-i-use-simd-vectors/ | |
| using System.Numerics; | |
| using System.Runtime.InteropServices; | |
| using System.Runtime.Intrinsics; | |
| public class VectorProcessor | |
| { | |
| public static float Take2(float[] left, float[] right) | |
| { |
| module Example | |
| open Fable.Core | |
| open Fable.Core.JsInterop | |
| open Msal | |
| open Configuration | |
| open Account | |
| open System.Collections.Generic | |
| module private Internal = |
| module Demo.HashRings | |
| open System | |
| open System.Collections.Generic | |
| /// Range is a tuple describing (s,e] - where `s` is start | |
| /// (exclusive) index, while `e` is end (inclusive) index. | |
| type Range = ValueTuple<int,int> | |
| [<RequireQualifiedAccess>] |
| open System | |
| type Interval = | |
| | PerfectUnison | |
| | MinorSecond | |
| | MajorSecond | |
| | MinorThird | AugmentedSecond // Enharmonically the same in 12TET | |
| | MajorThird | |
| | PerfectFourth | |
| | DiminishedFifth | AugmentedFourth // Enharmonically the same in 12TET |
- Install Homebrew from https://brew.sh
$ brew install podman| using System; | |
| using System.Threading.Tasks; | |
| namespace System.Collections.Concurrent | |
| { | |
| public static class ConcurrentDictionaryExtensions | |
| { | |
| /// <summary> | |
| /// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>. | |
| /// </summary> |
Application logging is ubiquitous and invaluable for troubleshooting. Structured logging enables you to log formatted messages and the data fields separately so that you can see the messages but also filter on the data fields. Tracing takes this a step further, where you can correlate many log entries together as you follow a trace of execution through an application. Traces also include additional information about the execution process, such as the sequence of calls to dependencies and how long any given call may take.
Application Insights lets you see all of this data correlated together in an application. You can search for an error log and then see in the execution flow that the log entry was added right after a failed call to another service. Or you can see that a certain web request is slower than others because it spends a lot of time on many redundant data access calls.
This is an example on how to use WPF and F# to do a simple physics game using Verlet Integration.
The program creates a system of particles and constraints. Particles have inertia and is affected by gravity but their motion is also contrained by the constraints.
You control the ship by firing rockets attached to the ship. Use the arrow keys to fire the rockets.
I tried to annotate the source code to help guide a developer familiar with languages like C#. If you have suggestions for how to improve it please leave a comment below.