summaryrefslogtreecommitdiff
path: root/exercism/emacs-lisp/rna-transcription/rna-transcription.el
blob: bb39f2b0241a609545cfdc2d9f08f118f7b693c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
;;; rna-transcription.el -- RNA Transcription (exercism)
;;; Commentary:
;;; Code:

(require 'seq)

(defun char-to-rna (c)
  (cond
   ((eql ?G c) ?C)
   ((eql ?C c) ?G)
   ((eql ?T c) ?A)
   ((eql ?A c) ?U)
   (t (error 'invalid-char))))

(defun to-rna (str)
  (apply 'string (seq-map 'char-to-rna str)))

(provide 'rna-transcription)
;;; rna-transcription.el ends here