The Prototype
Cloning existing STARK polynomial structures.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Duplication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CAIRO PATTERN //
#[derive(Copy, Drop)]
struct Polynomial { degree: u32, coefficients: felt252 }
trait ICloneable {
fn clone(self: @Polynomial) -> Polynomial;
}
impl PolynomialClone of ICloneable {
fn clone(self: @Polynomial) -> Polynomial {
Polynomial { degree: *self.degree, coefficients: *self.coefficients }
}
}
Instead of forging new polynomials from scratch, the Prototype clones existing ones, saving invaluable STARK execution steps.
Runic Tags:
#cairo
#design-pattern
#prototype