In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.
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
#!/bin/bash | |
# Get the architecture of the machine | |
arch=$(uname -m) | |
os=$(uname -s) | |
# Download the Zellij binary | |
if [ "$os" == "Darwin" ]; then | |
filename="zellij-${arch}-apple-darwin.tar.gz" | |
url="https://github.com/zellij-org/zellij/releases/latest/download/$filename" |
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
[package] | |
name = "spinhost" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
# Spin runtime | |
spin-app = { git = "https://github.com/fermyon/spin", tag = "v1.3.0" } | |
spin-core = { git = "https://github.com/fermyon/spin", tag = "v1.3.0" } | |
spin-oci = { git = "https://github.com/fermyon/spin", tag = "v1.3.0" } |
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
(Rot (V z)) = (V (- 0.0 z)) | |
(Rot (G x y)) = (G (Rot y) x) | |
(Add (V z) (V w)) = (V (+ z w)) | |
(Add (G x y) (G w z)) = (G (Add x w) (Add y z)) | |
(Get (V x) f) = (f x) | |
(Get (G x y) f) = (f x y) | |
Nil = λm λx (m x) |
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
Flip (n: Nat) : Nat | |
Flip Nat.zero = 1n | |
Flip (Nat.succ Nat.zero) = 0n | |
Mod2 (n: Nat) : Nat | |
Mod2 Nat.zero = Nat.zero | |
Mod2 (Nat.succ n) = Flip (Mod2 n) | |
IsEven (n: Nat) : Type | |
IsEven Nat.zero = Unit |
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
name: Security audit | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
paths: | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
jobs: | |
security_audit: |
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
Show hidden characters
// Delete Backward. | |
// Put this into your user packages folder. Can be found by navigating to Preferences > Browse Packages... in Sublime Text. | |
// Then add something like this to your user Key Bindings. | |
// { "keys": ["alt+backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/User/Delete Subword Backward.sublime-macro"} } | |
[ | |
{ | |
"args": | |
{ | |
"by": "subwords", | |
"extend": true, |
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
const fs = require('fs'); | |
const path = require('path'); | |
const inquirer = require('inquirer'); | |
const uuidv4 = require('uuid/v4'); | |
const owasp = require('owasp-password-strength-test'); | |
const words = new Set([...require('wordlist-english')['english/10'], ...require('wordlist-english')['english/20']]); | |
const thingsIDontDoAnyMore = require("./thingsIDontDoAnyMore.json"); | |
const { items } = require('./bitwarden_export_file.json'); |