exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

rna-transcription.el (659B)


      1 ;;; rna-transcription.el -- RNA Transcription (exercism)
      2 
      3 ;;; Commentary:
      4 
      5 ;;; Code:
      6 
      7 (provide 'rna-transcription)
      8 
      9 (defun transcribe (nucleotide)
     10 "Return the matching RNA pair for DNA NUCLEOTIDE."
     11   (cond ((char-equal nucleotide ?C) "G")
     12         ((char-equal nucleotide ?G) "C")
     13         ((char-equal nucleotide ?A) "U")
     14         ((char-equal nucleotide ?T) "A")
     15         ((error "Unrecognized nucleotide"))))
     16 
     17 (defun to-rna (dna)
     18 "Transcribe a string representing DNA nucleotides.
     19 Return a string representing RNA nucleotides."
     20   (cl-loop for nucleotide being the elements of dna
     21            concat (transcribe nucleotide)))
     22 
     23 ;;; rna-transcription.el ends here