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
/// Performs nuclear fission by reference | |
void atom_splitter(Atom atom, Atom& atom_out_1, Atom& atom_out_1) { | |
// Oak Ridge won't let us show this | |
} | |
int main() { | |
Atom uranium = Atom::Uranium; | |
Atom krypton, barium; | |
atom_splitter(uranium, &krypton, &barium); | |
} |
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
/// Determines whether something is a robot | |
fn is_robot(entity: Entity) -> bool { | |
// TODO: Write this for real | |
unimplemented!() | |
} | |
#[test] | |
fn test_robot_detector() { | |
assert_eq!(is_robot(Entity::SamRemedios), false); | |
assert_eq!(is_robot(Entity::Roomba), true); |
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
from math import sqrt | |
import time | |
def is_prime(n): | |
if n == 1 or (n > 2 and n % 2 == 0): | |
return False | |
else: | |
rbool = True | |
sroot = int(sqrt(n) + 1) | |
for i in range(3,sroot,2): |
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
#![feature(iterator_step_by)] | |
extern crate rayon; | |
use rayon::prelude::*; | |
use std::time::SystemTime; | |
fn is_prime(n: i64) -> bool { | |
if n == 1 || (n > 2 && n % 2 == 0) { | |
false | |
} else { | |
let mut rbool = true; |
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
use std::collections::hash_map::{self, HashMap}; | |
use std::hash::Hash; | |
pub struct HashWrap<K, V>(HashMap<K, V>); | |
impl<K, V> From<HashMap<K, V>> for HashWrap<K, V> { | |
fn from(value: HashMap<K, V>) -> Self { | |
Self(value) | |
} | |
} |
OlderNewer