This file contains 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
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, |
This file contains 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
// ---------------- 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`. | |
*/ |
This file contains 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
// ---------------- 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`. | |
*/ |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
#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; |
This file contains 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 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); | |
} |
This file contains 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
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); |