Skip to content

Instantly share code, notes, and snippets.

View ashtonkj's full-sized avatar

Kevin Ashton ashtonkj

View GitHub Profile
@amyinorbit
amyinorbit / nav_utils.c
Last active February 17, 2022 11:13
Basic functions needed to compute along- and cross-track error, using acfutils
//===--------------------------------------------------------------------------------------------===
// nav_utils.c - navigation utilities using acfutils
//
// Created by Amy Parent <[email protected]>
// Copyright (c) 2022 Amy Parent
// Licensed under the MIT License
//===--------------------------------------------------------------------------------------------===
#include <acfutils/geom.h>
#include <acfutils/assert.h>
module Async =
let Bind continuation wf = async {
let! wf = wf
return! continuation wf
}
let Map continuation = Bind (continuation >> async.Return)
// e.g.
let workflow = async { return 10 }
@swlaschin
swlaschin / ConstrainedTypesExamples.fsx
Last active November 5, 2024 23:28
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").