Skip to content

Commit

Permalink
added macro as bonus
Browse files Browse the repository at this point in the history
  • Loading branch information
golanor committed Feb 7, 2024
1 parent 196fa18 commit 2962f22
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Instructions append

This is a good exercise to experiment with non-standard string literals.

A short introduction to non-standard string literals can be found in this [blog post](https://web.archive.org/web/20170625222109/https://iaindunning.com/blog/julia-unicode.html).

You can extend your solution by adding the functionality described below.

## Bonus
Implement a string literal that translates RNA strings as:
```julia
rna"AUGUGU" == ["Methionine", "Cysteine"]
```
10 changes: 9 additions & 1 deletion exercises/practice/protein-translation/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ include("protein-translation.jl")
@testset "Incomplete RNA sequence can translate if given a stop codon" begin
@test rna_to_amino_acids("UGGUGAUG") == ["Tryptophan"]
end
end

# Bonus
if isdefined(@__MODULE__, Symbol("@rna_str"))
@eval @testset "Bonus: rna string macro" begin
@test rna"AUGUUUUUAUGGUACUAG" == ["Methionine", "Phenylalanine", "Leucine", "Tryptophan", "Tyrosine"]
end
end

end

0 comments on commit 2962f22

Please sign in to comment.