Skip to content

nucleotide-count has no template #512

@BartMassey

Description

@BartMassey

nucleotide/src/lib.rs should be

use std::collections::HashMap;

/// Count the number of occurrences of each of the four nucleotides
/// G, A, C, T.
pub fn nucleotide_counts(dna: &str) -> Result<HashMap<char, usize>, ()> {
    unimplemented!("Count the occurrences of G, A, C, T in {}.", dna);
}

/// Count the number of occurrences of a given nucleotide,
/// which must be either G, A, C or T.
pub fn count(nuc: char, dna: &str) -> Result<usize, ()> {
    unimplemented!("Count the occurrences of {} in {}.", nuc, dna);
}

Also, these should arguably return Option instead of Result, or just panic!() with a failed assert!() on bad input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions