Skip to content

Instantly share code, notes, and snippets.

View forrestthewoods's full-sized avatar

Forrest Smith forrestthewoods

View GitHub Profile
SIQuantity :: struct($DataType: Type,
$LengthNum: int, $LengthDenom: int, $LengthExp: int,
$MassNum: int, $MassDenom: int, $MassExp: int,
$TimeNum: int, $TimeDenom: int, $TimeExp: int)
{
amount : DataType;
}
Meters :: #bake_arguments SIQuantity(
LengthNum=1, LengthDenom=1, LengthExp=1,
// ---------------- quantity.rs
/*!
Declares foundational `QuantityT<T,U>` struct upon which fts_units is built.
`QuantityT<T,U>` defines a `Quantity` which stores an `amount` of type `T` with units type `U`. Mathematical operations with `QuantityT<T,U>` values produces new types of `QuantityT` with a different `U` type.
If `U` is zero sized then all the type checking done and compile time and boils down to nothing. No run-time overhead for either CPU or memory.
Mathematical operations for `QuantityT<T,U>` are defined so long as they are independently defined for both `T` and `U`.
*/
// ---------------- quantity.rs
/*!
Declares foundational `QuantityT<T,U>` struct upon which fts_units is built.
`QuantityT<T,U>` defines a `Quantity` which stores an `amount` of type `T` with units type `U`. Mathematical operations with `QuantityT<T,U>` values produces new types of `QuantityT` with a different `U` type.
If `U` is zero sized then all the type checking done and compile time and boils down to nothing. No run-time overhead for either CPU or memory.
Mathematical operations for `QuantityT<T,U>` are defined so long as they are independently defined for both `T` and `U`.
*/
import os
import json
import matplotlib.pyplot as plt
import numpy as np
import requests
from matplotlib.offsetbox import AnnotationBbox, OffsetImage
from concurrent.futures import ThreadPoolExecutor
# Example URLS
import os
import json
import matplotlib.pyplot as plt
import numpy as np
import pprint
import requests
from matplotlib.offsetbox import AnnotationBbox, OffsetImage
# Useful URLS
#include <array>
#include <chrono>
#include <numeric>
#include <sstream>
#include <thread>
#include <vector>
using Nanoseconds = std::chrono::nanoseconds;
using Microseconds = std::chrono::microseconds;
using Milliseconds = std::chrono::milliseconds;
const expect = @import("std").testing.expect;
const std = @import("std");
pub fn main() anyerror!void {
var alloc = std.heap.GeneralPurposeAllocator(.{}){};
defer std.debug.assert(!alloc.deinit());
try day01(&alloc.allocator);
}
mod data;
/*
pub mod day00 {
use std::fmt::Write;
pub fn run() -> String {
let mut result = String::with_capacity(128);
let answer_part1 = part1(crate::data::DAY00);