primitives.rs: implement all fn