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
---- | |
-- Lift (reusable instance) | |
---- | |
-- | Lift an instance through an applicative functor. | |
-- | | |
-- | Applicative functors preserve identities and associativity, though | |
-- | perhaps not commutativity. The most well-known example is perhaps | |
-- | that functions into a monoid themselves form a monoid. | |
-- | |
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
// inspired by https://github.com/tj/git-extras/blob/master/bin/git-line-summary | |
const util = require("util"); | |
const exec = util.promisify(require("child_process").exec); | |
const execSync = require("child_process").execSync; | |
const DIR = "/Users/poshannessy/FB/code/react-clean"; | |
const REF = "origin/master"; | |
const AUTHOR = "Paul O’Shannessy"; | |
const PERIOD_DAYS = 1; |
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
{- | |
In this file I: | |
- Define a binary tree. | |
- Define a type level predicate for right rotation of a tree. That is, this type | |
can only be instantiated for trees that can be right rotated. | |
- Prove that it's decidable if a tree can be right-rotated or not. | |
- Prove that right-rotating a tree preserves in-order traversal. | |
-} | |
-- A binary tree. |
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
<# | |
.SYNOPSIS | |
Downloads Rust installers for Windows. | |
.DESCRIPTION | |
Tries to download the latest available release for a given version of the Rust compiler. It does this by checking the date the currently installed compiler was built against the timestamp of the remote installer. These do not always match up, so do not be surprised if this script keeps trying to re-download the same archive. | |
Once downloaded, provided you specified either 'exe' or 'msi', the script will run the installer for you. |
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
// Modular exponentiation by squaring | |
fn mod_exp(base: &BigUint, exponent: &BigUint, modulus: &BigUint) -> BigUint { | |
let (zero, one): (BigUint, BigUint) = (Zero::zero(), One::one()); | |
let mut result = one.clone(); | |
let mut baseAcc = base.clone(); | |
let mut exponentAcc = exponent.clone(); | |
while exponentAcc > zero { | |
// Accumulate current base if current exponent bit is 1 | |
if (exponent & one) == one { |