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
| #![allow(deprecated)] | |
| //#![feature(cfg_select, assert_matches)] | |
| use std::assert_matches; | |
| use rand_0_8_6::{thread_rng as rng_legacy, Rng as RngLegacy}; | |
| use rand_0_9_4::{thread_rng as rng_latest, Rng as RngLatest}; | |
| use num_bigint::BigUint; | |
| use chrono::Local; |
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
| //// Coltrane's Circle of Tones | |
| // Written using only the Rust Standard Library. | |
| use std::fmt; | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Note { | |
| C, Db, D, Eb, E, F, Gb, G, Ab, A, Bb, B, | |
| } |
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
| Cargo.lock |
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
| SELECT count(*) as activity, actor_attributes_login FROM publicdata:samples.github_timeline WHERE actor_attributes_login != '' GROUP BY actor_attributes_login ORDER BY activity DESC LIMIT 1000; |
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
| //! Proving and verifying Boolean function $v$-slices with integer inner products. | |
| //! References: "Slicing Boolean Functions with Inner Products" | |
| use std::collections::BTreeMap; | |
| /// Evaluates a standard linear form $\langle v, x \rangle$ over the integers, | |
| /// where $v \in \mathbb{Z}^n$ and $x \in \mathbb{F}_2^n$. | |
| pub fn compute_inner_product(v: &[i32], x: u32, n: usize) -> i32 { | |
| let mut ip = 0; | |
| for i in 0..n { |
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
| /target |
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
| // A "faucet" that drips out approximations of Phi using nested radicals: | |
| // x_{n+1} = sqrt(1 + x_n) | |
| struct NestedRadicalFaucet { | |
| current: f64, | |
| } | |
| impl NestedRadicalFaucet { | |
| fn new() -> Self { | |
| // Start with the outermost 1 (before any square roots are applied) | |
| NestedRadicalFaucet { current: 1.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
| // ========================================================================= | |
| // CORE TYPES & TRAIT | |
| // ========================================================================= | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } |
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
| // ========================================================================= | |
| // CORE TYPES & TRAIT | |
| // ========================================================================= | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } |
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
| use std::fmt; | |
| /// The two possible moves a player can make in the Prisoner's Dilemma. | |
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |
| enum Move { | |
| Cooperate, | |
| Defect, | |
| } | |
| /// Represents a game-theoretic strategy. |
NewerOlder