Created
April 23, 2017 18:08
-
-
Save lispm/1d9543046a9ad327d1707ce9deec87bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-condition invalid-nucleotide-error (error) | |
((nucleotide :initarg :nucleotide))) | |
(defvar *nuc-table* | |
'((#\G . #\C) (#\C . #\G) (#\T . #\A) (#\A . #\U))) | |
(defun transcribe (nucleotide) | |
(or (cdr (assoc nucleotide *nuc-table*)) | |
(error 'invalid-nucleotide-error :nucleotide nucleotide))) | |
(defun to-rna (string) | |
(map 'string #'transcribe string)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment